[RFC PATCH v2 1/6] KVM: arm64: Add a helper to check if a VM has ran once

Marc Zyngier maz at kernel.org
Mon Feb 13 07:49:27 PST 2023


On Mon, 13 Feb 2023 15:36:52 +0000,
Sean Christopherson <seanjc at google.com> wrote:
> 
> On Sat, Feb 11, 2023, Oliver Upton wrote:
> > The test_bit(...) pattern is quite a lot of keystrokes. Replace
> > existing callsites with a helper.
> > 
> > No functional change intended.
> > 
> > Signed-off-by: Oliver Upton <oliver.upton at linux.dev>
> > ---
> >  arch/arm64/include/asm/kvm_host.h | 3 +++
> >  arch/arm64/kvm/pmu-emul.c         | 4 ++--
> >  2 files changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> > index 35a159d131b5..012e94bc9e4a 100644
> > --- a/arch/arm64/include/asm/kvm_host.h
> > +++ b/arch/arm64/include/asm/kvm_host.h
> > @@ -1019,6 +1019,9 @@ bool kvm_arm_vcpu_is_finalized(struct kvm_vcpu *vcpu);
> >  	(system_supports_32bit_el0() &&				\
> >  	 !static_branch_unlikely(&arm64_mismatched_32bit_el0))
> >  
> > +#define kvm_vm_has_ran_once(kvm)					\
> 
> From the peanut gallery...
> 
> The ONCE part of the flag+API is unnecessary and flawed from a pendatic point of
> view, e.g. if a VM has ran twice...

Well, what I really wanted was:

kvm_vm_has_run_at_least_once_on_this_side_of_the_multiverse()

> What about kvm_vm_has_run() to align with a similar proposed x86 API for individual
> vCPUs[*], if either one ever gets moved to common code?

I think the original wording is understood by the very people who mess
with this code, most of whom are not even native English speakers. It
may not be pretty to your eyes, but hey, I'm not pretty either.

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list