mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-10 02:07:52 +00:00
tools/power turbostat: Harden probe_intel_uncore_frequency()
If sysfs directory "intel_uncore_frequency/cluster00/" exists, then use uncore cluster code (now its own routine). The previous check for "intel_uncore_frequency/package_00_die_00/current_freq_khz", could be unreliable in the face of sparse die id's. Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
231ce08b66
commit
ae3326ac57
@ -5294,16 +5294,13 @@ static void dump_sysfs_file(char *path)
|
|||||||
fprintf(outf, "%s: %s", strrchr(path, '/') + 1, cpuidle_buf);
|
fprintf(outf, "%s: %s", strrchr(path, '/') + 1, cpuidle_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void probe_intel_uncore_frequency(void)
|
static void probe_intel_uncore_frequency_legacy(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char path[256];
|
char path[256];
|
||||||
|
|
||||||
if (!genuine_intel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (access("/sys/devices/system/cpu/intel_uncore_frequency/package_00_die_00/current_freq_khz", R_OK))
|
if (access("/sys/devices/system/cpu/intel_uncore_frequency/package_00_die_00/current_freq_khz", R_OK))
|
||||||
goto probe_cluster;
|
return;
|
||||||
|
|
||||||
BIC_PRESENT(BIC_UNCORE_MHZ);
|
BIC_PRESENT(BIC_UNCORE_MHZ);
|
||||||
|
|
||||||
@ -5335,9 +5332,13 @@ static void probe_intel_uncore_frequency(void)
|
|||||||
fprintf(outf, " %d MHz\n", k / 1000);
|
fprintf(outf, " %d MHz\n", k / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
static void probe_intel_uncore_frequency_cluster(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char path[256];
|
||||||
|
|
||||||
probe_cluster:
|
|
||||||
if (access("/sys/devices/system/cpu/intel_uncore_frequency/uncore00/current_freq_khz", R_OK))
|
if (access("/sys/devices/system/cpu/intel_uncore_frequency/uncore00/current_freq_khz", R_OK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -5351,6 +5352,7 @@ probe_cluster:
|
|||||||
|
|
||||||
sprintf(path_base, "/sys/devices/system/cpu/intel_uncore_frequency/uncore%02d", i);
|
sprintf(path_base, "/sys/devices/system/cpu/intel_uncore_frequency/uncore%02d", i);
|
||||||
|
|
||||||
|
/* uncore## start at 00 and skip no numbers, so stop upon first missing */
|
||||||
if (access(path_base, R_OK))
|
if (access(path_base, R_OK))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5382,6 +5384,17 @@ probe_cluster:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void probe_intel_uncore_frequency(void)
|
||||||
|
{
|
||||||
|
if (!genuine_intel)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (access("/sys/devices/system/cpu/intel_uncore_frequency/uncore00", R_OK) == 0)
|
||||||
|
probe_intel_uncore_frequency_cluster();
|
||||||
|
else
|
||||||
|
probe_intel_uncore_frequency_legacy();
|
||||||
|
}
|
||||||
|
|
||||||
static void probe_graphics(void)
|
static void probe_graphics(void)
|
||||||
{
|
{
|
||||||
/* Xe graphics sysfs knobs */
|
/* Xe graphics sysfs knobs */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user