]> www.infradead.org Git - users/hch/misc.git/commitdiff
tools/power turbostat: Exit on unsupported Vendors
authorZhang Rui <rui.zhang@intel.com>
Tue, 3 Dec 2024 07:51:17 +0000 (15:51 +0800)
committerLen Brown <len.brown@intel.com>
Tue, 3 Dec 2024 21:06:04 +0000 (16:06 -0500)
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>
tools/power/x86/turbostat/turbostat.c

index 5e894b71003c94186183344720d8a27d7609fd4b..cb659b274554b958dfbf38b87768fd6ca8ebeb6d 100644 (file)
@@ -1056,9 +1056,9 @@ void probe_platform_features(unsigned int family, unsigned int model)
 {
        int i;
 
-       platform = &default_features;
 
        if (authentic_amd || hygon_genuine) {
+               platform = &default_features;
                if (max_extended_level >= 0x80000007) {
                        unsigned int eax, ebx, ecx, edx;
 
@@ -1071,7 +1071,7 @@ void probe_platform_features(unsigned int family, unsigned int model)
        }
 
        if (!genuine_intel)
-               return;
+               goto end;
 
        for (i = 0; turbostat_pdata[i].features; i++) {
                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)
                }
        }
 
+end:
+       if (platform)
+               return;
+
        fprintf(stderr, "Unsupported platform detected.\n"
                "\tSee RUN THE LATEST VERSION on turbostat(8)\n");
        exit(1);