From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65E2529A3FF; Mon, 14 Apr 2025 13:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744637369; cv=none; b=HGfyxR7549u56LH3s8eTG78tPyEZVK7GhgoxujlpzlDhlPMtiHiR44JyGD2IVspi1sm5qRaL+MWVmzkt85P2NxnEyvltzBKk3XpY1ypx2w14JN2I0rZmfKrv2zFDmwAUY52PeiqiUBMucu0ZhrD9zsktiSfkFsVthxrO8cu2kHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744637369; c=relaxed/simple; bh=NWePQQGyiJB1lF8JMRapZucVYoCavkai+t/0v9AbqlY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=JifrQJHexgeEVsP4j8749teKIquP7ywi5MKdglMqKoIY1KMosbqLWVre/J4d7zz3vgOitRPUPK9GJ8w5z/Wd/DLwdEn+P/ONT3oGJfQtss6GMIYOeSZUKvlakcafRuUUyscSRwlLebBP+vOxHCY9xPXDspdxp81MEeaAERK41Yc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X/yzEKYS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X/yzEKYS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3201FC4CEED; Mon, 14 Apr 2025 13:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744637368; bh=NWePQQGyiJB1lF8JMRapZucVYoCavkai+t/0v9AbqlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/yzEKYSwL5Xz/o4DkJ0BmYsjtfGV2qiBOtb48skCKtxXTfnBEa3R47zQ+6UR2Slc iXozYQoKqcL7Td8/9vpyc69Uo1vL92/HCVYOtPTzKTxTsUSx+ra5u5LIOTveKL87Vp BB91M+zgNc4+IYpLwj2jYNIQLPpIV3EXzYykjJqX35k714TD5o3X8ELaJGv2zoPNWM +CMZRiE6sSHm4MToT0kxvmSfE0rhZCIk+8s65LIuFKnO6qJ+XCNNtxMhYfw773NdTQ iX1gcjlct5u1u4Ki2rucWdjN0JG7wtn08dFFW7ERRH56RLSjtCaomGlLhsImVXnb+g nY5+8Z3nwQUaQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Roger Pau Monne , Jason Andryuk , Juergen Gross , Sasha Levin , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, xen-devel@lists.xenproject.org Subject: [PATCH AUTOSEL 6.12 17/30] x86/xen: disable CPU idle and frequency drivers for PVH dom0 Date: Mon, 14 Apr 2025 09:28:34 -0400 Message-Id: <20250414132848.679855-17-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250414132848.679855-1-sashal@kernel.org> References: <20250414132848.679855-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.12.23 Content-Transfer-Encoding: 8bit From: Roger Pau Monne [ Upstream commit 64a66e2c3b3113dc78a6124e14825d68ddc2e188 ] 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é Reviewed-by: Jason Andryuk Signed-off-by: Juergen Gross Message-ID: <20250407101842.67228-1-roger.pau@citrix.com> Signed-off-by: Sasha Levin --- arch/x86/xen/enlighten_pvh.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten_pvh.c b/arch/x86/xen/enlighten_pvh.c index 0e3d930bcb89e..9d25d9373945c 100644 --- a/arch/x86/xen/enlighten_pvh.c +++ b/arch/x86/xen/enlighten_pvh.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include +#include #include #include @@ -123,8 +125,23 @@ static void __init pvh_arch_setup(void) { pvh_reserve_extra_memory(); - if (xen_initial_domain()) + if (xen_initial_domain()) { xen_add_preferred_consoles(); + + /* + * Disable usage of CPU idle and frequency drivers: when + * running as hardware domain the exposed native ACPI tables + * causes idle and/or frequency drivers to attach and + * malfunction. It's Xen the entity that controls the idle and + * frequency states. + * + * For unprivileged domains the exposed ACPI tables are + * fabricated and don't contain such data. + */ + disable_cpuidle(); + disable_cpufreq(); + WARN_ON(xen_set_default_idle()); + } } void __init xen_pvh_init(struct boot_params *boot_params) -- 2.39.5