2.6.21-rc5-mm3 - cpuidle, acpi, and C-states

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Valdis.Kletnieks
Date: Saturday, March 31, 2007 - 1:05 am

On Fri, 30 Mar 2007 01:05:59 PDT, Andrew Morton said:

Somebody is confused (possibly me).  Running an x86_64 kernel, and I have:

% cat /proc/acpi/processor/CPU0/power
active state:            C0
max_cstate:              C8
bus master activity:     00000000
maximum allowed latency: 2000 usec
states:
    C1:                  type[C1] promotion[--] demotion[--] latency[001] usage[00000003] duration[00000000000000000000]
    C2:                  type[C2] promotion[--] demotion[--] latency[001] usage[00166266] duration[00000000000000000000]
    C3:                  type[C3] promotion[--] demotion[--] latency[057] usage[02045938] duration[00000000000000000000]

Wow. Lots of zeros in that last column..

The 'duration' is output by this code in drivers/acpi/processor_idle.c that
thinks the value is an 'unsigned long long':

                seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n",
                           pr->power.states[i].latency,
                           pr->power.states[i].usage,
                           (unsigned long long)pr->power.states[i].time);

However, over in /sys, we have non-zero values for the usage/time:

%  cat /sys/devices/system/cpu/cpu0/cpuidle/state?/time
0
110861364
-2091818383

That's because in drivers/cpuidle/sysfs.c, we have this code that thinks
a %d is suitable to output that number:

#define define_show_state_function(_name) static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) { \     
        return sprintf(buf, "%d\n", state->_name);\
}
...
define_one_state_ro(time, show_state_time);

But the negative number for state2/time indicates that *this* isn't right either....
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.21-rc5-mm3, Andrew Morton, (Fri Mar 30, 1:05 am)
Re: 2.6.21-rc5-mm3, Rafael J. Wysocki, (Fri Mar 30, 4:00 am)
Re: 2.6.21-rc5-mm3, Michal Piotrowski, (Fri Mar 30, 9:31 am)
Re: 2.6.21-rc5-mm3, Dmitry Torokhov, (Fri Mar 30, 9:38 am)
Re: 2.6.21-rc5-mm3, Ingo Molnar, (Fri Mar 30, 9:55 am)
Re: 2.6.21-rc5-mm3, Andrew Morton, (Fri Mar 30, 9:59 am)
Re: 2.6.21-rc5-mm3, Michal Piotrowski, (Fri Mar 30, 10:19 am)
Re: 2.6.21-rc5-mm3, Valdis.Kletnieks, (Fri Mar 30, 10:23 am)
Re: 2.6.21-rc5-mm3, Johannes Berg, (Fri Mar 30, 11:58 am)
2.6.21-rc5-mm3 - cpuidle, acpi, and C-states, Valdis.Kletnieks, (Sat Mar 31, 1:05 am)
2.6.21-rc5-mm3: Why was my vioc cleanup patch dropped?, Adrian Bunk, (Sat Mar 31, 12:25 pm)
Re: [2.6 patch] remove the config option for the cs5530a_w ..., Jeremy Fitzhardinge, (Sat Mar 31, 2:05 pm)
Re: [2.6 patch] remove the config option for the cs5530a_w ..., Jeremy Fitzhardinge, (Sat Mar 31, 2:17 pm)
Re: 2.6.21-rc5-mm3 - no boot, "address not 2M aligned", Eric W. Biederman, (Sat Mar 31, 11:15 pm)
Re: 2.6.21-rc5-mm3, Michal Piotrowski, (Sun Apr 1, 9:00 am)
Re: 2.6.21-rc5-mm3, Andrew Morton, (Sun Apr 1, 12:03 pm)
Re: 2.6.21-rc5-mm3, Rafael J. Wysocki, (Sun Apr 1, 1:39 pm)
Re: 2.6.21-rc5-mm3, Rafael J. Wysocki, (Sun Apr 1, 1:56 pm)
Re: 2.6.21-rc5-mm3, Rafael J. Wysocki, (Sun Apr 1, 2:59 pm)
[PATCH 1/2] x86_64: Reflect the relocatability of the kern ..., Eric W. Biederman, (Sun Apr 22, 10:12 pm)
[PATCH 2/2] x86_64: Remove CONFIG_PHYSICAL_START and CONFI ..., Eric W. Biederman, (Sun Apr 22, 10:15 pm)
Re: [PATCH 2/2] x86_64: Remove CONFIG_PHYSICAL_START and C ..., Eric W. Biederman, (Sun Apr 22, 11:17 pm)
Re: [PATCH 1/2] x86_64: Reflect the relocatability of the ..., Eric W. Biederman, (Tue Apr 24, 12:21 am)