From: Grygorii Strashko <grygorii_strashko@epam.com>
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.
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
---
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(+)
diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index aed799fcb9c2..d62492d2043c 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -79,5 +79,6 @@ config MEM_PAGING
config MEM_SHARING
bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED
+ depends on INTEL_VMX
endif
--
2.34.1
On 25.09.2025 21:56, Grygorii Strashko wrote: > From: Grygorii Strashko <grygorii_strashko@epam.com> > > 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. > > Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> You should have Cc-ed Tamas, for being the maintainer of mem-sharing. > --- a/xen/arch/x86/hvm/Kconfig > +++ b/xen/arch/x86/hvm/Kconfig > @@ -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
On 26.09.25 09:37, Jan Beulich wrote: > On 25.09.2025 21:56, Grygorii Strashko wrote: >> From: Grygorii Strashko <grygorii_strashko@epam.com> >> >> 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. >> >> Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com> > > Reviewed-by: Jan Beulich <jbeulich@suse.com> > > You should have Cc-ed Tamas, for being the maintainer of mem-sharing. Sorry, I relied on add_maintainers.pl script. > >> --- a/xen/arch/x86/hvm/Kconfig >> +++ b/xen/arch/x86/hvm/Kconfig >> @@ -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. 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. -- Best regards, -grygorii
© 2016 - 2025 Red Hat, Inc.