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

From: Joao Martins
Date: Wed May 22 2024 - 12:10:52 EST


On 30/04/2024 19:37, Ankur Arora wrote:
> From: Joao Martins <joao.m.martins@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> Signed-off-by: Mihai Carabas <mihai.carabas@xxxxxxxxxx>
> Signed-off-by: Ankur Arora <ankur.a.arora@xxxxxxxxxx>
>
> ---
> 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