From: Sean Christopherson <seanjc@google.com>
To: Kai Huang <kai.huang@intel.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4] x86/reboot: Unconditionally define cpu_emergency_virt_cb typedef
Date: Tue, 21 May 2024 13:02:55 -0700 [thread overview]
Message-ID: <Zkz97y9VVAFgqNJB@google.com> (raw)
In-Reply-To: <1dbb09c5-35c7-49b9-8c6f-24b532511f0b@intel.com>
On Wed, May 15, 2024, Kai Huang wrote:
> How about we just make all emergency virtualization disable code
> unconditional but not guided by CONFIG_KVM_INTEL || CONFIG_KVM_AMD, i.e.,
> revert commit
>
> 261cd5ed934e ("x86/reboot: Expose VMCS crash hooks if and only if
> KVM_{INTEL,AMD} is enabled")
>
> It makes sense anyway from the perspective that it allows the out-of-tree
> kernel module hypervisor to use this mechanism w/o needing to have the
> kernel built with KVM enabled in Kconfig. Otherwise, strictly speaking,
> IIUC, the kernel won't be able to support out-of-tree module hypervisor as
> there's no other way the module can intercept emergency reboot.
Practically speaking, no one is running an out-of-tree hypervisor without either
(a) KVM being enabled in the .config, or (b) non-trivial changes to the kernel.
Exposing/exporting select APIs and symbols if and only if KVM is enabled is a
a well-established pattern, and there are concrete benefits to doing so. E.g.
it allows minimizing the kernel footprint for use cases that don't want/need KVM.
> This approach avoids the weirdness of the unconditional define for only
> cpu_emergency_virt_cb.
I genuinely don't understand why you find it weird to unconditionally define
cpu_emergency_virt_cb. There are myriad examples throughout the kernel where a
typedef, struct, enum, etc. is declared/defined even though support for its sole
end consumer is disabled. E.g. include/linux/mm_types.h declares "struct mem_cgroup"
for pretty much the exact same reason, even though the structure is only fully
defined if CONFIG_MEMCG=y.
The only oddity here is that the API that the #ifdef that guards the usage happens
to be right below the typedef, but it shouldn't take that much brain power to
figure out why a typedef exists outside of an #ifdef.
next prev parent reply other threads:[~2024-05-21 20:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 23:39 [PATCH 0/4] KVM: Register cpuhp/syscore callbacks when enabling virt Sean Christopherson
2024-04-25 23:39 ` [PATCH 1/4] x86/reboot: Unconditionally define cpu_emergency_virt_cb typedef Sean Christopherson
2024-05-13 12:50 ` Huang, Kai
2024-05-13 16:01 ` Sean Christopherson
2024-05-13 22:44 ` Huang, Kai
2024-05-14 22:41 ` Huang, Kai
2024-05-21 20:02 ` Sean Christopherson [this message]
2024-05-21 21:43 ` Huang, Kai
2024-05-21 23:16 ` Sean Christopherson
2024-04-25 23:39 ` [PATCH 2/4] KVM: x86: Register emergency virt callback in common code, via kvm_x86_ops Sean Christopherson
2024-04-26 8:52 ` Chao Gao
2024-04-26 17:08 ` Sean Christopherson
2024-05-13 12:55 ` Huang, Kai
2024-05-13 16:17 ` Sean Christopherson
2024-04-25 23:39 ` [PATCH 3/4] KVM: Register cpuhp and syscore callbacks when enabling hardware Sean Christopherson
2024-04-26 8:32 ` Chao Gao
2024-04-26 17:07 ` Sean Christopherson
2024-05-07 16:31 ` Sean Christopherson
2024-05-09 12:10 ` Huang, Kai
2024-05-13 12:56 ` Huang, Kai
2024-04-25 23:39 ` [PATCH 4/4] KVM: Rename functions related to enabling virtualization hardware Sean Christopherson
2024-05-13 12:59 ` Huang, Kai
2024-05-13 16:20 ` Sean Christopherson
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=Zkz97y9VVAFgqNJB@google.com \
--to=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.