[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZlZfuCI77O9wmHh0@google.com>
Date: Tue, 28 May 2024 15:50:32 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Kai Huang <kai.huang@...el.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Chao Gao <chao.gao@...el.com>
Subject: Re: [PATCH v2 4/6] KVM: Add arch hooks for enabling/disabling virtualization
On Thu, May 23, 2024, Kai Huang wrote:
> On 22/05/2024 2:28 pm, Sean Christopherson wrote:
> > static int __kvm_enable_virtualization(void)
> > {
> > if (__this_cpu_read(hardware_enabled))
> > @@ -5604,6 +5614,8 @@ static int kvm_enable_virtualization(void)
> > if (kvm_usage_count++)
> > return 0;
> > + kvm_arch_enable_virtualization();
> > +
> > r = cpuhp_setup_state(CPUHP_AP_KVM_ONLINE, "kvm/cpu:online",
> > kvm_online_cpu, kvm_offline_cpu);
>
>
> Nit: is kvm_arch_pre_enable_virtualization() a better name?
Hmm, yes? I don't have a strong preference either way. I did consider a more
verbose name, but omitted the "pre" because the hook is called only on the 0=>1
transition of kvm_usage_count, and for some reason that made me think "pre" would
be confusing.
On the other hand, "pre" very clearly communicates that the hook is invoked,
and _needs_ to be invoked (for x86), before KVM enables virtualization.
So I'm leaning towards kvm_arch_pre_enable_virtualization().
Anyone else have an opinion?
Powered by blists - more mailing lists