* [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs
@ 2024-11-18 17:20 Sean Christopherson
2024-11-18 17:20 ` [PATCH 1/2] KVM: x86: add back X86_LOCAL_APIC dependency Sean Christopherson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sean Christopherson @ 2024-11-18 17:20 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Arnd Bergmann
Fix two more bugs in the KVM_X86 Kconfig. The fix from Arnd resolves a
build failure, but practically speaking is a non-issue because the failure
only affects 32-bit !SMP builds that effectively disable the local APIC.
The second fix is far more urgent. It resolves a bug where KVM's Kconfig
doesn't correctly define KVM_X86, and will build kvm.ko as a module when
KVM=y if neither KVM_INTEL nor KVM_AMD is 'y', e.g. if KVM=y, KVM_INTEL,=m,
and KVM_AMD=m. I don't know if any distros use that combo, but it broke
our production kernel, so it's certainly possible that it broke other
setups too.
Arnd's fix was already posted, but I bundled it here to avoid a trivial
conflict and to ensure it doesn't get left behind.
Arnd Bergmann (1):
KVM: x86: add back X86_LOCAL_APIC dependency
Sean Christopherson (1):
KVM: x86: Break CONFIG_KVM_X86's direct dependency on KVM_INTEL ||
KVM_AMD
arch/x86/kvm/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
base-commit: adc218676eef25575469234709c2d87185ca223a
--
2.47.0.338.g60cca15819-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] KVM: x86: add back X86_LOCAL_APIC dependency
2024-11-18 17:20 [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs Sean Christopherson
@ 2024-11-18 17:20 ` Sean Christopherson
2024-11-18 17:20 ` [PATCH 2/2] KVM: x86: Break CONFIG_KVM_X86's direct dependency on KVM_INTEL || KVM_AMD Sean Christopherson
2024-11-20 0:35 ` [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2024-11-18 17:20 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Arnd Bergmann
From: Arnd Bergmann <arnd@arndb.de>
Enabling KVM now causes a build failure on x86-32 if X86_LOCAL_APIC
is disabled:
arch/x86/kvm/svm/svm.c: In function 'svm_emergency_disable_virtualization_cpu':
arch/x86/kvm/svm/svm.c:597:9: error: 'kvm_rebooting' undeclared (first use in this function); did you mean 'kvm_irq_routing'?
597 | kvm_rebooting = true;
| ^~~~~~~~~~~~~
| kvm_irq_routing
arch/x86/kvm/svm/svm.c:597:9: note: each undeclared identifier is reported only once for each function it appears in
make[6]: *** [scripts/Makefile.build:221: arch/x86/kvm/svm/svm.o] Error 1
In file included from include/linux/rculist.h:11,
from include/linux/hashtable.h:14,
from arch/x86/kvm/svm/avic.c:18:
arch/x86/kvm/svm/avic.c: In function 'avic_pi_update_irte':
arch/x86/kvm/svm/avic.c:909:38: error: 'struct kvm' has no member named 'irq_routing'
909 | irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
| ^~
include/linux/rcupdate.h:538:17: note: in definition of macro '__rcu_dereference_check'
538 | typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
Move the dependency to the same place as before.
Fixes: ea4290d77bda ("KVM: x86: leave kvm.ko out of the build if no vendor module is requested")
Cc: stable@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410060426.e9Xsnkvi-lkp@intel.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Sean Christopherson <seanjc@google.com>
[sean: add Cc to stable, tweak shortlog scope]
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index f09f13c01c6b..887df30297f3 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -19,7 +19,6 @@ if VIRTUALIZATION
config KVM_X86
def_tristate KVM if KVM_INTEL || KVM_AMD
- depends on X86_LOCAL_APIC
select KVM_COMMON
select KVM_GENERIC_MMU_NOTIFIER
select HAVE_KVM_IRQCHIP
@@ -49,6 +48,7 @@ config KVM_X86
config KVM
tristate "Kernel-based Virtual Machine (KVM) support"
+ depends on X86_LOCAL_APIC
help
Support hosting fully virtualized guest machines using hardware
virtualization extensions. You will need a fairly recent
--
2.47.0.338.g60cca15819-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] KVM: x86: Break CONFIG_KVM_X86's direct dependency on KVM_INTEL || KVM_AMD
2024-11-18 17:20 [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs Sean Christopherson
2024-11-18 17:20 ` [PATCH 1/2] KVM: x86: add back X86_LOCAL_APIC dependency Sean Christopherson
@ 2024-11-18 17:20 ` Sean Christopherson
2024-11-20 0:35 ` [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2024-11-18 17:20 UTC (permalink / raw)
To: Sean Christopherson, Paolo Bonzini; +Cc: kvm, linux-kernel, Arnd Bergmann
Rework CONFIG_KVM_X86's dependency to only check if KVM_INTEL or KVM_AMD
is selected, i.e. not 'n'. Having KVM_X86 depend directly on the vendor
modules results in KVM_X86 being set to 'm' if at least one of KVM_INTEL
or KVM_AMD is enabled, but neither is 'y', regardless of the value of KVM
itself.
The documentation for def_tristate doesn't explicitly state that this is
the intended behavior, but it does clearly state that the "if" section is
parsed as a dependency, i.e. the behavior is consistent with how tristate
dependencies are handled in general.
Optionally dependencies for this default value can be added with "if".
Fixes: ea4290d77bda ("KVM: x86: leave kvm.ko out of the build if no vendor module is requested")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 887df30297f3..b91ec2e9c916 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -18,7 +18,7 @@ menuconfig VIRTUALIZATION
if VIRTUALIZATION
config KVM_X86
- def_tristate KVM if KVM_INTEL || KVM_AMD
+ def_tristate KVM if (KVM_INTEL != n || KVM_AMD != n)
select KVM_COMMON
select KVM_GENERIC_MMU_NOTIFIER
select HAVE_KVM_IRQCHIP
--
2.47.0.338.g60cca15819-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs
2024-11-18 17:20 [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs Sean Christopherson
2024-11-18 17:20 ` [PATCH 1/2] KVM: x86: add back X86_LOCAL_APIC dependency Sean Christopherson
2024-11-18 17:20 ` [PATCH 2/2] KVM: x86: Break CONFIG_KVM_X86's direct dependency on KVM_INTEL || KVM_AMD Sean Christopherson
@ 2024-11-20 0:35 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2024-11-20 0:35 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm, linux-kernel, Arnd Bergmann
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-20 0:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-18 17:20 [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs Sean Christopherson
2024-11-18 17:20 ` [PATCH 1/2] KVM: x86: add back X86_LOCAL_APIC dependency Sean Christopherson
2024-11-18 17:20 ` [PATCH 2/2] KVM: x86: Break CONFIG_KVM_X86's direct dependency on KVM_INTEL || KVM_AMD Sean Christopherson
2024-11-20 0:35 ` [PATCH 0/2] KVM: x86: Fix more KVM_X86 Kconfig bugs Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox