tools/power/x86/intel-speed-select: Special handling for CPU 0 online/offline
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Thu, 5 Mar 2020 22:45:16 +0000 (14:45 -0800)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 20 Mar 2020 12:46:20 +0000 (14:46 +0200)
When "-o" option for force online/offline is used with command:
perf-profile set-config-level

If the config level calls for CPU 0 online/offline, then call fails
as there is special kernel setup required for CPU 0 online/offline
and the currently not setup for that.

But when call is for online CPU 0, then don't fail. Just warn that
this system is not setup for CPU 0 online/offline.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
tools/power/x86/intel-speed-select/isst-config.c

index 405b03c..b8f4846 100644 (file)
@@ -220,8 +220,14 @@ static void set_cpu_online_offline(int cpu, int state)
                 "/sys/devices/system/cpu/cpu%d/online", cpu);
 
        fd = open(buffer, O_WRONLY);
-       if (fd < 0)
+       if (fd < 0) {
+               if (!cpu && state) {
+                       fprintf(stderr, "This system is not configured for CPU 0 online/offline\n");
+                       fprintf(stderr, "Ignoring online request for CPU 0 as this is already online\n");
+                       return;
+               }
                err(-1, "%s open failed", buffer);
+       }
 
        if (state)
                ret = write(fd, "1\n", 2);