lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 28 Oct 2014 19:59:19 +0100
From:	Daniel Lezcano <daniel.lezcano@...aro.org>
To:	Preeti Murthy <preeti.lkml@...il.com>
CC:	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Nicolas Pitre <nicolas.pitre@...aro.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Lists linaro-kernel <linaro-kernel@...ts.linaro.org>,
	patches@...aro.org, Preeti U Murthy <preeti@...ux.vnet.ibm.com>
Subject: Re: [PATCH V2 1/5] sched: idle: cpuidle: Check the latency req before
 idle

On 10/28/2014 04:51 AM, Preeti Murthy wrote:
> Hi Daniel,
>
> On Thu, Oct 23, 2014 at 2:31 PM, Daniel Lezcano
> <daniel.lezcano@...aro.org> wrote:
>> When the pmqos latency requirement is set to zero that means "poll in all the
>> cases".
>>
>> That is correctly implemented on x86 but not on the other archs.
>>
>> As how is written the code, if the latency request is zero, the governor will
>> return zero, so corresponding, for x86, to the poll function, but for the
>> others arch the default idle function. For example, on ARM this is wait-for-
>> interrupt with a latency of '1', so violating the constraint.
>
> This is not true actually. On PowerPC the idle state 0 has an exit_latency of 0.
>
>>
>> In order to fix that, do the latency requirement check *before* calling the
>> cpuidle framework in order to jump to the poll function without entering
>> cpuidle. That has several benefits:
>
> Doing so actually hurts on PowerPC. Because the idle loop defined for
> idle state 0 is different from what cpu_relax() does in cpu_idle_loop().
> The spinning is more power efficient in the former case. Moreover we also set
> certain register values which indicate an idle cpu. The ppc_runlatch bits
> do precisely this. These register values are being read by some user space
> tools.  So we will end up breaking them with this patch
>
> My suggestion is very well keep the latency requirement check in
> kernel/sched/idle.c
> like your doing in this patch. But before jumping to cpu_idle_loop verify if the
> idle state 0 has an exit_latency > 0 in addition to your check on the
> latency_req == 0.
> If not, you can fall through to the regular path of calling into the
> cpuidle driver.
> The scheduler can query the cpuidle_driver structure anyway.
>
> What do you think?

Thanks for reviewing the patch and spotting this.

Wouldn't make sense to create:

void __weak_cpu_idle_poll(void) ?

and override it with your specific poll function ?

-- 
  <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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