From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9A4CA3ECBD5; Tue, 30 Jun 2026 09:48:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782812899; cv=none; b=jAqhEl+X/e9sCbIRMm7vMBsghgiEHRofkqiFMEInArHWBimCNOCJ4+OBV8v3897CDHNBhkC8bgHyVsBucbsujFhZ2uzfUGHiJjJRt1391JPk5+nCM0rPDKNX+sJD3+FzWGXd0r+0mxK+WOt5Xs8FhgAvTP8Qdf/JC+mHdiydsq0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782812899; c=relaxed/simple; bh=89XX+tq4nQqPN/3B98FNqme/9qUWPvVF51Voq0s1HLE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=YzJEV+mBussRoT0EJcRcvofIB+XIuXw/+cqIjqtwxGdX4oIMKUNyZ5fFnEAOChwcbfW4nxq9oqYB4shhj4J61xhq3dMIG3bmGCacCq+J2KG2wkrTvL9jUwObfCdrmAu7ECzFpFBRI7TaVrPfKWH1k6YI/+AlEjOcxDgRk81+7Bs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=tt2Rd21H; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FRjqiEG0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="tt2Rd21H"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FRjqiEG0" Date: Tue, 30 Jun 2026 09:48:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1782812895; 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=JLZxHLkHkkOBIqCmnQODErxjaf6QEMKnJ1E1cSR/VUg=; b=tt2Rd21H2CUWQs64g6P7nH5LW9uIX4e2fwxQ/s46I+MJAVIB9wFJAg00jSwvayeNeVbe5b 8JKpokMKLMZ2lnfOMYpXxWgiksxpv+dyRmiBI07vnj27qjG1PyttQOOfp4E50fvH2B+R0S AK94wLSGAJUy+wkMPxqrbMvTT2sDdVm0XPqESp2P1skXXJ0kgnsMM5yeWtl7tA8QnEQoI9 v7qWx4XOcKc7oqD5UifSlcQoHmoe1b9WR0s35Y3zEj63+aNXbVHJIcZZlRXw0Es91pIQB7 ZjZwhp+6s0Qgnwks9NKjoHSOmOLV+rY+UFIpJ+usQAJnNl4UFe5d9t/75XscuA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1782812895; 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=JLZxHLkHkkOBIqCmnQODErxjaf6QEMKnJ1E1cSR/VUg=; b=FRjqiEG0w8xPMlnYULjzmKzubrLJ2gTeZU1aRl5i/vOnSDAUMJw9tdCdKJMhi97XHRMMJs mWRnJTrVpFMR6tDw== From: "tip-bot2 for Dapeng Mi" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86/intel: Drop fixed-counter PEBS constraints for baseline PEBS Cc: Yi Lai , Dapeng Mi , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260616044654.3468742-7-dapeng1.mi@linux.intel.com> References: <20260616044654.3468742-7-dapeng1.mi@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178281289404.3843924.2749745712425934695.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the perf/core branch of tip: Commit-ID: a6b5fbc33172509fbe991358d718617a8e33ea7e Gitweb: https://git.kernel.org/tip/a6b5fbc33172509fbe991358d718617a8e3= 3ea7e Author: Dapeng Mi AuthorDate: Tue, 16 Jun 2026 12:46:52 +08:00 Committer: Peter Zijlstra CommitterDate: Tue, 30 Jun 2026 11:46:07 +02:00 perf/x86/intel: Drop fixed-counter PEBS constraints for baseline PEBS On Sapphire Rapids (SPR) guests where pebs_baseline is not advertised, running command $ ./perf record -e cpu/event=3D0x00,umask=3D0x01,i\ name=3DINST_RETIRED.PREC_DIST/p -c 10000 sleep 1 can trigger: unchecked MSR access error: WRMSR to 0x3f1 ... in\ intel_pmu_pebs_enable_all() This occurs because SPR-specific PEBS constraints allow fixed-counter scheduling (for example, INST_RETIRED.PREC_DIST on fixed counter 0). In guests lacking pebs_baseline, KVM does not support PEBS sampling on fixed counters, so enabling such events reaches an invalid MSR programming path. Starting with Icelake, regardless of whether Extended PEBS or Architectural PEBS is in use, all counters (including fixed counters) support PEBS sampling, and the PMU_FL_PEBS_ALL flag is set by default. As long as PMU_FL_PEBS_ALL is set, constraint lookup automatically falls back to the corresponding non-PEBS constraints if no matching entry is found in the PEBS constraints table. Since non-PEBS event constraints already contain the same fixed-counter constraints, it is safe to remove these fixed-counter entries from the PEBS constraints table. The fallback mechanism will ensure that fixed PEBS events are scheduled onto the correct fixed counters. So, directly drop the fixed-counter entries from the PEBS constraint table. Without pebs_baseline, these fixed-counter PEBS events will now resolve to empty constraints and will not be scheduled or enabled, thereby avoiding the warning and bypassing the broken guest PEBS path. Reported-by: Yi Lai Signed-off-by: Dapeng Mi Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260616044654.3468742-7-dapeng1.mi@linux.inte= l.com --- arch/x86/events/intel/ds.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 91a093d..e86e4ba 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -1444,10 +1444,6 @@ struct event_constraint intel_skl_pebs_event_constrain= ts[] =3D { }; =20 struct event_constraint intel_icl_pebs_event_constraints[] =3D { - INTEL_FLAGS_UEVENT_CONSTRAINT(0x01c0, 0x100000000ULL), /* old INST_RETIRED.= PREC_DIST */ - INTEL_FLAGS_UEVENT_CONSTRAINT(0x0100, 0x100000000ULL), /* INST_RETIRED.PREC= _DIST */ - INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL), /* SLOTS */ - INTEL_PLD_CONSTRAINT(0x1cd, 0xff), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.S= TLB_MISS_LOADS */ INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.S= TLB_MISS_STORES */ @@ -1470,9 +1466,6 @@ struct event_constraint intel_icl_pebs_event_constraint= s[] =3D { }; =20 struct event_constraint intel_glc_pebs_event_constraints[] =3D { - INTEL_FLAGS_UEVENT_CONSTRAINT(0x100, 0x100000000ULL), /* INST_RETIRED.PREC_= DIST */ - INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL), - INTEL_FLAGS_EVENT_CONSTRAINT(0xc0, 0xfe), INTEL_PLD_CONSTRAINT(0x1cd, 0xfe), INTEL_PSD_CONSTRAINT(0x2cd, 0x1), @@ -1497,9 +1490,6 @@ struct event_constraint intel_glc_pebs_event_constraint= s[] =3D { }; =20 struct event_constraint intel_lnc_pebs_event_constraints[] =3D { - INTEL_FLAGS_UEVENT_CONSTRAINT(0x100, 0x100000000ULL), /* INST_RETIRED.PREC_= DIST */ - INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL), - INTEL_FLAGS_UEVENT_CONSTRAINT(0x012a, 0x1), /* OCR.* events */ INTEL_FLAGS_UEVENT_CONSTRAINT(0x012b, 0x1), /* OCR.* events */ =20 @@ -1531,9 +1521,6 @@ struct event_constraint intel_lnc_pebs_event_constraint= s[] =3D { }; =20 struct event_constraint intel_pnc_pebs_event_constraints[] =3D { - INTEL_FLAGS_UEVENT_CONSTRAINT(0x100, 0x100000000ULL), /* INST_RETIRED.PREC_= DIST */ - INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL), - INTEL_HYBRID_LDLAT_CONSTRAINT(0x1cd, 0xfc), INTEL_HYBRID_STLAT_CONSTRAINT(0x2cd, 0x3), INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.S= TLB_MISS_LOADS */