[PATCH] cpuidle/powernv: Fix snooze timeout

Daniel Lezcano daniel.lezcano at linaro.org
Fri Jun 24 00:36:01 AEST 2016


On 06/23/2016 03:35 PM, Shreyas B Prabhu wrote:
>
>
> 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.

I see, the snooze exit is very fast.

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

Ok. IMO, it would be cleaner to fix this in the core code.

   -- Daniel

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog



More information about the Linuxppc-dev mailing list