[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 23/24] xen/domctl: wrap common/domctl.c with CONFIG_MGMT_HYPERCALLS


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Fri, 21 Nov 2025 18:58:00 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VGsKqP94ALXNQ4bxTHNd4P70wKk3fIYwcVEXDRmLYiU=; b=fxiYeParN6pKl2epNx+GwvRWi54ixznpOSrlD4B+RiuuCturhUgdaCX2SUvCWOhMihnGqVhTGsgI3iIfjBaAihzGyhvUsYe5qUEKfjPN2j0hwifNmDkhHEmOj/KHPoh7NoIbF+E+hktLNNKiWt3diILx53hxX7HrkIHnDcqea46tJvXwIutP8Qlkz9fSl91EzVorx7+8SjsynraaUm9z4tZ+WP7VF/nBM4gg1dhZxrE2g8OgPUxHgHkPVK8CJo+rqrH1SlCL0Dj4ciXPKIkoID/kyZwY8K8Sn+juqx0Gra9GCH7csLpKB5nUiW9M/Kul/9wWDkCwy29wNimnpD5ouw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WPXENksRSRExohJNkJTf8jM2l7XMkXmnh4dcViUZcv0lrt7C7YWvaDi9GppbM1t4jJ0l85PmL8C2v3gHowekTW3+q/FkvFhvF3S7B/uBahBGo5PdvhSV+sM2v8wASNt+MMIb7SjnRtVdTWqzxzbjUxC2xULOGOF9x5DvM37crs8Y/2CKo4rAPmAwwfWLx1lo0hd9TCI5yFfGTmVaJTMvJP64TgtSjX5cUCMLZhasib8nKSot3Z/GV3LW7/W42SXj5JxJl/mV2iQCztM24tPjjDRAUvKzZ7WnoKAR23TgDFigyV+eMc4qO/xMcCbI1/M8cgjaB4nwIjDmPbuCZUMHyw==
  • Cc: <ray.huang@xxxxxxx>, <grygorii_strashko@xxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Anthony PERARD" <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>
  • Delivery-date: Fri, 21 Nov 2025 11:01:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Wrap domctl hypercall def and domctl.o with CONFIG_MGMT_HYPERCALLS.
Make CONFIG_MGMT_HYPERCALLS optional and expand help message

Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx>
---
v1 -> v2:
- remove stub in common/domctl.c
- combine the original commit of "xen/domctl: provide stub for
 domctl_lock_{acquire,release}"
- adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS"
---
v2 -> v3:
- add pitfall warnning in Kconfig help
---
v3 -> v4:
- refine help message
---
 xen/common/Kconfig           | 14 ++++++++++----
 xen/common/Makefile          |  2 +-
 xen/include/hypercall-defs.c |  6 ++++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 973b8e26bd..5aecb88680 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -654,11 +654,17 @@ menu "Supported hypercall interfaces"
 config MGMT_HYPERCALLS
        bool "Enable privileged hypercalls for system management"
        depends on !PV_SHIM_EXCLUSIVE
-       def_bool y
        help
-         This option shall only be disabled on some dom0less systems, or
-         PV shim on x86, to reduce Xen footprint via managing unnessary
-         hypercalls, like sysctl, etc.
+         Management hypercalls provide the means for dom0 to manage the
+         overall Xen system and other domains, including sysctl, domctl, etc.
+         In a dom0less or pv-shim build, they can be omitted to cut down
+         on the Xen binary's size. However, this comes at the loss of
+         significant runtime functionality.
+         So be cautious to disable it, as admins will face missing a few basic
+         hypercalls like listdomains, getdomaininfo, etc, hence leading to
+         have an impact on device-passthrough and DM.
+
+         Unless you know what you are doing, you should enable this.
 
 endmenu
 
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 7c32fbd9f1..e0afc89591 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -71,7 +71,7 @@ obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz 
unlzma lzo unlzo un
 obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o memory.o multicall.o 
xlat.o)
 
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
-obj-y += domctl.o
+obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
 endif
 
 extra-y := symbols-dummy.o
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 38b21dccbd..5343fd7a6f 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -199,9 +199,11 @@ sysctl(xen_sysctl_t *u_sysctl)
 #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && 
!defined(CONFIG_PV_SHIM_EXCLUSIVE)
 paging_domctl_cont(xen_domctl_t *u_domctl)
 #endif
-#endif
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
 domctl(xen_domctl_t *u_domctl)
+#endif
+#endif
+#ifndef CONFIG_PV_SHIM_EXCLUSIVE
 platform_op(xen_platform_op_t *u_xenpf_op)
 #endif
 #ifdef CONFIG_HVM
@@ -279,10 +281,10 @@ hvm_op                             do       do       do   
    do       do
 #endif
 #ifdef CONFIG_MGMT_HYPERCALLS
 sysctl                             do       do       do       do       do
-#endif
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
 domctl                             do       do       do       do       do
 #endif
+#endif
 #ifdef CONFIG_KEXEC
 kexec_op                           compat   do       -        -        -
 #endif
-- 
2.34.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.