From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 574B8606A33E for ; Thu, 3 Dec 2026 00:04:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=F+XamAUl Received: from list by lists.xenproject.org with outflank-mailman.1511233.1703675 (Exim 4.92) (envelope-from ) id 1xYuIy-0004tZ-CF; Thu, 03 Dec 2026 00:04:08 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1511233.1703675; Thu, 03 Dec 2026 00:04:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xYuIy-0004tS-8v; Thu, 03 Dec 2026 00:04:08 +0000 Received: by outflank-mailman (input) for mailman id 1511233; Thu, 03 Dec 2026 00:04:07 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xYuIx-0004sp-6R for xen-devel@lists.xenproject.org; Thu, 03 Dec 2026 00:04:07 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xYuIw-00ADP1-JM for xen-devel@lists.xenproject.org; Thu, 03 Dec 2026 01:04:06 +0100 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6b10b1e2-bab6-0a2a0a5309dd-0a2a450b9c08-26 for ; Thu, 03 Dec 2026 01:04:06 +0100 Received: from [172.234.252.31] (helo=sea.source.kernel.org) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6b10b1f4-b7e8-0a2a450b0019-aceafc1f8afc-3 for ; Thu, 03 Dec 2026 01:04:06 +0100 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 964CF4248E; Thu, 3 Dec 2026 00:04:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F29C71F00896; Thu, 3 Dec 2026 00:04:02 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=k20260515 header.d=kernel.org header.i="@kernel.org" header.h="Date:From:To:cc:Subject:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796256244; bh=jvzl64wDzH+sm8pk/CmImqOyBlSPXzXZyi3+zC/R/00=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=F+XamAUlFe0DjrPPalwGS1e1bjl9JRaFa8Xkp565d3TljXsmbfJhTQ8NHAT/ueut5 uW69dju7tAvAOLUF8DvDVfBZHrKWGAdDOwLYkfHWl7e/DNzdkUxCDJ/I9fwKGmbgab SL0YKtbyNpyGG0TNYqurzpO6cn0BYVq7vf5wGH/6OHfP1DO+CcLniZxb11UZTfTCBQ pjDyGQAdKKUPS2gzZZjT4n2MjD4f2E/G53ndtktws9Cftkhtt7GG+zWTUb3H8fpU8R Gx0qnLy3aPv7bSgmYkyGMD1DjbTCDiu9peQtBcrXawjc0ECfx9Qc1m5bpVIGsyodBK gNQC/dB8e0rmg== Date: Wed, 2 Dec 2026 16:04:01 -0800 (PST) From: Stefano Stabellini To: Mykyta Poturai cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Stefano Stabellini , Volodymyr Babchuk Subject: Re: [PATCH v12 6/6] docs: Document CPU hotplug In-Reply-To: <85a23f25dc93b925c7b63a6d65e375907ba0c251.1795775931.git.mykyta_poturai@epam.com> Message-ID: <8af30ec6-8dda-8b4f-2e2a-7dbd14db9108@kernel.org> References: <85a23f25dc93b925c7b63a6d65e375907ba0c251.1795775931.git.mykyta_poturai@epam.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-purgate-ID: tlsNG-42698a/1796256246-2C39B9EA-71B0F54F/0/0 X-purgate-type: clean X-purgate-size: 4935 X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Fri, 27 Nov 2026, Mykyta Poturai wrote: > Signed-off-by: Mykyta Poturai > Reviewed-by: Volodymyr Babchuk Acked-by: Stefano Stabellini > --- > v11->v12: > * collect tags > > v10->v11: > * sync with latest changes > > v9->v10: > * explain the actual ITS incompatibility > * say FFA and TEE are incompatible, matching the Kconfig dependency > > v8->v9: > * no changes > > v7->v8: > * remove support status update > * update config option name > > v6->v7: > * add testing and limitations > > v5->v6: > * no changes > > v4->v5: > * s/supported/implemented/ > * update SUPPORT.md > > v3->v4: > * update configuration section > > v2->v3: > * patch introduced > --- > docs/misc/cpu-hotplug.txt | 102 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 102 insertions(+) > create mode 100644 docs/misc/cpu-hotplug.txt > > diff --git a/docs/misc/cpu-hotplug.txt b/docs/misc/cpu-hotplug.txt > new file mode 100644 > index 0000000000..e1b474ca69 > --- /dev/null > +++ b/docs/misc/cpu-hotplug.txt > @@ -0,0 +1,102 @@ > +CPU Hotplug > +=========== > + > +CPU hotplug is a feature that allows pCPU cores to be added to or removed from a > +running system without requiring a reboot. It is implemented on x86 and Arm64 > +architectures. > + > +Implementation Details > +---------------------- > + > +CPU hotplug is implemented through the `XEN_SYSCTL_CPU_HOTPLUG_*` sysctl calls. > +The specific calls are: > + > +- `XEN_SYSCTL_CPU_HOTPLUG_ONLINE`: Brings a pCPU online > +- `XEN_SYSCTL_CPU_HOTPLUG_OFFLINE`: Takes a pCPU offline > +- `XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE`: Enables SMT threads (x86 only) > +- `XEN_SYSCTL_CPU_HOTPLUG_SMT_DISABLE`: Disables SMT threads (x86 only) > + > +All cores can be disabled, assuming hardware support, except for the boot core. > +Sysctl calls are routed to the boot core before doing any actual up/down > +operations on other cores. > + > +If there are Xen-bound interrupts pinned to the pCPU being offlined, they will > +be automatically migrated to other online pCPUs. Interrupts used by guest > +domains are handled by the scheduler when it reschedules the vCPUs to a new, > +online, pCPU. When a pCPU is being onlined, some Xen-bound interrupts will get > +redistributed to the newly onlined pCPU to prevent imbalance. > + > +If pCPU being offlined has some vCPUs pinned to it, they will be automatically > +unpinned and migrated to other online pCPUs. > + > +Limitations > +----------- > + > +On Arm64 cpu hotplug is currently not compatible with the ITS: the per-CPU LPI > +pending table and GICR_CTLR.EnableLPIs are set up once at boot and are not > +re-usable, so onlining a pCPU a second time fails. > + > +On Arm64 it is also not compatible with the FFA and TEE mediators, as both use > +non-static IRQ actions. > + > +Configuration > +------------- > + > +CPU hotplug support in Xen is controlled by the CONFIG_CPU_ONLINE_OFFLINE > +Kconfig option, which requires EXPERT and depends on HAS_CPU_ONLINE_OFFLINE. > +HAS_CPU_ONLINE_OFFLINE is selected by x86, and by Arm64 when neither ITS nor > +TEE support is enabled. The option is enabled by default on x86 and disabled > +by default on Arm64. > + > +The xen-hptool userspace tool is built unconditionally. > + > +Usage > +----- > + > +Disable core: > + > +$ xen-hptool cpu-offline 2 > +Prepare to offline CPU 2 > +(XEN) Removing cpu 2 from runqueue 0 > +CPU 2 offlined successfully > + > +Enable core: > + > +$ xen-hptool cpu-online 2 > +Prepare to online CPU 2 > +(XEN) Bringing up CPU2 > +(XEN) GICv3: CPU2: Found redistributor in region 0 @00000a004005c000 > +(XEN) CPU2: Guest atomics will try 1 times before pausing the domain > +(XEN) CPU 2 booted. > +(XEN) Adding cpu 2 to runqueue 0 > +CPU 2 onlined successfully > + > +Disabling a core with pinned vCPUs: > + > +$ xl vcpu-pin 0 3 3 3 > +$ xl vcpu-pin 0 2 3 3 > +$ xl vcpu-pin 0 1 3 3 > +$ xl vcpu-pin 0 0 3 3 > +$ xen-hptool cpu-offline 3 > +Prepare to offline CPU 3 > +(XEN) Breaking affinity for d0v0 > +(XEN) Breaking affinity for d0v1 > +(XEN) Breaking affinity for d0v2 > +(XEN) Breaking affinity for d0v3 > +(XEN) Removing cpu 3 from runqueue 0 > +CPU 3 offlined successfully > + > +Testing > +------- > + > +The CPU hotplug feature has been tested on both x86 and Arm64 QEMU setups and on > +R-Car Gen5 (Arm64) hardware. > + > +The tests included: > +- Offlining and onlining cores with no pinned vCPUs > +- Offlining cores with pinned vCPUs > +- Offlining cores with Xen-bound interrupts > +- Offlining all cores except the boot core > +- Offlining the boot core (expected to fail) > +- Enabling and disabling SMT threads (x86 only) > +- Offlining cores to which guests with passthrough devices are pinned > -- > 2.56.1 >