[PATCH 4/9] cpuidle-haltpoll: define arch_haltpoll_supported()

Joao Martins joao.m.martins at oracle.com
Wed May 22 09:09:20 PDT 2024


On 30/04/2024 19:37, Ankur Arora wrote:
> From: Joao Martins <joao.m.martins at oracle.com>
> 
> Right now kvm_para_has_hint(KVM_HINTS_REALTIME) is x86 only. In
> pursuit of making cpuidle-haltpoll architecture independent, define
> arch_haltpoll_supported() which handles the architectural check for
> enabling haltpoll.
> 
> Move the (kvm_para_available() && kvm_para_has_hint(KVM_HINTS_REALTIME))
> check to the x86 specific arch_haltpoll_supported().
> 
> Signed-off-by: Joao Martins <joao.m.martins at oracle.com>
> Signed-off-by: Mihai Carabas <mihai.carabas at oracle.com>
> Signed-off-by: Ankur Arora <ankur.a.arora at oracle.com>
> 
> ---
> Changelog:
> 
>   - s/arch_haltpoll_want/arch_haltpoll_supported/


I am not sure it's correct to call supported() considering that it's supposed to
always supported (via WFE or cpu_relax()) and it's not exactly what it is doing.
The function you were changing is more about whether it's default enabled or
not. So I think the old name in v4 is more appropriate i.e. arch_haltpoll_want()

Alternatively you could have it called arch_haltpoll_default_enabled() though
it's longer/verbose.

Though if you want a true supported() arch helper *I think* you need to make a
bigger change into introducing arch_haltpoll_supported() separate from
arch_haltpoll_want() where the former would ignore the .force=y modparam and
never be able to load if a given feature wasn't present e.g. prevent arm64
haltpoll loading be conditioned to arch_timer_evtstrm_available() being present.
Though I don't think that you want this AIUI

	Joao



More information about the linux-arm-kernel mailing list