Skip to content

Commit 64a66e2

Browse files
roygerjgross1
authored andcommitted
x86/xen: disable CPU idle and frequency drivers for PVH dom0
When running as a PVH dom0 the ACPI tables exposed to Linux are (mostly) the native ones, thus exposing the C and P states, that can lead to attachment of CPU idle and frequency drivers. However the entity in control of the CPU C and P states is Xen, as dom0 doesn't have a full view of the system load, neither has all CPUs assigned and identity pinned. Like it's done for classic PV guests, prevent Linux from using idle or frequency state drivers when running as a PVH dom0. On an AMD EPYC 7543P system without this fix a Linux PVH dom0 will keep the host CPUs spinning at 100% even when dom0 is completely idle, as it's attempting to use the acpi_idle driver. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Jason Andryuk <jason.andryuk@amd.com> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20250407101842.67228-1-roger.pau@citrix.com>
1 parent 87af633 commit 64a66e2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

arch/x86/xen/enlighten_pvh.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
#include <linux/acpi.h>
3+
#include <linux/cpufreq.h>
4+
#include <linux/cpuidle.h>
35
#include <linux/export.h>
46
#include <linux/mm.h>
57

@@ -123,8 +125,23 @@ static void __init pvh_arch_setup(void)
123125
{
124126
pvh_reserve_extra_memory();
125127

126-
if (xen_initial_domain())
128+
if (xen_initial_domain()) {
127129
xen_add_preferred_consoles();
130+
131+
/*
132+
* Disable usage of CPU idle and frequency drivers: when
133+
* running as hardware domain the exposed native ACPI tables
134+
* causes idle and/or frequency drivers to attach and
135+
* malfunction. It's Xen the entity that controls the idle and
136+
* frequency states.
137+
*
138+
* For unprivileged domains the exposed ACPI tables are
139+
* fabricated and don't contain such data.
140+
*/
141+
disable_cpuidle();
142+
disable_cpufreq();
143+
WARN_ON(xen_set_default_idle());
144+
}
128145
}
129146

130147
void __init xen_pvh_init(struct boot_params *boot_params)

0 commit comments

Comments
 (0)