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

[PATCH v7 3/6] Kconfig: Make cpu hotplug configurable


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • Date: Mon, 30 Mar 2026 11:59:51 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • 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=0xTyO2upwSLUp4nTUcsf626YB6NY7IhNhJBAKKSZkKc=; b=KFG3LU+rUONVXNued0k9UCdoiq2CIsT5qat1iiS5mPbdI1xhtZcuK9/x7xVKjrV/2QAPqr+6D+HZp2Bg7WuIjBe5mm6G1VjyGh0iJn4ZNOWWJOos/oMftQwlxy563GslH4s3qisi9iXl5l59JElihD1PDnRhAfZmIS5KUgw9S51ibW+dgPpkQVAqMeJVD2jLUv8kQkQemEIs3ltQpCsEe9c626GaomiyAxVawzMQVCq6u2kf2Ou1CRkq4DaP8FAtNQAhxlfc89/FSy9YgyLV9Z7ChzXxU4E3VweqQUWR0Jy9b1/cRerIE+mOlFnmKhfASxaexkTIsDX1EQn0UypfNw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AM50aZ4ISwxkt5YJBE1FQ86cgijEhTNV3pJgK42CHERX9trvYaFyIVHi/4SbO98/KYLIkCrTjmdBvPfWKQxDYX6cbJCqJXZ2Mtyd5L8pGp3B/vQMh50BMu/y7pDEOhovVPmZ9gAqRpjA7+jfT7EhDBqiKxyFUtArXofrZ+xsR6ozRh5qZ8+0R4DMgWC2uBU0BS7v7jEFChV7D1WQ1qvxvJ2BwLQqBaB4DcndJEjDPEPc4Rzpk20/1oQrKUxMkXU3nbIkOInKP/QDxTQ9zjVsQU1VXsMXYm9D7v1Z9yE4QN4TTH1i3hs0u7A9aIMKynpYoseNp2iTm2VGiVMVCx4bTQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 30 Mar 2026 11:59:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHcwDy29LsBHsG5wEG6AuodBSMA4Q==
  • Thread-topic: [PATCH v7 3/6] Kconfig: Make cpu hotplug configurable

For the purposes of certification, we want as little code as possible to
be unconditionally compiled in. Make CPU hotplug and SMT operations
configurable to ease the process. This will also help with introducing
CPU hotplug on Arm, where it needs to be configurable.

Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
---
v6->v7:
* new patch
---
 xen/arch/x86/platform_hypercall.c | 12 ++++++++++++
 xen/arch/x86/smp.c                |  3 +++
 xen/arch/x86/sysctl.c             | 11 +++++++++++
 xen/common/Kconfig                |  8 ++++++++
 4 files changed, 34 insertions(+)

diff --git a/xen/arch/x86/platform_hypercall.c 
b/xen/arch/x86/platform_hypercall.c
index cd4f0ae5e5..e745151790 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -735,6 +735,12 @@ ret_t do_platform_op(
     {
         int cpu = op->u.cpu_ol.cpuid;
 
+        if ( !IS_ENABLED(CONFIG_CPU_HOTPLUG) )
+        {
+            ret = -EOPNOTSUPP;
+            break;
+        }
+
         ret = xsm_resource_plug_core(XSM_HOOK);
         if ( ret )
             break;
@@ -761,6 +767,12 @@ ret_t do_platform_op(
     {
         int cpu = op->u.cpu_ol.cpuid;
 
+        if ( !IS_ENABLED(CONFIG_CPU_HOTPLUG) )
+        {
+            ret = -EOPNOTSUPP;
+            break;
+        }
+
         ret = xsm_resource_unplug_core(XSM_HOOK);
         if ( ret )
             break;
diff --git a/xen/arch/x86/smp.c b/xen/arch/x86/smp.c
index 7936294f5f..a49505fb57 100644
--- a/xen/arch/x86/smp.c
+++ b/xen/arch/x86/smp.c
@@ -418,6 +418,7 @@ void cf_check call_function_interrupt(void)
     smp_call_function_interrupt();
 }
 
+#ifdef CONFIG_CPU_HOTPLUG
 long cf_check cpu_up_helper(void *data)
 {
     unsigned int cpu = (unsigned long)data;
@@ -445,8 +446,10 @@ long cf_check cpu_down_helper(void *data)
 {
     int cpu = (unsigned long)data;
     int ret = cpu_down(cpu);
+
     /* Have one more go on EBUSY. */
     if ( ret == -EBUSY )
         ret = cpu_down(cpu);
     return ret;
 }
+#endif
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 1b04947516..bdad44fef1 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -53,6 +53,11 @@ static long cf_check smt_up_down_helper(void *data)
     unsigned int cpu, sibling_mask = boot_cpu_data.x86_num_siblings - 1;
     int ret = 0;
 
+    if ( !IS_ENABLED(CONFIG_CPU_HOTPLUG) )
+    {
+        ASSERT_UNREACHABLE();
+        return -EOPNOTSUPP;
+    }
     opt_smt = up;
 
     for_each_present_cpu ( cpu )
@@ -121,6 +126,12 @@ long arch_do_sysctl(
         long (*fn)(void *data);
         void *hcpu;
 
+        if ( !IS_ENABLED(CONFIG_CPU_HOTPLUG) )
+        {
+            ret = -EOPNOTSUPP;
+            break;
+        }
+
         switch ( op )
         {
         case XEN_SYSCTL_CPU_HOTPLUG_ONLINE:
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index d7e79e752a..0e5b4738a8 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -637,6 +637,14 @@ config SYSTEM_SUSPEND
 
          If unsure, say N.
 
+config CPU_HOTPLUG
+       bool "CPU online/offline support"
+       depends on X86
+       default y
+       help
+         Enable support for bringing CPUs online and offline at runtime. On
+         X86 this is required for disabling SMT.
+
 menu "Supported hypercall interfaces"
        visible if EXPERT
 
-- 
2.51.2



 


Rackspace

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