Skip to contentSkip to conversation

KVM: x86: only build common code if at least one vendor module was picked

PATCH In review Paolo Bonzini 3 participants 6 messages Oct 3, 2024 – Oct 5, 2024

Subsystems (3)
lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

cover KVM: x86: only build common code if at least one vendor module was picked

Linus reported a build regression when CONFIG_KVM={y,m} but CONFIG_KVM_INTEL and CONFIG_KVM_AMD are both n. If that happens, kvm.ko tries to call cpu_emergency_register_virt_callback() but that function does not exist due to a mismatch between KVM code and the common x86 files arch/x86/include/asm/reboot.h and arch/x86/kernel/reboot.c.

kvm.ko is nothing but library code shared by kvm-intel.ko and kvm-amd.ko. It provides no functionality on its own and it is unnecessary unless one of the vendor-specific module is compiled. In particular, /dev/kvm is not created until one of kvm-intel.ko or kvm-amd.ko is loaded.

It is still useful to have CONFIG_KVM, as it lets the user make kvm.ko built-in; but it is pointless to build it unless the user picked at least one vendor module.

Skipping the build of kvm.ko is already enough to fix the build regression. However, the second patch also adjust the reboot.[ch] files to test the Kconfig symbol that corresponds to arch/x86/kvm/x86.c, which is now CONFIG_KVM_X86_COMMON.

More cleanups are possible in arch/x86 in the other direction, making code depend on the specific vendor-specific module that needs it. For example, current_save_fsgs only has to be exported if IS_MODULE(CONFIG_KVM_INTEL). This is left for later.

Paolo

Paolo Bonzini (2):
KVM: x86: leave kvm.ko out of the build if no vendor module is
requested
x86/reboot: emergency callbacks are now registered by common KVM code

 arch/x86/include/asm/reboot.h | 4 ++--
 arch/x86/kernel/reboot.c      | 4 ++--
 arch/x86/kvm/Kconfig          | 7 +++++--
 arch/x86/kvm/Makefile         | 2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)
Signature · 1 line
2.43.5
author maintainer
#1 lore raw

PATCH 1/2 KVM: x86: leave kvm.ko out of the build if no vendor module is requested

kvm.ko is nothing but library code shared by kvm-intel.ko and kvm-amd.ko. It provides no functionality on its own and it is unnecessary unless one of the vendor-specific module is compiled. In particular, /dev/kvm is not created until one of kvm-intel.ko or kvm-amd.ko is loaded.

Use CONFIG_KVM to decide if it is built-in or a module, but use the vendor-specific modules for the actual decision on whether to build it.

This also fixes a build failure when CONFIG_KVM_INTEL and CONFIG_KVM_AMD are both disabled. The cpu_emergency_register_virt_callback() function is called from kvm.ko, but it is only defined if at least one of CONFIG_KVM_INTEL and CONFIG_KVM_AMD is provided.

Fixes 590b09b1d88e ("KVM: x86: Register "emergency disable" callbacks when virt is enabled")
---
 arch/x86/kvm/Kconfig  | 7 +++++--
 arch/x86/kvm/Makefile | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/kvm/Kconfig +5 -2
index 730c2f34d347..81bce9dd9331 100644
@@ -17,8 +17,8 @@ menuconfig VIRTUALIZATION
 
 if VIRTUALIZATION
 
-config KVM
-	tristate "Kernel-based Virtual Machine (KVM) support"
+config KVM_X86_COMMON
+	def_tristate KVM if KVM_INTEL || KVM_AMD
 	depends on X86_LOCAL_APIC
 	select KVM_COMMON
 	select KVM_GENERIC_MMU_NOTIFIER
@@ -45,6 +45,9 @@ config KVM
 	select KVM_GENERIC_HARDWARE_ENABLING
 	select KVM_GENERIC_PRE_FAULT_MEMORY
 	select KVM_WERROR if WERROR
+
+config KVM
+	tristate "Kernel-based Virtual Machine (KVM) support"
 	help
 	  Support hosting fully virtualized guest machines using hardware
 	  virtualization extensions.  You will need a fairly recent
