From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Chao Gao <chao.gao@intel.com>, Kai Huang <kai.huang@intel.com>,
Marc Zyngier <Marc.Zyngier@arm.com>,
Anup Patel <Anup.Patel@wdc.com>,
Huacai Chen <chenhuacai@kernel.org>,
Oliver Upton <oupton@google.com>
Subject: Re: [PATCH v3 0/8] KVM: Register cpuhp/syscore callbacks when enabling virt
Date: Wed, 14 Aug 2024 20:23:46 +0200 [thread overview]
Message-ID: <e8db3e58-38de-47d4-ac6c-08408f9aaa10@redhat.com> (raw)
In-Reply-To: <20240608000639.3295768-1-seanjc@google.com>
On 6/8/24 02:06, Sean Christopherson wrote:
> Register KVM's cpuhp and syscore callbacks when enabling virtualization in
> hardware, as the sole purpose of said callbacks is to disable and re-enable
> virtualization as needed.
>
> The primary motivation for this series is to simplify dealing with enabling
> virtualization for Intel's TDX, which needs to enable virtualization
> when kvm-intel.ko is loaded, i.e. long before the first VM is created. TDX
> doesn't _need_ to keep virtualization enabled, but doing so is much simpler
> for KVM (see patch 3).
>
> That said, this is a nice cleanup on its own, assuming I haven't broken
> something. By registering the callbacks on-demand, the callbacks themselves
> don't need to check kvm_usage_count, because their very existence implies a
> non-zero count.
>
> The meat is in patch 1. Patches 2 renames the helpers so that patch 3 is
> less awkward. Patch 3 adds a module param to enable virtualization when KVM
> is loaded. Patches 4-6 are tangentially related x86 cleanups to registers
> KVM's "emergency disable" callback on-demand, same as the syscore callbacks.
>
> The suspend/resume and cphup paths still need to be fully tested, as do
> non-x86 architectures.
Also placed in kvm/queue, mostly as a reminder to myself, and added
other maintainers for testing on ARM, RISC-V and LoongArch. The changes
from v3 to v4 should be mostly nits, documentation and organization of
the series.
Thanks,
Paolo
> v3:
> - Collect reviews/acks.
> - Switch to kvm_usage_lock in a dedicated patch, Cc'd for stable@. [Chao]
> - Enable virt at load by default. [Chao]
> - Add comments to document how kvm_arch_{en,dis}able_virtualization() fit
> into the overall flow. [Kai]
>
> v2:
> - https://lore.kernel.org/all/20240522022827.1690416-1-seanjc@google.com
> - Use a dedicated mutex to avoid lock inversion issues between kvm_lock and
> the cpuhp lock.
> - Register emergency disable callbacks on-demand. [Kai]
> - Drop an unintended s/junk/ign rename. [Kai]
> - Decrement kvm_usage_count on failure. [Chao]
>
> v1: https://lore.kernel.org/all/20240425233951.3344485-1-seanjc@google.com
>
> Sean Christopherson (8):
> KVM: Use dedicated mutex to protect kvm_usage_count to avoid deadlock
> KVM: Register cpuhp and syscore callbacks when enabling hardware
> KVM: Rename functions related to enabling virtualization hardware
> KVM: Add a module param to allow enabling virtualization when KVM is
> loaded
> KVM: Add arch hooks for enabling/disabling virtualization
> x86/reboot: Unconditionally define cpu_emergency_virt_cb typedef
> KVM: x86: Register "emergency disable" callbacks when virt is enabled
> KVM: Enable virtualization at load/initialization by default
>
> Documentation/virt/kvm/locking.rst | 19 ++-
> arch/x86/include/asm/kvm_host.h | 3 +
> arch/x86/include/asm/reboot.h | 2 +-
> arch/x86/kvm/svm/svm.c | 5 +-
> arch/x86/kvm/vmx/main.c | 2 +
> arch/x86/kvm/vmx/vmx.c | 6 +-
> arch/x86/kvm/vmx/x86_ops.h | 1 +
> arch/x86/kvm/x86.c | 10 ++
> include/linux/kvm_host.h | 14 ++
> virt/kvm/kvm_main.c | 258 ++++++++++++++---------------
> 10 files changed, 175 insertions(+), 145 deletions(-)
>
>
> base-commit: af0903ab52ee6d6f0f63af67fa73d5eb00f79b9a
next prev parent reply other threads:[~2024-08-14 18:23 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-08 0:06 Sean Christopherson
2024-06-08 0:06 ` [PATCH v3 1/8] KVM: Use dedicated mutex to protect kvm_usage_count to avoid deadlock Sean Christopherson
2024-06-10 0:26 ` Huang, Kai
2024-08-14 18:06 ` Paolo Bonzini
2024-08-15 14:39 ` Sean Christopherson
2024-08-15 16:10 ` Paolo Bonzini
2024-08-30 23:45 ` Sean Christopherson
2024-09-02 13:03 ` Paolo Bonzini
2024-06-08 0:06 ` [PATCH v3 2/8] KVM: Register cpuhp and syscore callbacks when enabling hardware Sean Christopherson
2024-06-10 0:55 ` Huang, Kai
2024-08-14 18:12 ` Paolo Bonzini
2024-08-14 20:55 ` Sean Christopherson
2024-06-08 0:06 ` [PATCH v3 3/8] KVM: Rename functions related to enabling virtualization hardware Sean Christopherson
2024-06-08 0:06 ` [PATCH v3 4/8] KVM: Add a module param to allow enabling virtualization when KVM is loaded Sean Christopherson
2024-08-02 12:02 ` Huang, Kai
2024-08-02 12:06 ` Huang, Kai
2024-08-13 2:31 ` Sean Christopherson
2024-08-13 5:22 ` Huang, Kai
2024-08-13 23:47 ` Huang, Kai
2024-08-14 18:14 ` Paolo Bonzini
2024-06-08 0:06 ` [PATCH v3 5/8] KVM: Add arch hooks for enabling/disabling virtualization Sean Christopherson
2024-08-14 18:15 ` Paolo Bonzini
2024-06-08 0:06 ` [PATCH v3 6/8] x86/reboot: Unconditionally define cpu_emergency_virt_cb typedef Sean Christopherson
2024-06-08 0:06 ` [PATCH v3 7/8] KVM: x86: Register "emergency disable" callbacks when virt is enabled Sean Christopherson
2024-06-08 0:06 ` [PATCH v3 8/8] KVM: Enable virtualization at load/initialization by default Sean Christopherson
2024-08-14 18:20 ` Paolo Bonzini
2024-06-10 0:59 ` [PATCH v3 0/8] KVM: Register cpuhp/syscore callbacks when enabling virt Huang, Kai
2024-08-14 18:23 ` Paolo Bonzini [this message]
2024-08-14 22:17 ` Huang, Kai
2024-08-15 14:41 ` Sean Christopherson
2024-08-20 8:57 ` Paolo Bonzini
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=e8db3e58-38de-47d4-ac6c-08408f9aaa10@redhat.com \
--to=pbonzini@redhat.com \
--cc=Anup.Patel@wdc.com \
--cc=Marc.Zyngier@arm.com \
--cc=chao.gao@intel.com \
--cc=chenhuacai@kernel.org \
--cc=kai.huang@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oupton@google.com \
--cc=seanjc@google.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
all inboxes | Powered by JetHome®