Skip to content

Commit 48c62ba

Browse files
zhang-ruilenb
authored andcommitted
tools/power turbostat: Exit on unsupported Vendors
Turbostat currently supports x86 processors from Intel, AMD, and Hygon. The behavior of turbostat on CPUs from other vendors has not been evaluated and may lead to incorrect or undefined behavior. Enhance turbostat to exit by default when running on an unsupported CPU vendor. This ensures that users are aware that their CPU is not currently supported by turbostat, guiding them to seek support for their specific hardware through future patches. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 4133be3 commit 48c62ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,9 +1056,9 @@ void probe_platform_features(unsigned int family, unsigned int model)
10561056
{
10571057
int i;
10581058

1059-
platform = &default_features;
10601059

10611060
if (authentic_amd || hygon_genuine) {
1061+
platform = &default_features;
10621062
if (max_extended_level >= 0x80000007) {
10631063
unsigned int eax, ebx, ecx, edx;
10641064

@@ -1071,7 +1071,7 @@ void probe_platform_features(unsigned int family, unsigned int model)
10711071
}
10721072

10731073
if (!genuine_intel)
1074-
return;
1074+
goto end;
10751075

10761076
for (i = 0; turbostat_pdata[i].features; i++) {
10771077
if (VFM_FAMILY(turbostat_pdata[i].vfm) == family && VFM_MODEL(turbostat_pdata[i].vfm) == model) {
@@ -1080,6 +1080,10 @@ void probe_platform_features(unsigned int family, unsigned int model)
10801080
}
10811081
}
10821082

1083+
end:
1084+
if (platform)
1085+
return;
1086+
10831087
fprintf(stderr, "Unsupported platform detected.\n"
10841088
"\tSee RUN THE LATEST VERSION on turbostat(8)\n");
10851089
exit(1);

0 commit comments

Comments
 (0)