* [PATCH 0/1] x86/topology: Fix regression limiting Xen PV DomU CPUs to 1
@ 2025-04-05 18:16 Petr Vaněk
2025-04-05 18:16 ` [PATCH 1/1] x86/cpu/topology: Don't limit CPUs to 1 for Xen PV guests due to disabled APIC Petr Vaněk
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vaněk @ 2025-04-05 18:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Thomas Gleixner, x86, xen-devel, Petr Vaněk
Hi,
I have discovered a regression in recent kernels that causes Xen PV DomU
guests to be limited to a single vCPU, despite multiple vCPUs being
configured. This issue does no occur in version 6.6.
After bisecting, I identified the regression was introduce in kernel 6.9
in a commit that limits the number of possible CPUs to 1 when APIC is
disabled [1]. However, Xen PV guests always disable APIC, leading to
incorrect CPU limitation.
Following patch resolves this issue by skipping apic_is_disabled check
for Xen PV guests.
I believe it makes sense to backport this fix to stable versions, so I'm
Ccing stable@vger.kernel.org (as per [2]). Note that there is a minor
conflict in both applicable versions (6.12 and 6.13). Please, let me
know if a different approach would be preferred.
[1] https://lore.kernel.org/r/20240213210252.290098853@linutronix.de
[2] https://docs.kernel.org/process/stable-kernel-rules.html#option-1
Thanks,
Petr
Petr Vaněk (1):
x86/cpu/topology: Don't limit CPUs to 1 for Xen PV guests due to
disabled APIC
arch/x86/kernel/cpu/topology.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--
2.48.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/1] x86/cpu/topology: Don't limit CPUs to 1 for Xen PV guests due to disabled APIC
2025-04-05 18:16 [PATCH 0/1] x86/topology: Fix regression limiting Xen PV DomU CPUs to 1 Petr Vaněk
@ 2025-04-05 18:16 ` Petr Vaněk
2025-04-06 10:08 ` Thomas Gleixner
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vaněk @ 2025-04-05 18:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Thomas Gleixner, x86, xen-devel, Petr Vaněk, stable
Xen PV guests in DomU have APIC disabled by design, which causes
topology_apply_cmdline_limits_early() to limit the number of possible
CPUs to 1, regardless of the configured number of vCPUs.
This is a regression introduced in version 6.9 in commit 7c0edad3643f
("x86/cpu/topology: Rework possible CPU management") which added an
early check that limits CPUs if apic_is_disabled, without accounting for
the fact that Xen PV guests always disable APIC even when SMP is
supported.
This patch fixes the issue by skipping the apic_is_disabled check for
Xen PV guests, allowing them to boot with the full set of configured vCPUs.
Fixes: 7c0edad3643f ("x86/cpu/topology: Rework possible CPU management")
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Cc: xen-devel@lists.xenproject.org
Cc: stable@vger.kernel.org # 6.9+
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
---
arch/x86/kernel/cpu/topology.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c
index 01456236a6dd..10aa7f471ec9 100644
--- a/arch/x86/kernel/cpu/topology.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -428,8 +428,13 @@ void __init topology_apply_cmdline_limits_early(void)
{
unsigned int possible = nr_cpu_ids;
- /* 'maxcpus=0' 'nosmp' 'nolapic' */
- if (!setup_max_cpus || apic_is_disabled)
+ /* 'maxcpus=0' 'nosmp' 'nolapic'
+ *
+ * The apic_is_disabled check is ignored for Xen PV domains because Xen
+ * disables ACPI in unprivileged PV DomU guests, which would otherwise limit
+ * CPUs to 1, even if multiple vCPUs were configured.
+ */
+ if (!setup_max_cpus || (!xen_pv_domain() && apic_is_disabled))
possible = 1;
/* 'possible_cpus=N' */
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] x86/cpu/topology: Don't limit CPUs to 1 for Xen PV guests due to disabled APIC
2025-04-05 18:16 ` [PATCH 1/1] x86/cpu/topology: Don't limit CPUs to 1 for Xen PV guests due to disabled APIC Petr Vaněk
@ 2025-04-06 10:08 ` Thomas Gleixner
2025-04-07 13:24 ` Petr Vaněk
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Gleixner @ 2025-04-06 10:08 UTC (permalink / raw)
To: Petr Vaněk, linux-kernel
Cc: x86, xen-devel, Petr Vaněk, stable, Juergen Gross,
Andrew Cooper
On Sat, Apr 05 2025 at 20:16, Petr Vaněk wrote:
> Xen PV guests in DomU have APIC disabled by design, which causes
> topology_apply_cmdline_limits_early() to limit the number of possible
> CPUs to 1, regardless of the configured number of vCPUs.
PV guests have a APIC emulation and there is no code which actually
disables the APIC by design unconditionally. There is one way though,
which disables the APIC indirectly.
xen_arch_setup() disables ACPI, which in turn causes acpi_mps_check() to
return 1, which disables the APIC. This only happens when the kernel
configuration has:
CONFIG_X86_MPPARSE=n
CONFIG_ACPI=y
If you enable MPPARSE the problem goes away, no?
> + /* 'maxcpus=0' 'nosmp' 'nolapic'
> + *
> + * The apic_is_disabled check is ignored for Xen PV domains because Xen
> + * disables ACPI in unprivileged PV DomU guests, which would otherwise limit
> + * CPUs to 1, even if multiple vCPUs were configured.
This is the wrong place as it invalidates the effect of 'nolapic' on the
kernel command line for XEN PV.
You actually explain in the comment that XEN disables ACPI, so why are
you slapping this xen check into this code instead of doing the obvious
and prevent acpi_mps_check() to cause havoc?
Thanks,
tglx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] x86/cpu/topology: Don't limit CPUs to 1 for Xen PV guests due to disabled APIC
2025-04-06 10:08 ` Thomas Gleixner
@ 2025-04-07 13:24 ` Petr Vaněk
2025-04-07 13:24 ` [PATCH v2 1/1] x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI Petr Vaněk
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vaněk @ 2025-04-07 13:24 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Andrew Cooper, arkamar, Juergen Gross, linux-kernel, stable, x86,
xen-devel, linux-acpi
On Sun, Apr 06, 2025 at 12:08:29PM +0200, Thomas Gleixner wrote:
> On Sat, Apr 05 2025 at 20:16, Petr Vaněk wrote:
>
> > Xen PV guests in DomU have APIC disabled by design, which causes
> > topology_apply_cmdline_limits_early() to limit the number of possible
> > CPUs to 1, regardless of the configured number of vCPUs.
>
> PV guests have a APIC emulation and there is no code which actually
> disables the APIC by design unconditionally. There is one way though,
> which disables the APIC indirectly.
It seems I have got a bit lost in APIC/ACPI abbreviations. Sorry.
> xen_arch_setup() disables ACPI, which in turn causes acpi_mps_check() to
> return 1, which disables the APIC. This only happens when the kernel
> configuration has:
>
> CONFIG_X86_MPPARSE=n
> CONFIG_ACPI=y
>
> If you enable MPPARSE the problem goes away, no?
Yes, it goes away.
> > + /* 'maxcpus=0' 'nosmp' 'nolapic'
> > + *
> > + * The apic_is_disabled check is ignored for Xen PV domains because Xen
> > + * disables ACPI in unprivileged PV DomU guests, which would otherwise limit
> > + * CPUs to 1, even if multiple vCPUs were configured.
>
> This is the wrong place as it invalidates the effect of 'nolapic' on the
> kernel command line for XEN PV.
>
> You actually explain in the comment that XEN disables ACPI, so why are
> you slapping this xen check into this code instead of doing the obvious
> and prevent acpi_mps_check() to cause havoc?
Thank you for your explanation and suggestion. I will correct acpi_mps_check()
in following patch.
Thanks,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/1] x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
2025-04-07 13:24 ` Petr Vaněk
@ 2025-04-07 13:24 ` Petr Vaněk
2025-04-07 14:44 ` [tip: x86/urgent] " tip-bot2 for Petr Vaněk
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vaněk @ 2025-04-07 13:24 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Andrew Cooper, arkamar, Juergen Gross, linux-kernel, stable, x86,
xen-devel, linux-acpi
Xen disables ACPI for PV guests in DomU, which causes acpi_mps_check()
to return 1 when CONFIG_X86_MPPARSE is not set. As a result, APIC is
disabled and the guest is later limited to a single vCPU, despite being
configured with more.
This regression was introduced in version 6.9 in commit 7c0edad3643f
("x86/cpu/topology: Rework possible CPU management"), which added an
early check that limits CPUs to 1 if apic_is_disabled.
This patch updates acpi_mps_check() logic to return 0 early when running
as a Xen PV guest in DomU, preventing APIC from being disabled in this
specific case and restoring correct multi-vCPU behaviour.
Fixes: 7c0edad3643f ("x86/cpu/topology: Rework possible CPU management")
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Cc: xen-devel@lists.xenproject.org
Cc: stable@vger.kernel.org # 6.9+
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
---
arch/x86/kernel/acpi/boot.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index dae6a73be40e..9fa321a95eb3 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -23,6 +23,8 @@
#include <linux/serial_core.h>
#include <linux/pgtable.h>
+#include <xen/xen.h>
+
#include <asm/e820/api.h>
#include <asm/irqdomain.h>
#include <asm/pci_x86.h>
@@ -1729,6 +1731,15 @@ int __init acpi_mps_check(void)
{
#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
/* mptable code is not built-in*/
+
+ /*
+ * Xen disables ACPI in PV DomU guests but it still emulates APIC and
+ * supports SMP. Returning early here ensures that APIC is not disabled
+ * unnecessarily and the guest is not limited to a single vCPU.
+ */
+ if (xen_pv_domain() && !xen_initial_domain())
+ return 0;
+
if (acpi_disabled || acpi_noirq) {
pr_warn("MPS support code is not built-in, using acpi=off or acpi=noirq or pci=noacpi may have problem\n");
return 1;
--
2.48.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [tip: x86/urgent] x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
2025-04-07 13:24 ` [PATCH v2 1/1] x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI Petr Vaněk
@ 2025-04-07 14:44 ` tip-bot2 for Petr Vaněk
2025-04-08 6:19 ` Petr Vaněk
0 siblings, 1 reply; 8+ messages in thread
From: tip-bot2 for Petr Vaněk @ 2025-04-07 14:44 UTC (permalink / raw)
To: linux-tip-commits; +Cc: arkamar, Thomas Gleixner, x86, linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 8b37357a78d7fa13d88ea822b35b40137da1c85e
Gitweb: https://git.kernel.org/tip/8b37357a78d7fa13d88ea822b35b40137da1c85e
Author: Petr Vaněk <arkamar@atlas.cz>
AuthorDate: Mon, 07 Apr 2025 15:24:27 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 07 Apr 2025 16:35:21 +02:00
x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
Xen disables ACPI for PV guests in DomU, which causes acpi_mps_check() to
return 1 when CONFIG_X86_MPPARSE is not set. As a result, the local APIC is
disabled and the guest is later limited to a single vCPU, despite being
configured with more.
This regression was introduced in version 6.9 in commit 7c0edad3643f
("x86/cpu/topology: Rework possible CPU management"), which added an
early check that limits CPUs to 1 if apic_is_disabled.
Update the acpi_mps_check() logic to return 0 early when running as a Xen
PV guest in DomU, preventing APIC from being disabled in this specific case
and restoring correct multi-vCPU behaviour.
Fixes: 7c0edad3643f ("x86/cpu/topology: Rework possible CPU management")
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250407132445.6732-2-arkamar@atlas.cz
---
arch/x86/kernel/acpi/boot.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index dae6a73..9fa321a 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -23,6 +23,8 @@
#include <linux/serial_core.h>
#include <linux/pgtable.h>
+#include <xen/xen.h>
+
#include <asm/e820/api.h>
#include <asm/irqdomain.h>
#include <asm/pci_x86.h>
@@ -1729,6 +1731,15 @@ int __init acpi_mps_check(void)
{
#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_X86_MPPARSE)
/* mptable code is not built-in*/
+
+ /*
+ * Xen disables ACPI in PV DomU guests but it still emulates APIC and
+ * supports SMP. Returning early here ensures that APIC is not disabled
+ * unnecessarily and the guest is not limited to a single vCPU.
+ */
+ if (xen_pv_domain() && !xen_initial_domain())
+ return 0;
+
if (acpi_disabled || acpi_noirq) {
pr_warn("MPS support code is not built-in, using acpi=off or acpi=noirq or pci=noacpi may have problem\n");
return 1;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [tip: x86/urgent] x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
2025-04-07 14:44 ` [tip: x86/urgent] " tip-bot2 for Petr Vaněk
@ 2025-04-08 6:19 ` Petr Vaněk
2025-04-08 8:50 ` Thomas Gleixner
0 siblings, 1 reply; 8+ messages in thread
From: Petr Vaněk @ 2025-04-08 6:19 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: x86, linux-kernel
On Mon, Apr 07, 2025 at 02:44:29PM -0000, tip-bot2 for Petr Vaněk wrote:
> The following commit has been merged into the x86/urgent branch of tip:
>
> Commit-ID: 8b37357a78d7fa13d88ea822b35b40137da1c85e
> Gitweb: https://git.kernel.org/tip/8b37357a78d7fa13d88ea822b35b40137da1c85e
> Author: Petr Vaněk <arkamar@atlas.cz>
> AuthorDate: Mon, 07 Apr 2025 15:24:27 +02:00
> Committer: Thomas Gleixner <tglx@linutronix.de>
> CommitterDate: Mon, 07 Apr 2025 16:35:21 +02:00
>
> x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
Thank you for accepting the patch.
Out of curiosity, why did you remove the Cc: stable@vger.kernel.org
trailer? I thought it should be backported as it is a regression.
Thanks,
Petr
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [tip: x86/urgent] x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
2025-04-08 6:19 ` Petr Vaněk
@ 2025-04-08 8:50 ` Thomas Gleixner
0 siblings, 0 replies; 8+ messages in thread
From: Thomas Gleixner @ 2025-04-08 8:50 UTC (permalink / raw)
To: Petr Vaněk; +Cc: x86, linux-kernel
On Tue, Apr 08 2025 at 08:19, Petr Vaněk wrote:
> On Mon, Apr 07, 2025 at 02:44:29PM -0000, tip-bot2 for Petr Vaněk wrote:
>> The following commit has been merged into the x86/urgent branch of tip:
>>
>> Commit-ID: 8b37357a78d7fa13d88ea822b35b40137da1c85e
>> Gitweb: https://git.kernel.org/tip/8b37357a78d7fa13d88ea822b35b40137da1c85e
>> Author: Petr Vaněk <arkamar@atlas.cz>
>> AuthorDate: Mon, 07 Apr 2025 15:24:27 +02:00
>> Committer: Thomas Gleixner <tglx@linutronix.de>
>> CommitterDate: Mon, 07 Apr 2025 16:35:21 +02:00
>>
>> x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI
>
> Thank you for accepting the patch.
>
> Out of curiosity, why did you remove the Cc: stable@vger.kernel.org
> trailer? I thought it should be backported as it is a regression.
Accidentally. Ooops.
The stable bot should pick it up nevertheless because of the Fixes tag
once it hit Linus tree. If it does not after a week or so, please send a
backport request to the stable folks.
Thanks,
tglx
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-04-08 8:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-05 18:16 [PATCH 0/1] x86/topology: Fix regression limiting Xen PV DomU CPUs to 1 Petr Vaněk
2025-04-05 18:16 ` [PATCH 1/1] x86/cpu/topology: Don't limit CPUs to 1 for Xen PV guests due to disabled APIC Petr Vaněk
2025-04-06 10:08 ` Thomas Gleixner
2025-04-07 13:24 ` Petr Vaněk
2025-04-07 13:24 ` [PATCH v2 1/1] x86/acpi: Don't limit CPUs to 1 for Xen PV guests due to disabled ACPI Petr Vaněk
2025-04-07 14:44 ` [tip: x86/urgent] " tip-bot2 for Petr Vaněk
2025-04-08 6:19 ` Petr Vaněk
2025-04-08 8:50 ` Thomas Gleixner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.