From: "tip-bot2 for Ravi Bangoria" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Ravi Bangoria <ravi.bangoria@amd.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Namhyung Kim <namhyung@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
Date: Mon, 03 Feb 2025 12:48:19 -0000 [thread overview]
Message-ID: <173858689970.10177.16512730043338946121.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250115054438.1021-5-ravi.bangoria@amd.com>
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 46dcf85566170d4528b842bf83ffc350d71771fa
Gitweb: https://git.kernel.org/tip/46dcf85566170d4528b842bf83ffc350d71771fa
Author: Ravi Bangoria <ravi.bangoria@amd.com>
AuthorDate: Wed, 15 Jan 2025 05:44:33
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 03 Feb 2025 11:46:05 +01:00
perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt
IBS Op uses two counters: MaxCnt and CurCnt. MaxCnt is programmed with
the desired sample period. IBS hw generates sample when CurCnt reaches
to MaxCnt. The size of these counter used to be 20 bits but later they
were extended to 27 bits. The 7 bit extension is indicated by CPUID
Fn8000_001B_EAX[6 / OpCntExt].
perf_ibs->cnt_mask variable contains bit masks for MaxCnt and CurCnt.
But IBS driver does not set upper 7 bits of CurCnt in cnt_mask even
when OpCntExt CPUID bit is set. Fix this.
IBS driver uses cnt_mask[CurCnt] bits only while disabling an event.
Fortunately, CurCnt bits are not read from MSR while re-enabling the
event, instead MaxCnt is programmed with desired period and CurCnt is
set to 0. Hence, we did not see any issues so far.
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/r/20250115054438.1021-5-ravi.bangoria@amd.com
---
arch/x86/events/amd/ibs.c | 3 ++-
arch/x86/include/asm/perf_event.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index f95542b..d9c84f1 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -1245,7 +1245,8 @@ static __init int perf_ibs_op_init(void)
if (ibs_caps & IBS_CAPS_OPCNTEXT) {
perf_ibs_op.max_period |= IBS_OP_MAX_CNT_EXT_MASK;
perf_ibs_op.config_mask |= IBS_OP_MAX_CNT_EXT_MASK;
- perf_ibs_op.cnt_mask |= IBS_OP_MAX_CNT_EXT_MASK;
+ perf_ibs_op.cnt_mask |= (IBS_OP_MAX_CNT_EXT_MASK |
+ IBS_OP_CUR_CNT_EXT_MASK);
}
if (ibs_caps & IBS_CAPS_ZEN4)
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 1ac79f3..ee55817 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -514,6 +514,7 @@ struct pebs_xmm {
*/
#define IBS_OP_CUR_CNT (0xFFF80ULL<<32)
#define IBS_OP_CUR_CNT_RAND (0x0007FULL<<32)
+#define IBS_OP_CUR_CNT_EXT_MASK (0x7FULL<<52)
#define IBS_OP_CNT_CTL (1ULL<<19)
#define IBS_OP_VAL (1ULL<<18)
#define IBS_OP_ENABLE (1ULL<<17)
next prev parent reply other threads:[~2025-02-03 12:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 5:44 [PATCH v4 0/9] perf/amd/ibs: Fix sample period computations Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 1/9] perf/amd/ibs: Remove IBS_{FETCH|OP}_CONFIG_MASK macros Ravi Bangoria
2025-02-03 12:48 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 2/9] perf/amd/ibs: Remove pointless sample period check Ravi Bangoria
2025-02-03 12:48 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 3/9] perf/amd/ibs: Fix ->config to sample period calculation for OP PMU Ravi Bangoria
2025-02-03 12:48 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 4/9] perf/amd/ibs: Fix perf_ibs_op.cnt_mask for CurCnt Ravi Bangoria
2025-02-03 12:48 ` tip-bot2 for Ravi Bangoria [this message]
2025-01-15 5:44 ` [PATCH v4 5/9] perf/amd/ibs: Don't allow freq mode event creation through ->config interface Ravi Bangoria
2025-01-16 21:09 ` Peter Zijlstra
2025-01-17 4:51 ` Ravi Bangoria
2025-02-03 12:48 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 6/9] perf/amd/ibs: Add PMU specific minimum period Ravi Bangoria
2025-02-03 12:48 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 7/9] perf/amd/ibs: Add ->check_period() callback Ravi Bangoria
2025-02-03 12:48 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 8/9] perf/amd/ibs: Ceil sample_period to min_period Ravi Bangoria
2025-02-03 12:48 ` [tip: perf/core] " tip-bot2 for Ravi Bangoria
2025-01-15 5:44 ` [PATCH v4 9/9] perf test amd ibs: Add sample period unit test Ravi Bangoria
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=173858689970.10177.16512730043338946121.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®