From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 339243B0AC7; Tue, 21 Jul 2026 20:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665926; cv=none; b=rrXoixUplRyJY3BhGvTUfMezOWZW9w0+oFBsPNFVuk3E5KfabmYzkRYMQIXnlyP9uZmUmj/D9A4itO53FNERpxiX0FaonLxlurfYJylZV3BAKEeqyAma9WwvlcuianqSyh10z8X9n2dN2Bip1ajGOD+iPNyv70lHDAVWFjATmhA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665926; c=relaxed/simple; bh=ZiLcebF9UCnS/FLz20pIDe9I2qiElxGqJnInlcBwm0o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gZM4Je79XZpRxixOI9+RXRiNL9kLPd/ZcfOkrPpHPClgcmBDIG/EwfPJ8o/97xT7HT4/aiAs+LxT4QEyItRpikw17vV9VEiww3g25LU5jE45nU+g0MuS0jf9m1sYTsuBJWgRxNykszvvJv7JgyksLVzAW4BAoYCOmaZ7nCnTtUI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aJnk6wq9; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="aJnk6wq9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E8FF1F000E9; Tue, 21 Jul 2026 20:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784665924; bh=7yeTFnWGef3nryOWrAjftUTtCE60MkhcFv3V6TmsSfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aJnk6wq9YNg3W38G9Pq+USKrUAPeJ3JULnsIEucorUKFg6GjuuulMUbG5uMbIxogb /nqtHnGw5YOViOUlbQN2Hf9FmzUnyAnVUsSPQo5cn/vZZDBBmonuY3QJhaHr4qtiY3 9HnmiUxFpu5K6NObkDE7PSUSVjdiX+R+o8GUJfqs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sandipan Das , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 6.6 0487/1266] perf/x86/amd/core: Always use the NMI latency mitigation Date: Tue, 21 Jul 2026 17:15:24 +0200 Message-ID: <20260721152452.740344451@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sandipan Das [ Upstream commit 73a4c02f94a98d94480c3e5c81450215a4da05ba ] Commit df4d29732fda ("perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp") fixed handling of late-arriving NMIs but limited the mitigation to processors having X86_FEATURE_PERFCTR_CORE. However, it is unclear if processors without this feature are also affected. When Mediated vPMU is enabled on affected hardware, it is also possible to bypass the fix inside KVM guests if X86_FEATURE_PERFCTR_CORE is removed from the guest CPUID (e.g. using "-cpu host,-perfctr-core" with QEMU). Hence, use the mitigation at all times. Fixes: df4d29732fda ("perf/x86/amd: Change/fix NMI latency mitigation to use a timestamp") Signed-off-by: Sandipan Das Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/29a3c970da289ab8f24282933bdb36545c0403e8.1780325517.git.sandipan.das@amd.com Signed-off-by: Sasha Levin --- arch/x86/events/amd/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index 211f429750f5fe..24f356e561e287 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -1364,12 +1364,12 @@ static int __init amd_core_pmu_init(void) u64 even_ctr_mask = 0ULL; int i; - if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) - return 0; - /* Avoid calculating the value each time in the NMI handler */ perf_nmi_window = msecs_to_jiffies(100); + if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) + return 0; + /* * If core performance counter extensions exists, we must use * MSR_F15H_PERF_CTL/MSR_F15H_PERF_CTR msrs. See also -- 2.53.0