Message ID | 1571272750-29798-1-git-send-email-zhenzhong.duan@oracle.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | cpuidle-haltpoll: make haltpoll aware of 'idle=' override | expand |
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..
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
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() ||