From nobody Sun Feb 8 10:29:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C09CDC7EE23 for ; Tue, 23 May 2023 08:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236162AbjEWISd (ORCPT ); Tue, 23 May 2023 04:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235753AbjEWIRv (ORCPT ); Tue, 23 May 2023 04:17:51 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C75BFE; Tue, 23 May 2023 01:15:51 -0700 (PDT) Date: Tue, 23 May 2023 08:15:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684829747; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iSC48ejrFN1szNw+99ZFEvTjXIrUUeq57tpcf9Ujqnc=; b=FJLmWUMQoaYV6Vt2wS1axS4sZink+fnW1KTOFU8edXwGOCxlilZ/gFCxJjbW1IpQDTnfJT AKhWWyB5NfPoI9W0767/Hoqsyre2Y/4jtghqaxaELd+QBil3aI6fhrkEG+xs+7qWuEdE41 AF8FO9oFAldHMBT80hcMDphaqWYIA6Y48TaXkUZAtnJPMiRNyf0zchJJofQeSBe28MjKHV e5OvABbiqZe2Wv9PNTdSvrJnYdXYMT0fNYG1OvTuduo2wquI3loiRQgit2kAtVaFl0RJPX g10j/DsasxkZ2CTfM+oVwbcrgYu4rPJeKB7j5q7k9PzDk8SA0RnBp5pi2PN5rA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684829747; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iSC48ejrFN1szNw+99ZFEvTjXIrUUeq57tpcf9Ujqnc=; b=0PNorpVbfhzsbmJjRDYluqjwmmcZBkOOMpOzAnJBu/83r0+iRXkRP8mBFCAs3fEuWYEtfy IMNiw0DDZTq9gHDA== From: "tip-bot2 for Like Xu" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf/x86/intel: Save/restore cpuc->active_pebs_data_cfg when using guest PEBS Cc: Like Xu , "Peter Zijlstra (Intel)" , Kan Liang , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230517133808.67885-1-likexu@tencent.com> References: <20230517133808.67885-1-likexu@tencent.com> MIME-Version: 1.0 Message-ID: <168482974681.404.11952331540708115887.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 3c845304d2d723f20d5b91fef5d133ff94825d76 Gitweb: https://git.kernel.org/tip/3c845304d2d723f20d5b91fef5d133ff9= 4825d76 Author: Like Xu AuthorDate: Wed, 17 May 2023 21:38:08 +08:00 Committer: Peter Zijlstra CommitterDate: Tue, 23 May 2023 10:01:13 +02:00 perf/x86/intel: Save/restore cpuc->active_pebs_data_cfg when using guest PE= BS After commit b752ea0c28e3 ("perf/x86/intel/ds: Flush PEBS DS when changing PEBS_DATA_CFG"), the cpuc->pebs_data_cfg may save some bits that are not supported by real hardware, such as PEBS_UPDATE_DS_SW. This would cause the VMX hardware MSR switching mechanism to save/restore invalid values for PEBS_DATA_CFG MSR, thus crashing the host when PEBS is used for guest. Fix it by using the active host value from cpuc->active_pebs_data_cfg. Fixes: b752ea0c28e3 ("perf/x86/intel/ds: Flush PEBS DS when changing PEBS_D= ATA_CFG") Signed-off-by: Like Xu Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Kan Liang Link: https://lore.kernel.org/r/20230517133808.67885-1-likexu@tencent.com --- arch/x86/events/intel/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 070cc4e..89b9c1c 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -4074,7 +4074,7 @@ static struct perf_guest_switch_msr *intel_guest_get_= msrs(int *nr, void *data) if (x86_pmu.intel_cap.pebs_baseline) { arr[(*nr)++] =3D (struct perf_guest_switch_msr){ .msr =3D MSR_PEBS_DATA_CFG, - .host =3D cpuc->pebs_data_cfg, + .host =3D cpuc->active_pebs_data_cfg, .guest =3D kvm_pmu->pebs_data_cfg, }; }