• Prarit Bhargava's avatar
    tools/power/cpupower: allow running without cpu0 · d0e4a193
    Prarit Bhargava authored
    Linux-3.7 added CONFIG_BOOTPARAM_HOTPLUG_CPU0,
    allowing systems to offline cpu0.
    
    But when cpu0 is offline, cpupower monitor will not display all
    processor and Mperf information:
    
    [root@intel-skylake-dh-03 cpupower]# ./cpupower monitor
    WARNING: at least one cpu is offline
        |Idle_Stats
    CPU | POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S
       4|  0.00|  0.00|  0.00|  0.00|  0.90|  0.00| 96.13
       1|  0.00|  0.00|  5.49|  0.00|  0.01|  0.00| 92.26
       5|  0.00|  0.00|  0.00|  0.00|  0.46|  0.00| 99.50
       2| 45.42|  0.00|  0.00|  0.00| 22.94|  0.00| 28.84
       6|  0.00| 37.54|  0.00|  0.00|  0.00|  0.00|  0.00
       3|  0.00|  0.00|  0.00|  0.00|  0.30|  0.00| 91.99
       7|  0.00|  0.00|  0.00|  0.00|  4.70|  0.00|  0.70
    
    This patch replaces the hard-coded use of cpu0 in cpupower with the
    current cpu, allowing it to run without a cpu0.
    
    After the patch is applied,
    
    [root@intel-skylake-dh-03 cpupower]# ./cpupower monitor
    WARNING: at least one cpu is offline
        |Nehalem                    || Mperf              || Idle_Stats
    CPU | C3   | C6   | PC3  | PC6  || C0   | Cx   | Freq || POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S
       4|  0.01|  1.27|  0.00|  0.00||  0.04| 99.96|  3957||  0.00|  0.00|  0.00|  0.00|  1.43|  0.00| 98.52
       1|  0.00| 98.82|  0.00|  0.00||  0.05| 99.95|  3361||  0.00|  0.00|  0.01|  0.00|  0.03|  0.00| 99.88
       5|  0.00| 98.82|  0.00|  0.00||  0.09| 99.91|  3917||  0.00|  0.00|  0.00|  0.00| 99.38|  0.00|  0.50
       2|  0.33|  0.00|  0.00|  0.00||  0.00|100.00|  3890||  0.00|  0.00|  0.00|  0.00|  0.00|  0.00|100.00
       6|  0.33|  0.00|  0.00|  0.00||  0.01| 99.99|  3903||  0.00|  0.00|  0.00|  0.00|  0.00|  0.00| 99.99
       3|  0.01|  0.71|  0.00|  0.00||  0.06| 99.94|  3678||  0.00|  0.00|  0.00|  0.00|  0.80|  0.00| 99.13
       7|  0.01|  0.71|  0.00|  0.00||  0.03| 99.97|  3538||  0.00|  0.69| 11.70|  0.00|  0.00|  0.00| 87.57
    
    There are some minor cleanups included in this patch.
    Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
    Signed-off-by: default avatarThomas Renninger <trenn@suse.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    d0e4a193
nhm_idle.c 4.81 KB