Skip to contentSkip to conversation

x86/hvm: mem_sharing: add dependency from CONFIG_INTEL_VMX

PATCH In review Grygorii Strashko 2 participants 3 messages Sep 25, 2025 – Sep 26, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hvm: mem_sharing: add dependency from CONFIG_INTEL_VMX

From: Grygorii Strashko <[email protected]>

According to the commit b66e28226dd9 ("x86/mem_sharing: gate enabling on cpu_has_vmx") the Xen memory sharing support is only possible on platforms with "Intel VT-x" (INTEL_VMX=y) enabled.
The same commit is also added runtime check for "cpu_has_vmx" in mem_sharing_control() which blocks access to XENMEM_sharing_ops if !cpu_has_vmx.

Hence add dependency from INTEL_VMX for MEM_SHARING Kconfig option.

---
It has took me a time (including digging deep in git history) to understand presence of this dependency, so this patch. Hope it helps other people and they will not need waste their time digging.

 xen/arch/x86/hvm/Kconfig | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/hvm/Kconfig +1 -0
index aed799fcb9c2..d62492d2043c 100644
@@ -79,5 +79,6 @@ config MEM_PAGING
 
 config MEM_SHARING
 	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
+	depends on INTEL_VMX
 
 endif
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Grygorii Strashko

From: Grygorii Strashko <[email protected]>

According to the commit b66e28226dd9 ("x86/mem_sharing: gate enabling on cpu_has_vmx") the Xen memory sharing support is only possible on platforms with "Intel VT-x" (INTEL_VMX=y) enabled.
The same commit is also added runtime check for "cpu_has_vmx" in mem_sharing_control() which blocks access to XENMEM_sharing_ops if !cpu_has_vmx.

Quoted 3 lines

Hence add dependency from INTEL_VMX for MEM_SHARING Kconfig option.

You should have Cc-ed Tamas, for being the maintainer of mem-sharing.

xen/arch/x86/hvm/Kconfig config MEM_PAGING · line 84

Quoted 9 lines
xen/arch/x86/hvm/Kconfig +1 -0
@@ -79,5 +79,6 @@ config MEM_PAGING
 
 config MEM_SHARING
 	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
+	depends on INTEL_VMX
 
 endif

Wouldn't this want accompanying by replacing the cpu_has_vmx in mem_sharing_control() with using_vmx()? The gain in this case may not be very high, but it would serve a doc purpose.

Jan

#2 lore raw
Quoted 10 lines · Jan Beulich
Quoted 9 lines · Grygorii Strashko

From: Grygorii Strashko <[email protected]>

According to the commit b66e28226dd9 ("x86/mem_sharing: gate enabling on cpu_has_vmx") the Xen memory sharing support is only possible on platforms with "Intel VT-x" (INTEL_VMX=y) enabled.
The same commit is also added runtime check for "cpu_has_vmx" in mem_sharing_control() which blocks access to XENMEM_sharing_ops if !cpu_has_vmx.

Quoted 7 lines
Quoted 3 lines

Hence add dependency from INTEL_VMX for MEM_SHARING Kconfig option.

You should have Cc-ed Tamas, for being the maintainer of mem-sharing.

Sorry, I relied on add_maintainers.pl script.

Quoted 9 lines
Quoted 9 lines
xen/arch/x86/hvm/Kconfig +1 -0
@@ -79,5 +79,6 @@ config MEM_PAGING
 
  config MEM_SHARING
  	bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
+	depends on INTEL_VMX
 
Quoted 5 lines

xen/arch/x86/hvm/Kconfig config MEM_PAGING · line 84

Quoted 1 line
xen/arch/x86/hvm/Kconfig +0 -0
  endif

Wouldn't this want accompanying by replacing the cpu_has_vmx in mem_sharing_control() with using_vmx()? The gain in this case may not be very high, but it would serve a doc purpose.

There are no benefits. if !INTEL_VMX the whole module will excluded from build, if INTEL_VMX - it will end up calling "cpu_has_vmx".

What, potentially, might make sense is to move mem sharing code to HVM x86/mm/mem_sharing.c -> x86/x86/hvm/mm/mem_sharing.c

As it is strictly HVM specific. Just is potential TODO item.

Signature · 2 lines
Best regards,
-grygorii