arch/x86/kvm/Makefile +1 -1
index 5494669a055a..0d050cfaffb2 100644
@@ -32,7 +32,7 @@ kvm-intel-y		+= vmx/vmx_onhyperv.o vmx/hyperv_evmcs.o
 kvm-amd-y		+= svm/svm_onhyperv.o
 endif
 
-obj-$(CONFIG_KVM)	+= kvm.o
+obj-$(CONFIG_KVM_X86_COMMON)	+= kvm.o
 obj-$(CONFIG_KVM_INTEL)	+= kvm-intel.o
 obj-$(CONFIG_KVM_AMD)	+= kvm-amd.o
 
Signature · 1 line
2.43.5
#2 lore raw

Re: [PATCH 1/2] KVM: x86: leave kvm.ko out of the build if no vendor module is requested

Quoted 25 lines · Paolo Bonzini

kvm.ko is nothing but library code shared by kvm-intel.ko and kvm-amd.ko. It provides no functionality on its own and it is unnecessary unless one of the vendor-specific module is compiled. In particular, /dev/kvm is not created until one of kvm-intel.ko or kvm-amd.ko is loaded.

Use CONFIG_KVM to decide if it is built-in or a module, but use the vendor-specific modules for the actual decision on whether to build it.

This also fixes a build failure when CONFIG_KVM_INTEL and CONFIG_KVM_AMD are both disabled. The cpu_emergency_register_virt_callback() function is called from kvm.ko, but it is only defined if at least one of CONFIG_KVM_INTEL and CONFIG_KVM_AMD is provided.

Fixes 590b09b1d88e ("KVM: x86: Register "emergency disable" callbacks when virt is enabled")
---
 arch/x86/kvm/Kconfig  | 7 +++++--
 arch/x86/kvm/Makefile | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/kvm/Kconfig +0 -0
index 730c2f34d347..81bce9dd9331 100644

arch/x86/kvm/Kconfig menuconfig VIRTUALIZATION · line 20

Quoted 6 lines
arch/x86/kvm/Kconfig +1 -2
@@ -17,8 +17,8 @@ menuconfig VIRTUALIZATION
 
 if VIRTUALIZATION
 
-config KVM
-	tristate "Kernel-based Virtual Machine (KVM) support"
+config KVM_X86_COMMON

Maybe just KVM_X86? I doubt anyone in KVM will care too much, and for the rest of the kernel, CONFIG_KVM_X86 is likely more intuitive than CONFIG_KVM_X86_COMMON.

#3 lore raw

Re: [PATCH 1/2] KVM: x86: leave kvm.ko out of the build if no vendor module is requested

In reply to Paolo Bonzini
kernel test robot noticed the following build warnings:

Hi Paolo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kvm/queue]
[also build test WARNING on linus/master v6.12-rc1 next-20241004] [cannot apply to kvm/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paolo-Bonzini/KVM-x86-leave-kvm-ko-out-of-the-build-if-no-vendor-module-is-requested/20241004-071034
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link:    https://lore.kernel.org/r/20241003230806.229001-2-pbonzini%40redhat.com
patch subject: [PATCH 1/2] KVM: x86: leave kvm.ko out of the build if no vendor module is requested
config: x86_64-kismet-CONFIG_KVM_GENERIC_MEMORY_ATTRIBUTES-CONFIG_KVM_GENERIC_PRIVATE_MEM-0-0 (https://download.01.org/0day-ci/archive/20241005/[email protected]/config)
reproduce: (https://download.01.org/0day-ci/archive/20241005/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

kismet warnings: (new ones prefixed by >>)

>> kismet: WARNING: unmet direct dependencies detected for KVM_GENERIC_MEMORY_ATTRIBUTES when selected by KVM_GENERIC_PRIVATE_MEM

WARNING: unmet direct dependencies detected for KVM_GENERIC_MEMORY_ATTRIBUTES
Depends on [n]: KVM_GENERIC_MMU_NOTIFIER [=n]
Selected by [y]:
- KVM_GENERIC_PRIVATE_MEM [=y]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#4 lore raw

Re: [PATCH 1/2] KVM: x86: leave kvm.ko out of the build if no vendor module is requested

In reply to Paolo Bonzini
kernel test robot noticed the following build errors:

Hi Paolo,

kernel test robot noticed the following build errors:

[auto build test ERROR on kvm/queue]
[also build test ERROR on linus/master v6.12-rc1 next-20241004] [cannot apply to kvm/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Paolo-Bonzini/KVM-x86-leave-kvm-ko-out-of-the-build-if-no-vendor-module-is-requested/20241004-071034
base:   https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue
patch link:    https://lore.kernel.org/r/20241003230806.229001-2-pbonzini%40redhat.com
patch subject: [PATCH 1/2] KVM: x86: leave kvm.ko out of the build if no vendor module is requested
config: i386-randconfig-r052-20241006 (https://download.01.org/0day-ci/archive/20241006/[email protected]/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241006/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> arch/x86/kvm/vmx/vmx.c:759:2: error: use of undeclared identifier 'kvm_rebooting'
     759 |         kvm_rebooting = true;
         |         ^
>> arch/x86/kvm/vmx/vmx.c:5903:7: error: call to undeclared function '__xfer_to_guest_mode_work_pending'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    5903 |                 if (__xfer_to_guest_mode_work_pending())
         |                     ^
>> arch/x86/kvm/vmx/vmx.c:6822:17: error: no member named 'mmu_invalidate_seq' in 'struct kvm'
    6822 |         mmu_seq = kvm->mmu_invalidate_seq;
         |                   ~~~  ^
>> arch/x86/kvm/vmx/vmx.c:6835:6: error: call to undeclared function 'mmu_invalidate_retry_gfn'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    6835 |         if (mmu_invalidate_retry_gfn(kvm, mmu_seq, gfn)) {
         |             ^
   4 errors generated.
--
>> arch/x86/kvm/vmx/posted_intr.c:178:3: error: call to undeclared function '__apic_send_IPI_self'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     178 |                 __apic_send_IPI_self(POSTED_INTR_WAKEUP_VECTOR);
         |                 ^
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:10: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                 ^
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:31: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                      ^
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |                     ^
   include/asm-generic/rwonce.h:44:65: note: expanded from macro '__READ_ONCE'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                  ^
   include/linux/compiler_types.h:466:13: note: expanded from macro '__unqual_scalar_typeof'
     466 |                 _Generic((x),                                           \
         |                           ^
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |                     ^
   include/asm-generic/rwonce.h:44:65: note: expanded from macro '__READ_ONCE'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                  ^
   include/linux/compiler_types.h:473:15: note: expanded from macro '__unqual_scalar_typeof'
     473 |                          default: (x)))
         |                                    ^
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |                     ^
   include/asm-generic/rwonce.h:44:72: note: expanded from macro '__READ_ONCE'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                         ^
>> arch/x86/kvm/vmx/posted_intr.c:286:33: error: no member named 'irq_routing' in 'struct kvm'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:530:12: note: expanded from macro '__rcu_dereference_check'
     530 |         ((typeof(*p) __force __kernel *)(local)); \
         |                   ^
>> arch/x86/kvm/vmx/posted_intr.c:286:9: error: assigning to 'struct kvm_irq_routing_table *' from incompatible type 'void'
     286 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/vmx/posted_intr.c:287:25: error: incomplete definition of type 'struct kvm_irq_routing_table'
     287 |         if (guest_irq >= irq_rt->nr_rt_entries ||
         |                          ~~~~~~^
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/vmx/posted_intr.c:288:25: error: incomplete definition of type 'struct kvm_irq_routing_table'
     288 |             hlist_empty(&irq_rt->map[guest_irq])) {
         |                          ~~~~~~^
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/vmx/posted_intr.c:290:26: error: incomplete definition of type 'struct kvm_irq_routing_table'
     290 |                              guest_irq, irq_rt->nr_rt_entries);
         |                                         ~~~~~~^
   include/linux/printk.h:623:42: note: expanded from macro 'pr_warn_once'
     623 |         printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
         |                                                 ^~~~~~~~~~~
   include/linux/printk.h:604:30: note: expanded from macro 'printk_once'
     604 |         DO_ONCE_LITE(printk, fmt, ##__VA_ARGS__)
         |                                     ^~~~~~~~~~~
   include/linux/once_lite.h:11:32: note: expanded from macro 'DO_ONCE_LITE'
      11 |         DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)
         |                                       ^~~~~~~~~~~
   include/linux/once_lite.h:31:9: note: expanded from macro 'DO_ONCE_LITE_IF'
      31 |                         func(__VA_ARGS__);                              \
         |                              ^~~~~~~~~~~
   include/linux/printk.h:465:60: note: expanded from macro 'printk'
     465 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                            ^~~~~~~~~~~
   include/linux/printk.h:437:19: note: expanded from macro 'printk_index_wrap'
     437 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/vmx/posted_intr.c:294:33: error: incomplete definition of type 'struct kvm_irq_routing_table'
     294 |         hlist_for_each_entry(e, &irq_rt->map[guest_irq], link) {
         |                                  ~~~~~~^
   include/linux/list.h:1163:31: note: expanded from macro 'hlist_for_each_entry'
    1163 |         for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
         |                                      ^~~~
   include/linux/list.h:1152:12: note: expanded from macro 'hlist_entry_safe'
    1152 |         ({ typeof(ptr) ____ptr = (ptr); \
         |                   ^~~
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/vmx/posted_intr.c:294:33: error: incomplete definition of type 'struct kvm_irq_routing_table'
     294 |         hlist_for_each_entry(e, &irq_rt->map[guest_irq], link) {
         |                                  ~~~~~~^
   include/linux/list.h:1163:31: note: expanded from macro 'hlist_for_each_entry'
    1163 |         for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
         |                                      ^~~~
   include/linux/list.h:1152:28: note: expanded from macro 'hlist_entry_safe'
    1152 |         ({ typeof(ptr) ____ptr = (ptr); \
         |                                   ^~~
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   18 errors generated.
--
>> arch/x86/kvm/svm/svm.c:597:2: error: use of undeclared identifier 'kvm_rebooting'
     597 |         kvm_rebooting = true;
         |         ^
   1 error generated.
--
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:10: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                 ^
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:31: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                      ^
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:510:22: note: expanded from macro 'compiletime_assert'
     510 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                             ^~~~~~~~~
   include/linux/compiler_types.h:498:23: note: expanded from macro '_compiletime_assert'
     498 |         __compiletime_assert(condition, msg, prefix, suffix)
         |                              ^~~~~~~~~
   include/linux/compiler_types.h:490:9: note: expanded from macro '__compiletime_assert'
     490 |                 if (!(condition))                                       \
         |                       ^~~~~~~~~
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |                     ^
   include/asm-generic/rwonce.h:44:65: note: expanded from macro '__READ_ONCE'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                  ^
   include/linux/compiler_types.h:466:13: note: expanded from macro '__unqual_scalar_typeof'
     466 |                 _Generic((x),                                           \
         |                           ^
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |                     ^
   include/asm-generic/rwonce.h:44:65: note: expanded from macro '__READ_ONCE'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                  ^
   include/linux/compiler_types.h:473:15: note: expanded from macro '__unqual_scalar_typeof'
     473 |                          default: (x)))
         |                                    ^
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:527:53: note: expanded from macro '__rcu_dereference_check'
     527 |         typeof(*p) *local = (typeof(*p) *__force)READ_ONCE(p); \
         |                                                            ^
   include/asm-generic/rwonce.h:50:14: note: expanded from macro 'READ_ONCE'
      50 |         __READ_ONCE(x);                                                 \
         |                     ^
   include/asm-generic/rwonce.h:44:72: note: expanded from macro '__READ_ONCE'
      44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                         ^
>> arch/x86/kvm/svm/avic.c:909:33: error: no member named 'irq_routing' in 'struct kvm'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                                   ~~~  ^
   include/linux/srcu.h:217:58: note: expanded from macro 'srcu_dereference'
     217 | #define srcu_dereference(p, ssp) srcu_dereference_check((p), (ssp), 0)
         |                                                          ^
   include/linux/srcu.h:204:27: note: expanded from macro 'srcu_dereference_check'
     204 |         __rcu_dereference_check((p), __UNIQUE_ID(rcu), \
         |                                  ^
   include/linux/rcupdate.h:530:12: note: expanded from macro '__rcu_dereference_check'
     530 |         ((typeof(*p) __force __kernel *)(local)); \
         |                   ^
>> arch/x86/kvm/svm/avic.c:909:9: error: assigning to 'struct kvm_irq_routing_table *' from incompatible type 'void'
     909 |         irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);
         |                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/x86/kvm/svm/avic.c:911:25: error: incomplete definition of type 'struct kvm_irq_routing_table'
     911 |         if (guest_irq >= irq_rt->nr_rt_entries ||
         |                          ~~~~~~^
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/svm/avic.c:912:22: error: incomplete definition of type 'struct kvm_irq_routing_table'
     912 |                 hlist_empty(&irq_rt->map[guest_irq])) {
         |                              ~~~~~~^
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/svm/avic.c:914:26: error: incomplete definition of type 'struct kvm_irq_routing_table'
     914 |                              guest_irq, irq_rt->nr_rt_entries);
         |                                         ~~~~~~^
   include/linux/printk.h:623:42: note: expanded from macro 'pr_warn_once'
     623 |         printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
         |                                                 ^~~~~~~~~~~
   include/linux/printk.h:604:30: note: expanded from macro 'printk_once'
     604 |         DO_ONCE_LITE(printk, fmt, ##__VA_ARGS__)
         |                                     ^~~~~~~~~~~
   include/linux/once_lite.h:11:32: note: expanded from macro 'DO_ONCE_LITE'
      11 |         DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__)
         |                                       ^~~~~~~~~~~
   include/linux/once_lite.h:31:9: note: expanded from macro 'DO_ONCE_LITE_IF'
      31 |                         func(__VA_ARGS__);                              \
         |                              ^~~~~~~~~~~
   include/linux/printk.h:465:60: note: expanded from macro 'printk'
     465 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
         |                                                            ^~~~~~~~~~~
   include/linux/printk.h:437:19: note: expanded from macro 'printk_index_wrap'
     437 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/svm/avic.c:918:33: error: incomplete definition of type 'struct kvm_irq_routing_table'
     918 |         hlist_for_each_entry(e, &irq_rt->map[guest_irq], link) {
         |                                  ~~~~~~^
   include/linux/list.h:1163:31: note: expanded from macro 'hlist_for_each_entry'
    1163 |         for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
         |                                      ^~~~
   include/linux/list.h:1152:12: note: expanded from macro 'hlist_entry_safe'
    1152 |         ({ typeof(ptr) ____ptr = (ptr); \
         |                   ^~~
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^
   arch/x86/kvm/svm/avic.c:918:33: error: incomplete definition of type 'struct kvm_irq_routing_table'
     918 |         hlist_for_each_entry(e, &irq_rt->map[guest_irq], link) {
         |                                  ~~~~~~^
   include/linux/list.h:1163:31: note: expanded from macro 'hlist_for_each_entry'
    1163 |         for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
         |                                      ^~~~
   include/linux/list.h:1152:28: note: expanded from macro 'hlist_entry_safe'
    1152 |         ({ typeof(ptr) ____ptr = (ptr); \
         |                                   ^~~
   include/linux/kvm_types.h:11:8: note: forward declaration of 'struct kvm_irq_routing_table'
      11 | struct kvm_irq_routing_table;
         |        ^

17 errors generated.

vim +/kvm_rebooting +759 arch/x86/kvm/vmx/vmx.c

22e420e127399f arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  753  
590b09b1d88e18 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2024-08-29  754  void vmx_emergency_disable_virtualization_cpu(void)
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  755  {
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  756  	int cpu = raw_smp_processor_id();
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  757  	struct loaded_vmcs *v;
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  758  
6ae44e012f4c35 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21 @759  	kvm_rebooting = true;
6ae44e012f4c35 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  760  
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  761  	/*
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  762  	 * Note, CR4.VMXE can be _cleared_ in NMI context, but it can only be
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  763  	 * set in task context.  If this races with VMX is disabled by an NMI,
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  764  	 * VMCLEAR and VMXOFF may #UD, but KVM will eat those faults due to
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  765  	 * kvm_rebooting set.
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  766  	 */
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  767  	if (!(__read_cr4() & X86_CR4_VMXE))
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  768  		return;
a788fbb763b500 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  769  
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  770  	list_for_each_entry(v, &per_cpu(loaded_vmcss_on_cpu, cpu),
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  771  			    loaded_vmcss_on_cpu_link)
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  772  		vmcs_clear(v->vmcs);
119b5cb4ffd016 arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  773  
22e420e127399f arch/x86/kvm/vmx/vmx.c Sean Christopherson 2023-07-21  774  	kvm_cpu_vmxoff();
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  775  }
8f536b7697a0d4 arch/x86/kvm/vmx.c     Zhang Yanfei        2012-12-06  776  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#5 lore raw

PATCH 2/2 x86/reboot: emergency callbacks are now registered by common KVM code

In reply to Paolo Bonzini

Guard them with CONFIG_KVM_X86_COMMON rather than the two vendor modules. In practice this has no functional change, because CONFIG_KVM_X86_COMMON is set if and only if at least one vendor-specific module is being built. However, it is cleaner to specify CONFIG_KVM_X86_COMMON for functions that are used in kvm.ko.

Fixes 590b09b1d88e ("KVM: x86: Register "emergency disable" callbacks when virt is enabled")
Fixes 6d55a94222db ("x86/reboot: Unconditionally define cpu_emergency_virt_cb typedef")
---
 arch/x86/include/asm/reboot.h | 4 ++--
 arch/x86/kernel/reboot.c      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/include/asm/reboot.h +2 -2
index d0ef2a678d66..7ec4c4d12277 100644
@@ -26,13 +26,13 @@ void __noreturn machine_real_restart(unsigned int type);
 #define MRR_APM		1
 
 typedef void (cpu_emergency_virt_cb)(void);
-#if IS_ENABLED(CONFIG_KVM_INTEL) || IS_ENABLED(CONFIG_KVM_AMD)
+#if IS_ENABLED(CONFIG_KVM_X86_COMMON)
 void cpu_emergency_register_virt_callback(cpu_emergency_virt_cb *callback);
 void cpu_emergency_unregister_virt_callback(cpu_emergency_virt_cb *callback);
 void cpu_emergency_disable_virtualization(void);
 #else
 static inline void cpu_emergency_disable_virtualization(void) {}
-#endif /* CONFIG_KVM_INTEL || CONFIG_KVM_AMD */
+#endif /* CONFIG_KVM_X86_COMMON */
 
 typedef void (*nmi_shootdown_cb)(int, struct pt_regs*);
 void nmi_shootdown_cpus(nmi_shootdown_cb callback);
arch/x86/kernel/reboot.c +2 -2
index 0e0a4cf6b5eb..0e3f9479ccc8 100644
@@ -530,7 +530,7 @@ static inline void kb_wait(void)
 
 static inline void nmi_shootdown_cpus_on_restart(void);
 
-#if IS_ENABLED(CONFIG_KVM_INTEL) || IS_ENABLED(CONFIG_KVM_AMD)
+#if IS_ENABLED(CONFIG_KVM_X86_COMMON)
 /* RCU-protected callback to disable virtualization prior to reboot. */
 static cpu_emergency_virt_cb __rcu *cpu_emergency_virt_callback;
 
@@ -600,7 +600,7 @@ static void emergency_reboot_disable_virtualization(void)
 }
 #else
 static void emergency_reboot_disable_virtualization(void) { }
-#endif /* CONFIG_KVM_INTEL || CONFIG_KVM_AMD */
+#endif /* CONFIG_KVM_X86_COMMON */
 
 void __attribute__((weak)) mach_reboot_fixups(void)
 {
Signature · 1 line
2.43.5