Massive number of unexplained wakeups on Thinkpad X60s

John Fremlin john at fremlin.org
Wed Jun 6 07:33:45 PDT 2007


Arjan van de Ven <arjan at linux.intel.com> writes:

> John Fremlin wrote:
>> The wake-up calculation used is this:
>>
>> 		for (i = 0; i < 8; i++)
>> 			if (cur_usage[i])
>> 				totalevents += cur_usage[i] - last_usage[i];
>>
>> where the cur_usage is the number of times C-state i has been entered.
>>
>> Unfortunately, C0 does not produce usage stats.
>
> C0 is also not a sleep state ;)

Yes, C0 is the running state. If C0 did produce usage stats, then its
usage stats would exactly be the number of wake-ups.

As it is, your loop is confusing because it seems to include C0. But
because C0 does not produce usage stats, cur_usage[0] is 0, so that
the loop is effectively

 		for (i = 1; i < 8; i++)
 			if (cur_usage[i])
 				totalevents += cur_usage[i] - last_usage[i];

For a very simple example: suppose the CPU enters state C1. Then
cur_usage[1]=1. Now suppose that it stays there for a few
milliseconds. It will automatically fall down to C2. So
cur_usage[2]=1. Then there is a wake-up and it goes back to C0. Your
calculation will say there were two wake-ups.

This almost double counting of wake-ups is observable on my
laptop. Slightly less than twice as many wakeups are reported using
the C-state usage algorithm, as using the timer-stats wake-up counting
algorithm.



More information about the Power mailing list