public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Kai Huang <kai.huang@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Chao Gao <chao.gao@intel.com>
Subject: Re: [PATCH v2 4/6] KVM: Add arch hooks for enabling/disabling virtualization
Date: Tue, 28 May 2024 15:50:32 -0700	[thread overview]
Message-ID: <ZlZfuCI77O9wmHh0@google.com> (raw)
In-Reply-To: <2d873eb4-67d2-446d-8208-a43a4a8aba14@intel.com>

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?

  reply	other threads:[~2024-05-28 22:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22  2:28 [PATCH v2 0/6] KVM: Register cpuhp/syscore callbacks when enabling virt Sean Christopherson
2024-05-22  2:28 ` [PATCH v2 1/6] KVM: Register cpuhp and syscore callbacks when enabling hardware Sean Christopherson
2024-05-22  6:10   ` Chao Gao
2024-05-29 14:29     ` Sean Christopherson
2024-05-22  2:28 ` [PATCH v2 2/6] KVM: Rename functions related to enabling virtualization hardware Sean Christopherson
2024-05-22  7:10   ` Chao Gao
2024-05-22 22:34   ` Huang, Kai
2024-05-22  2:28 ` [PATCH v2 3/6] KVM: Add a module param to allow enabling virtualization when KVM is loaded Sean Christopherson
2024-05-22 22:27   ` Huang, Kai
2024-05-23  4:23     ` Chao Gao
2024-05-23 23:11       ` Huang, Kai
2024-05-24  2:39         ` Chao Gao
2024-05-27 22:36           ` Huang, Kai
2024-05-29 15:01             ` Sean Christopherson
2024-05-29 22:45               ` Huang, Kai
2024-05-29 23:07                 ` Sean Christopherson
2024-05-30  0:06                   ` Huang, Kai
2024-05-22  2:28 ` [PATCH v2 4/6] KVM: Add arch hooks for enabling/disabling virtualization Sean Christopherson
2024-05-22 22:33   ` Huang, Kai
2024-05-28 22:50     ` Sean Christopherson [this message]
2024-05-23  5:31   ` Chao Gao
2024-05-22  2:28 ` [PATCH v2 5/6] x86/reboot: Unconditionally define cpu_emergency_virt_cb typedef Sean Christopherson
2024-05-22 22:35   ` Huang, Kai
2024-05-23  5:41   ` Chao Gao
2024-05-22  2:28 ` [PATCH v2 6/6] KVM: x86: Register "emergency disable" callbacks when virt is enabled Sean Christopherson
2024-05-22 22:37   ` Huang, Kai
2024-05-23  5:59   ` Chao Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZlZfuCI77O9wmHh0@google.com \
    --to=seanjc@google.com \
    --cc=chao.gao@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox