linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle-haltpoll: make haltpoll aware of 'idle=' override
@ 2019-10-17  0:39 Zhenzhong Duan
  2019-10-17 19:20 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Zhenzhong Duan @ 2019-10-17  0:39 UTC (permalink / raw)
  To: linux-kernel
  Cc: rjw, daniel.lezcano, linux-pm, mtosatti, Zhenzhong Duan, Joao Martins

Currenly haltpoll isn't aware of the 'idle=' override, the priority is
'idle=poll' > haltpoll > 'idle=halt'. When 'idle=poll' is used, cpuidle
driver is bypassed but current_driver in sys still shows 'haltpoll'.

When 'idle=halt' is used, haltpoll take precedence and make 'idle=halt'
no effect.

Add a check to not load haltpoll driver if there is 'idle=' and haltpoll
is built in. If haltpoll is built as a module, still give a chance for
admin to use it despite 'idle='.

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 drivers/cpuidle/cpuidle-haltpoll.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c
index 932390b..00e9821 100644
--- a/drivers/cpuidle/cpuidle-haltpoll.c
+++ b/drivers/cpuidle/cpuidle-haltpoll.c
@@ -95,6 +95,12 @@ static int __init haltpoll_init(void)
 	int ret;
 	struct cpuidle_driver *drv = &haltpoll_driver;
 
+#if !defined(CONFIG_HALTPOLL_CPUIDLE_MODULE)
+	/* Do not load haltpoll if idle= is passed */
+	if (boot_option_idle_override != IDLE_NO_OVERRIDE)
+		return -ENODEV;
+#endif
+
 	cpuidle_poll_state_init(drv);
 
 	if (!kvm_para_available() ||
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpuidle-haltpoll: make haltpoll aware of 'idle=' override
  2019-10-17  0:39 [PATCH] cpuidle-haltpoll: make haltpoll aware of 'idle=' override Zhenzhong Duan
@ 2019-10-17 19:20 ` Rafael J. Wysocki
  2019-10-17 20:15   ` Joao Martins
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-10-17 19:20 UTC (permalink / raw)
  To: Zhenzhong Duan
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Daniel Lezcano,
	Linux PM, Marcelo Tosatti, Joao Martins

On Thu, Oct 17, 2019 at 2:41 AM Zhenzhong Duan
<zhenzhong.duan@oracle.com> wrote:
>
> Currenly haltpoll isn't aware of the 'idle=' override, the priority is
> 'idle=poll' > haltpoll > 'idle=halt'. When 'idle=poll' is used, cpuidle
> driver is bypassed but current_driver in sys still shows 'haltpoll'.
>
> When 'idle=halt' is used, haltpoll take precedence and make 'idle=halt'
> no effect.
>
> Add a check to not load haltpoll driver if there is 'idle='

OK

> and haltpoll
> is built in. If haltpoll is built as a module, still give a chance for
> admin to use it despite 'idle='.

Why exactly?  Do you have any particular use case in mind?

Otherwise I'd prefer the behavior to be consistent regardless of
whether or not it is a module..

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cpuidle-haltpoll: make haltpoll aware of 'idle=' override
  2019-10-17 19:20 ` Rafael J. Wysocki
@ 2019-10-17 20:15   ` Joao Martins
  0 siblings, 0 replies; 3+ messages in thread
From: Joao Martins @ 2019-10-17 20:15 UTC (permalink / raw)
  To: Rafael J. Wysocki, Zhenzhong Duan
  Cc: Linux Kernel Mailing List, Rafael J. Wysocki, Daniel Lezcano,
	Linux PM, Marcelo Tosatti

On 10/17/19 8:20 PM, Rafael J. Wysocki wrote:
> On Thu, Oct 17, 2019 at 2:41 AM Zhenzhong Duan
> <zhenzhong.duan@oracle.com> wrote:
>> and haltpoll
>> is built in. If haltpoll is built as a module, still give a chance for
>> admin to use it despite 'idle='.
> 
> Why exactly?  Do you have any particular use case in mind?
> 
There was no concrete use-case in particular; we thought that when building as a
module, that the general usage would be for cpuidle-haltpoll to be inserted (or
removed) at some point in the time. And hence allow it to override boot 'idle='
given that you can always remove the module and go back to 'idle='.

> Otherwise I'd prefer the behavior to be consistent regardless of
> whether or not it is a module..
> 
It's best we just remove the conditional and keep it consistent across builtin
and module.

	Joao

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-17 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-17  0:39 [PATCH] cpuidle-haltpoll: make haltpoll aware of 'idle=' override Zhenzhong Duan
2019-10-17 19:20 ` Rafael J. Wysocki
2019-10-17 20:15   ` Joao Martins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).