[PATCH] cpuidle/powernv: Fix snooze timeout

Shreyas B Prabhu shreyas at linux.vnet.ibm.com
Thu Jun 23 23:35:11 AEST 2016



On 06/23/2016 03:31 PM, Daniel Lezcano wrote:
> On 06/23/2016 11:28 AM, Balbir Singh wrote:
> 
> [ ... ]
> 
>>> cpuidle_enter_state()
>>> {
>>>     [...]
>>>     time_start = local_clock();
>>>     [enter idle state]
>>>     time_end = local_clock();
>>>     /*
>>>           * local_clock() returns the time in nanosecond, let's shift
>>>           * by 10 (divide by 1024) to have microsecond based time.
>>>           */
>>>          diff = (time_end - time_start) >> 10;
>>>     [...]
>>>     dev->last_residency = (int) diff;
>>> }
>>>
>>> Because of >>10 as opposed to /1000, last_residency is lesser by 2.3%
> 
> I am surprised the last_residency is 2.3% exactly less. The difference
> between >>10 and /1000 is 2.34%.
> 
> What is the next target residency value ?
> 
Target residency of the next idle state is 100 microseconds.
When snooze times out after 100 microseconds, last_residency value
calculated is typically 97 or 98 microseconds.

> Does it solve the issue if you replace >>10 by /1000 ?
> 

Yes it does.

--Shreyas



More information about the Linuxppc-dev mailing list