On 8/29/19 4:27 PM, Marcelo Tosatti wrote: > On Thu, Aug 29, 2019 at 04:10:27PM +0100, Joao Martins wrote: >> When cpus != maxcpus cpuidle-haltpoll will fail to register all vcpus >> past the online ones and thus fail to register the idle driver. >> This is because cpuidle_add_sysfs() will return with -ENODEV as a >> consequence from get_cpu_device() return no device for a non-existing >> CPU. >> >> Instead switch to cpuidle_register_driver() and manually register each >> of the present cpus through cpuhp_setup_state() callback and future >> ones that get onlined. This mimmics similar logic that intel_idle does. >> >> Fixes: fa86ee90eb11 ("add cpuidle-haltpoll driver") >> Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx> >> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> >> --- >> v2: >> * move cpus_read_unlock() right after unregistering all cpuidle_devices; >> (Marcello Tosatti) >> * redundant usage of cpuidle_unregister() when only >> cpuidle_unregister_driver() suffices; (Marcelo Tosatti) >> * cpuhp_setup_state() returns a state (> 0) on success with CPUHP_AP_ONLINE_DYN >> thus we set @ret to 0 [ ... ] > > Reviewed-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx> > Thanks! Meanwhile upon re-reading cpuhp_setup_state() I found out the teardown/offlining and haltpoll_uninit() could be a bit simplified. So I sent out a new version[0], but didn't add your Rb because there's was some very slight functional changes. [0] https://lore.kernel.org/kvm/20190902104031.9296-1-joao.m.martins@xxxxxxxxxx/ Joao