* [PATCH v2 1/8] perf test amd ibs: Fix incorrect kernel version check
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 2/8] perf tool ibs: Sync AMD IBS header file Ravi Bangoria
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
"AMD IBS sample period" unit test is getting skipped on kernel v7.x. Fix
the kernel version >= v6.15 check.
Fixes: 21fb366b2f457 ("perf test amd: Skip amd-ibs-period test on kernel < v6.15")
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/arch/x86/tests/amd-ibs-period.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/x86/tests/amd-ibs-period.c b/tools/perf/arch/x86/tests/amd-ibs-period.c
index cee9e11c05e0..6a92b3a23ed7 100644
--- a/tools/perf/arch/x86/tests/amd-ibs-period.c
+++ b/tools/perf/arch/x86/tests/amd-ibs-period.c
@@ -932,7 +932,7 @@ static bool kernel_v6_15_or_newer(void)
endptr++;
minor = strtol(endptr, NULL, 10);
- return major >= 6 && minor >= 15;
+ return major > 6 || (major == 6 && minor >= 15);
}
int test__amd_ibs_period(struct test_suite *test __maybe_unused,
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 2/8] perf tool ibs: Sync AMD IBS header file
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 1/8] perf test amd ibs: Fix incorrect kernel version check Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 3/8] perf test ibs: Remove obsolete privilege test Ravi Bangoria
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
IBS_OP_DATA2 register will have two more fields: strm_st and rmt_socket
in Zen6 and future AMD platforms. Kernel header file is already updated.
Add those fields in tools copy as well.
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/arch/x86/include/asm/amd/ibs.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/arch/x86/include/asm/amd/ibs.h b/tools/arch/x86/include/asm/amd/ibs.h
index 41e8abd72c8b..c505c80d656d 100644
--- a/tools/arch/x86/include/asm/amd/ibs.h
+++ b/tools/arch/x86/include/asm/amd/ibs.h
@@ -99,7 +99,9 @@ union ibs_op_data2 {
rmt_node:1, /* 4: destination node */
cache_hit_st:1, /* 5: cache hit state */
data_src_hi:2, /* 6-7: data source high */
- reserved1:56; /* 8-63: reserved */
+ strm_st:1, /* 8: streaming store */
+ rmt_socket:1, /* 9: remote socket */
+ reserved1:54; /* 10-63: reserved */
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 3/8] perf test ibs: Remove obsolete privilege test
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 1/8] perf test amd ibs: Fix incorrect kernel version check Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 2/8] perf tool ibs: Sync AMD IBS header file Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
2026-05-08 0:24 ` Namhyung Kim
2026-04-30 6:11 ` [PATCH v2 4/8] perf amd ibs: Suppress bogus TlbRefillLat and DCPhysAd on Zen4+ Ravi Bangoria
` (4 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
Older IBS implementations lacked a hardware privilege filter, so the
kernel enabled swfilt=1. Newer AMD CPUs will provide privilege filtering
via the RIP[63] bit, making swfilt redundant. Remove the perf unit test
that assumes IBS has no hardware-assisted privilege filter.
swfilt is ignored by kernel on platforms that support RIP[63] bit filter
i.e. all amd-ibs-swfilt.sh tests will test hardware assisted privilege
filter.
Without the patch:
# ./perf test -vv 75
test child forked, pid 26029
check availability of IBS swfilt
run perf record with modifier and swfilt
[FAIL] IBS PMU should not accept exclude_kernel
75: AMD IBS software filtering : FAILED!
With the patch:
# ./perf test -vv 75
check availability of IBS swfilt
run perf record with modifier and swfilt
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.000 MB /dev/null ]
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.000 MB /dev/null ]
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.000 MB /dev/null ]
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB /dev/null ]
check number of samples with swfilt
[ perf record: Woken up 5 times to write data ]
[ perf record: Captured and wrote 0.040 MB - ]
[ perf record: Woken up 3 times to write data ]
[ perf record: Captured and wrote 0.054 MB - ]
75: AMD IBS software filtering : Ok
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/tests/shell/amd-ibs-swfilt.sh | 7 -------
1 file changed, 7 deletions(-)
diff --git a/tools/perf/tests/shell/amd-ibs-swfilt.sh b/tools/perf/tests/shell/amd-ibs-swfilt.sh
index e7f66df05c4b..92ef45bf3043 100755
--- a/tools/perf/tests/shell/amd-ibs-swfilt.sh
+++ b/tools/perf/tests/shell/amd-ibs-swfilt.sh
@@ -22,13 +22,6 @@ fi
echo "run perf record with modifier and swfilt"
err=0
-# setting any modifiers should fail
-perf record -B -e ibs_op//u -o /dev/null true 2> /dev/null
-if [ $? -eq 0 ]; then
- echo "[FAIL] IBS PMU should not accept exclude_kernel"
- exit 1
-fi
-
# setting it with swfilt should be fine
perf record -B -e ibs_op/swfilt/u -o /dev/null true
if [ $? -ne 0 ]; then
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v2 3/8] perf test ibs: Remove obsolete privilege test
2026-04-30 6:11 ` [PATCH v2 3/8] perf test ibs: Remove obsolete privilege test Ravi Bangoria
@ 2026-05-08 0:24 ` Namhyung Kim
2026-05-08 6:05 ` Ravi Bangoria
0 siblings, 1 reply; 11+ messages in thread
From: Namhyung Kim @ 2026-05-08 0:24 UTC (permalink / raw)
To: Ravi Bangoria
Cc: Arnaldo Carvalho de Melo, Ian Rogers, Peter Zijlstra, Ingo Molnar,
Dapeng Mi, James Clark, x86, linux-perf-users, linux-kernel,
Manali Shukla, Santosh Shukla, Ananth Narayan, Sandipan Das
Hello,
On Thu, Apr 30, 2026 at 06:11:10AM +0000, Ravi Bangoria wrote:
> Older IBS implementations lacked a hardware privilege filter, so the
> kernel enabled swfilt=1. Newer AMD CPUs will provide privilege filtering
> via the RIP[63] bit, making swfilt redundant. Remove the perf unit test
> that assumes IBS has no hardware-assisted privilege filter.
Can you add a check for CPU model or capability for this?
Probably we want to keep this test for older models..
Thanks,
Namhyung
>
> swfilt is ignored by kernel on platforms that support RIP[63] bit filter
> i.e. all amd-ibs-swfilt.sh tests will test hardware assisted privilege
> filter.
>
> Without the patch:
>
> # ./perf test -vv 75
> test child forked, pid 26029
> check availability of IBS swfilt
> run perf record with modifier and swfilt
> [FAIL] IBS PMU should not accept exclude_kernel
> 75: AMD IBS software filtering : FAILED!
>
> With the patch:
>
> # ./perf test -vv 75
> check availability of IBS swfilt
> run perf record with modifier and swfilt
> [ perf record: Woken up 3 times to write data ]
> [ perf record: Captured and wrote 0.000 MB /dev/null ]
> [ perf record: Woken up 3 times to write data ]
> [ perf record: Captured and wrote 0.000 MB /dev/null ]
> [ perf record: Woken up 3 times to write data ]
> [ perf record: Captured and wrote 0.000 MB /dev/null ]
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.000 MB /dev/null ]
> check number of samples with swfilt
> [ perf record: Woken up 5 times to write data ]
> [ perf record: Captured and wrote 0.040 MB - ]
> [ perf record: Woken up 3 times to write data ]
> [ perf record: Captured and wrote 0.054 MB - ]
> 75: AMD IBS software filtering : Ok
>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
> ---
> tools/perf/tests/shell/amd-ibs-swfilt.sh | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/tools/perf/tests/shell/amd-ibs-swfilt.sh b/tools/perf/tests/shell/amd-ibs-swfilt.sh
> index e7f66df05c4b..92ef45bf3043 100755
> --- a/tools/perf/tests/shell/amd-ibs-swfilt.sh
> +++ b/tools/perf/tests/shell/amd-ibs-swfilt.sh
> @@ -22,13 +22,6 @@ fi
> echo "run perf record with modifier and swfilt"
> err=0
>
> -# setting any modifiers should fail
> -perf record -B -e ibs_op//u -o /dev/null true 2> /dev/null
> -if [ $? -eq 0 ]; then
> - echo "[FAIL] IBS PMU should not accept exclude_kernel"
> - exit 1
> -fi
> -
> # setting it with swfilt should be fine
> perf record -B -e ibs_op/swfilt/u -o /dev/null true
> if [ $? -ne 0 ]; then
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/8] perf test ibs: Remove obsolete privilege test
2026-05-08 0:24 ` Namhyung Kim
@ 2026-05-08 6:05 ` Ravi Bangoria
0 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-05-08 6:05 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Ian Rogers, Peter Zijlstra, Ingo Molnar,
Dapeng Mi, James Clark, x86, linux-perf-users, linux-kernel,
Manali Shukla, Santosh Shukla, Ananth Narayan, Sandipan Das,
Ravi Bangoria
>> Older IBS implementations lacked a hardware privilege filter, so the
>> kernel enabled swfilt=1. Newer AMD CPUs will provide privilege filtering
>> via the RIP[63] bit, making swfilt redundant. Remove the perf unit test
>> that assumes IBS has no hardware-assisted privilege filter.
>
> Can you add a check for CPU model or capability for this?
> Probably we want to keep this test for older models..
Fixed and posted v3:
https://lore.kernel.org/r/20260508060004.2575-1-ravi.bangoria@amd.com
Thanks Namhyung.
Ravi
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 4/8] perf amd ibs: Suppress bogus TlbRefillLat and DCPhysAd on Zen4+
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
` (2 preceding siblings ...)
2026-04-30 6:11 ` [PATCH v2 3/8] perf test ibs: Remove obsolete privilege test Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 5/8] perf amd ibs: Make Fetch status bits dependent on PhyAddrValid for newer platforms Ravi Bangoria
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
On Zen4 (and future) CPUs, IBS_OP_DATA3[TlbRefillLat] is valid only if
IBS_OP_DATA3[DcPhyAddrValid] is set. Similarly, IBS_DC_PHYSADDR is valid
if IBS_OP_DATA3[DcLinAddrValid] is _also_ set. Add these checks while
decoding IBS MSRs.
When IBS is triggered by an unprivileged user, the kernel now zeroes
PhysAddr before storing raw IBS register values in the perf sample. The
perf tool, however, still outputs these zero physical addresses, which
serves no purpose. So avoid printing zero physical addresses.
Instead of explicit family/model checks use the !zen4_ibs_extensions as
a proxy flag to cover Zen 3 and earlier revisions.
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/util/amd-sample-raw.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/amd-sample-raw.c b/tools/perf/util/amd-sample-raw.c
index b084dee76b1a..385308c55f34 100644
--- a/tools/perf/util/amd-sample-raw.c
+++ b/tools/perf/util/amd-sample-raw.c
@@ -172,6 +172,7 @@ static void pr_ibs_op_data3(union ibs_op_data3 reg)
char dc_l1_l2tlb_miss_str[sizeof(" DcL1TlbMiss _ DcL2TlbMiss _")] = "";
char dc_l1tlb_hit_str[sizeof(" DcL1TlbHit2M _ DcL1TlbHit1G _")] = "";
char op_mem_width_str[sizeof(" OpMemWidth _____ bytes")] = "";
+ char tlb_refill_lat_str[sizeof(" TlbRefillLat _____")] = "";
char dc_l2tlb_hit_2m_str[sizeof(" DcL2TlbHit2M _")] = "";
char dc_l2tlb_hit_1g_str[sizeof(" DcL2TlbHit1G _")] = "";
char dc_page_size_str[sizeof(" DcPageSize ____")] = "";
@@ -214,17 +215,23 @@ static void pr_ibs_op_data3(union ibs_op_data3 reg)
" DcL2TlbHit1G %d", reg.dc_l2_tlb_hit_1g);
}
+ /* Use !zen4_ibs_extensions as a proxy for Zen3 and earlier */
+ if (!zen4_ibs_extensions || reg.dc_phy_addr_valid) {
+ snprintf(tlb_refill_lat_str, sizeof(tlb_refill_lat_str),
+ " TlbRefillLat %5d", reg.tlb_refill_lat);
+ }
+
printf("ibs_op_data3:\t%016llx LdOp %d StOp %d%s%s%s DcMiss %d DcMisAcc %d "
"DcWcMemAcc %d DcUcMemAcc %d DcLockedOp %d DcMissNoMabAlloc %d "
"DcLinAddrValid %d DcPhyAddrValid %d%s%s SwPf %d%s%s "
- "DcMissLat %5d TlbRefillLat %5d\n",
+ "DcMissLat %5d%s\n",
reg.val, reg.ld_op, reg.st_op, dc_l1_l2tlb_miss_str,
dtlb_pgsize_cap ? dc_page_size_str : dc_l1tlb_hit_str,
dc_l2tlb_hit_2m_str, reg.dc_miss, reg.dc_mis_acc, reg.dc_wc_mem_acc,
reg.dc_uc_mem_acc, reg.dc_locked_op, reg.dc_miss_no_mab_alloc,
reg.dc_lin_addr_valid, reg.dc_phy_addr_valid, dc_l2tlb_hit_1g_str,
l2_miss_str, reg.sw_pf, op_mem_width_str, op_dc_miss_open_mem_reqs_str,
- reg.dc_miss_lat, reg.tlb_refill_lat);
+ reg.dc_miss_lat, tlb_refill_lat_str);
}
/*
@@ -253,8 +260,12 @@ static void amd_dump_ibs_op(struct perf_sample *sample)
pr_ibs_op_data3(*op_data3);
if (op_data3->dc_lin_addr_valid)
printf("IbsDCLinAd:\t%016llx\n", *(rip + 4));
- if (op_data3->dc_phy_addr_valid)
+
+ /* Use !zen4_ibs_extensions as a proxy for Zen3 and earlier */
+ if (op_data3->dc_phy_addr_valid && *(rip + 5) &&
+ (!zen4_ibs_extensions || op_data3->dc_lin_addr_valid)) {
printf("IbsDCPhysAd:\t%016llx\n", *(rip + 5));
+ }
if (op_data->op_brn_ret && *(rip + 6))
printf("IbsBrTarget:\t%016llx\n", *(rip + 6));
}
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 5/8] perf amd ibs: Make Fetch status bits dependent on PhyAddrValid for newer platforms
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
` (3 preceding siblings ...)
2026-04-30 6:11 ` [PATCH v2 4/8] perf amd ibs: Suppress bogus TlbRefillLat and DCPhysAd on Zen4+ Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 6/8] perf amd ibs: Decode Remote-Socket flag in IBS OP raw dump Ravi Bangoria
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
On Zen6 and future platforms, IBS_FETCH_CTL status fields are valid only
if IBS_FETCH_CTL[IbsPhyAddrValid] is set. Same for IBS_FETCH_CTL_EXT.
Add these checks while decoding IBS MSRs.
Unfortunately, there is no CPUID bit to indicate the change. Fallback
to Family/Model check.
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/util/amd-sample-raw.c | 42 ++++++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/amd-sample-raw.c b/tools/perf/util/amd-sample-raw.c
index 385308c55f34..ae005eb0363d 100644
--- a/tools/perf/util/amd-sample-raw.c
+++ b/tools/perf/util/amd-sample-raw.c
@@ -22,6 +22,29 @@ static bool zen4_ibs_extensions;
static bool ldlat_cap;
static bool dtlb_pgsize_cap;
+/*
+ * Status fields of IBS_FETCH_CTL and IBS_FETCH_CTL_EXT are valid only if
+ * IBS_FETCH_CTL[PhyAddrValid] is set.
+ */
+static int fetch_ctl_depends_on_phy_addr_valid(void)
+{
+ static int depends = -1; /* -1: Don't know, 1: Yes, 0: No */
+
+ if (depends != -1)
+ return depends;
+
+ depends = 0;
+ if (cpu_family > 0x1a ||
+ (cpu_family == 0x1a && (
+ (cpu_model >= 0x50 && cpu_model <= 0x5f) ||
+ (cpu_model >= 0x80 && cpu_model <= 0xaf) ||
+ (cpu_model >= 0xc0 && cpu_model <= 0xcf)))) {
+ depends = 1;
+ }
+
+ return depends;
+}
+
static void pr_ibs_fetch_ctl(union ibs_fetch_ctl reg)
{
const char * const ic_miss_strs[] = {
@@ -43,6 +66,18 @@ static void pr_ibs_fetch_ctl(union ibs_fetch_ctl reg)
const char *ic_miss_str = NULL;
const char *l1tlb_pgsz_str = NULL;
char l3_miss_str[sizeof(" L3MissOnly _ FetchOcMiss _ FetchL3Miss _")] = "";
+ char l3_miss_only_str[sizeof(" L3MissOnly _")] = "";
+
+ if (fetch_ctl_depends_on_phy_addr_valid() && !reg.phy_addr_valid) {
+ snprintf(l3_miss_only_str, sizeof(l3_miss_only_str),
+ " L3MissOnly %d", reg.l3_miss_only);
+
+ printf("ibs_fetch_ctl:\t%016llx MaxCnt %7d Cnt %7d En %d Val %d Comp %d "
+ "PhyAddrValid 0 RandEn %d%s\n", reg.val, reg.fetch_maxcnt << 4,
+ reg.fetch_cnt << 4, reg.fetch_en, reg.fetch_val, reg.fetch_comp,
+ reg.rand_en, l3_miss_only_str);
+ return;
+ }
if (cpu_family == 0x19 && cpu_model < 0x10) {
/*
@@ -72,8 +107,11 @@ static void pr_ibs_fetch_ctl(union ibs_fetch_ctl reg)
l3_miss_str);
}
-static void pr_ic_ibs_extd_ctl(union ic_ibs_extd_ctl reg)
+static void pr_ic_ibs_extd_ctl(union ibs_fetch_ctl fetch_ctl, union ic_ibs_extd_ctl reg)
{
+ if (fetch_ctl_depends_on_phy_addr_valid() && !fetch_ctl.phy_addr_valid)
+ return;
+
printf("ic_ibs_ext_ctl:\t%016llx IbsItlbRefillLat %3d\n", reg.val, reg.itlb_refill_lat);
}
@@ -285,7 +323,7 @@ static void amd_dump_ibs_fetch(struct perf_sample *sample)
printf("IbsFetchLinAd:\t%016llx\n", *addr++);
if (fetch_ctl->phy_addr_valid)
printf("IbsFetchPhysAd:\t%016llx\n", *addr);
- pr_ic_ibs_extd_ctl(*extd_ctl);
+ pr_ic_ibs_extd_ctl(*fetch_ctl, *extd_ctl);
}
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 6/8] perf amd ibs: Decode Remote-Socket flag in IBS OP raw dump
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
` (4 preceding siblings ...)
2026-04-30 6:11 ` [PATCH v2 5/8] perf amd ibs: Make Fetch status bits dependent on PhyAddrValid for newer platforms Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 7/8] perf amd ibs: Decode Streaming-store " Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 8/8] perf doc: Document new IBS capabilities in man page Ravi Bangoria
7 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
IBS OP on Zen6 and future platform can mark a data source as coming from
a remote socket. When the PMU advertises this feature, interpret
IBS_OP_DATA2[9] bit as the Remote-Socket indicator and show it in the
raw dump output.
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/util/amd-sample-raw.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/amd-sample-raw.c b/tools/perf/util/amd-sample-raw.c
index ae005eb0363d..3e5530008b14 100644
--- a/tools/perf/util/amd-sample-raw.c
+++ b/tools/perf/util/amd-sample-raw.c
@@ -21,6 +21,7 @@ static u32 cpu_family, cpu_model, ibs_fetch_type, ibs_op_type;
static bool zen4_ibs_extensions;
static bool ldlat_cap;
static bool dtlb_pgsize_cap;
+static bool rmtsocket_cap;
/*
* Status fields of IBS_FETCH_CTL and IBS_FETCH_CTL_EXT are valid only if
@@ -164,8 +165,13 @@ static void pr_ibs_op_data2_extended(union ibs_op_data2 reg)
/* 13 to 31 are reserved. Avoid printing them. */
};
int data_src = (reg.data_src_hi << 3) | reg.data_src_lo;
+ char rmtsocket[sizeof("RmtSocket _ ")] = "";
- printf("ibs_op_data2:\t%016llx %sRmtNode %d%s\n", reg.val,
+ if (rmtsocket_cap)
+ snprintf(rmtsocket, sizeof(rmtsocket), "RmtSocket %d ", reg.rmt_socket);
+
+ printf("ibs_op_data2:\t%016llx %s%sRmtNode %d%s\n", reg.val,
+ rmtsocket,
(data_src == 1 || data_src == 2 || data_src == 5) ?
(reg.cache_hit_st ? "CacheHitSt 1=O-State " : "CacheHitSt 0=M-state ") : "",
reg.rmt_node,
@@ -184,8 +190,13 @@ static void pr_ibs_op_data2_default(union ibs_op_data2 reg)
" DataSrc 6=(reserved)",
" DataSrc 7=Other"
};
+ char rmtsocket[sizeof("RmtSocket _ ")] = "";
+
+ if (rmtsocket_cap)
+ snprintf(rmtsocket, sizeof(rmtsocket), "RmtSocket %d ", reg.rmt_socket);
- printf("ibs_op_data2:\t%016llx %sRmtNode %d%s\n", reg.val,
+ printf("ibs_op_data2:\t%016llx %s%sRmtNode %d%s\n", reg.val,
+ rmtsocket,
reg.data_src_lo == 2 ? (reg.cache_hit_st ? "CacheHitSt 1=O-State "
: "CacheHitSt 0=M-state ") : "",
reg.rmt_node, data_src_str[reg.data_src_lo]);
@@ -429,6 +440,9 @@ bool evlist__has_amd_ibs(struct evlist *evlist)
if (perf_env__find_pmu_cap(env, "ibs_op", "dtlb_pgsize"))
dtlb_pgsize_cap = 1;
+ if (perf_env__find_pmu_cap(env, "ibs_op", "rmtsocket"))
+ rmtsocket_cap = 1;
+
if (ibs_fetch_type || ibs_op_type) {
if (!cpu_family)
parse_cpuid(env);
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 7/8] perf amd ibs: Decode Streaming-store flag in IBS OP raw dump
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
` (5 preceding siblings ...)
2026-04-30 6:11 ` [PATCH v2 6/8] perf amd ibs: Decode Remote-Socket flag in IBS OP raw dump Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
2026-04-30 6:11 ` [PATCH v2 8/8] perf doc: Document new IBS capabilities in man page Ravi Bangoria
7 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
IBS OP on Zen6 and future platform can tag IBS samples that originate from
streaming-store instruction. When the PMU advertises this feature,
interpret IBS_OP_DATA2[8] bit as the streaming store indicator and show
it in the raw dump output.
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/util/amd-sample-raw.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/amd-sample-raw.c b/tools/perf/util/amd-sample-raw.c
index 3e5530008b14..394c061fbeb3 100644
--- a/tools/perf/util/amd-sample-raw.c
+++ b/tools/perf/util/amd-sample-raw.c
@@ -22,6 +22,7 @@ static bool zen4_ibs_extensions;
static bool ldlat_cap;
static bool dtlb_pgsize_cap;
static bool rmtsocket_cap;
+static bool strmst_cap;
/*
* Status fields of IBS_FETCH_CTL and IBS_FETCH_CTL_EXT are valid only if
@@ -166,12 +167,15 @@ static void pr_ibs_op_data2_extended(union ibs_op_data2 reg)
};
int data_src = (reg.data_src_hi << 3) | reg.data_src_lo;
char rmtsocket[sizeof("RmtSocket _ ")] = "";
+ char strmst[sizeof("StrmSt _ ")] = "";
if (rmtsocket_cap)
snprintf(rmtsocket, sizeof(rmtsocket), "RmtSocket %d ", reg.rmt_socket);
+ if (strmst_cap)
+ snprintf(strmst, sizeof(strmst), "StrmSt %d ", reg.strm_st);
- printf("ibs_op_data2:\t%016llx %s%sRmtNode %d%s\n", reg.val,
- rmtsocket,
+ printf("ibs_op_data2:\t%016llx %s%s%sRmtNode %d%s\n", reg.val,
+ rmtsocket, strmst,
(data_src == 1 || data_src == 2 || data_src == 5) ?
(reg.cache_hit_st ? "CacheHitSt 1=O-State " : "CacheHitSt 0=M-state ") : "",
reg.rmt_node,
@@ -191,12 +195,15 @@ static void pr_ibs_op_data2_default(union ibs_op_data2 reg)
" DataSrc 7=Other"
};
char rmtsocket[sizeof("RmtSocket _ ")] = "";
+ char strmst[sizeof("StrmSt _ ")] = "";
if (rmtsocket_cap)
snprintf(rmtsocket, sizeof(rmtsocket), "RmtSocket %d ", reg.rmt_socket);
+ if (strmst_cap)
+ snprintf(strmst, sizeof(strmst), "StrmSt %d ", reg.strm_st);
- printf("ibs_op_data2:\t%016llx %s%sRmtNode %d%s\n", reg.val,
- rmtsocket,
+ printf("ibs_op_data2:\t%016llx %s%s%sRmtNode %d%s\n", reg.val,
+ rmtsocket, strmst,
reg.data_src_lo == 2 ? (reg.cache_hit_st ? "CacheHitSt 1=O-State "
: "CacheHitSt 0=M-state ") : "",
reg.rmt_node, data_src_str[reg.data_src_lo]);
@@ -443,6 +450,9 @@ bool evlist__has_amd_ibs(struct evlist *evlist)
if (perf_env__find_pmu_cap(env, "ibs_op", "rmtsocket"))
rmtsocket_cap = 1;
+ if (perf_env__find_pmu_cap(env, "ibs_op", "strmst"))
+ strmst_cap = 1;
+
if (ibs_fetch_type || ibs_op_type) {
if (!cpu_family)
parse_cpuid(env);
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 8/8] perf doc: Document new IBS capabilities in man page
2026-04-30 6:11 [PATCH v2 0/8] perf tools amd ibs: Fixes + Zen6 enhancements Ravi Bangoria
` (6 preceding siblings ...)
2026-04-30 6:11 ` [PATCH v2 7/8] perf amd ibs: Decode Streaming-store " Ravi Bangoria
@ 2026-04-30 6:11 ` Ravi Bangoria
7 siblings, 0 replies; 11+ messages in thread
From: Ravi Bangoria @ 2026-04-30 6:11 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers
Cc: Ravi Bangoria, Peter Zijlstra, Ingo Molnar, Dapeng Mi,
James Clark, x86, linux-perf-users, linux-kernel, Manali Shukla,
Santosh Shukla, Ananth Narayan, Sandipan Das
Include examples of
o Privilege filter with Fetch and Op PMUs, including swfilt approach on
Zen5 and older platforms and hardware assisted filter on Zen6 and newer
platforms
o Streaming store filter with Op PMU
o Fetch latency filter with Fetch PMU
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
---
tools/perf/Documentation/perf-amd-ibs.txt | 39 +++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/tools/perf/Documentation/perf-amd-ibs.txt b/tools/perf/Documentation/perf-amd-ibs.txt
index 548549935760..253a7375c88a 100644
--- a/tools/perf/Documentation/perf-amd-ibs.txt
+++ b/tools/perf/Documentation/perf-amd-ibs.txt
@@ -69,6 +69,14 @@ Per-cpu profile (cpu10), cycles event, sampling period: 100000
# perf record -e ibs_op// -c 100000 -C 10
+Userspace only, per-cpu profile (cpu10), cycles event, sampling period: 100000
+
+ Zen6 onward (See NOTES):
+ # perf record -e ibs_op//u -c 100000 -C 10
+
+ Until Zen5:
+ # perf record -e ibs_op/swfilt=1/u -c 100000 -C 10
+
Per-cpu profile (cpu10), cycles event, sampling freq: 1000
# perf record -e ibs_op// -F 1000 -C 10
@@ -94,6 +102,11 @@ onward)
Latency value which is a multiple of 128 incurs a little less profiling
overhead compared to other values.
+System-wide profile, cycles event, sampling period: 100000, streaming store
+filter (Zen6 onward)
+
+ # perf record -e ibs_op/strmst=1/ -c 100000 -a
+
Per process(upstream v6.2 onward), uOps event, sampling period: 100000
# perf record -e ibs_op/cnt_ctl=1/ -c 100000 -p 1234
@@ -150,6 +163,14 @@ System-wide profile, fetch ops event, sampling period: 100000
# perf record -e ibs_fetch// -c 100000 -a
+Userspace only, system-wide profile, fetch ops event, sampling period: 100000
+
+ Zen6 onward (See NOTES):
+ # perf record -e ibs_fetch//u -c 100000 -a
+
+ Until Zen5:
+ # perf record -e ibs_fetch/swfilt=1/u -c 100000 -a
+
System-wide profile, fetch ops event, sampling period: 100000, Random enable
# perf record -e ibs_fetch/rand_en=1/ -c 100000 -a
@@ -158,6 +179,15 @@ System-wide profile, fetch ops event, sampling period: 100000, Random enable
helps in cases like long running loops where PMU is tagging the same
instruction over and over because of fixed sample period.
+System-wide profile, fetch ops event, sampling period: 10000, fetch latency
+filter (Zen6 onward)
+
+ # perf record -e ibs_fetch/fetchlat=128/ -c 10000 -a
+
+ Supported fetch latency threshold values are 128 to 1920 (both inclusive).
+ Latency value which is a multiple of 128 incurs a little less profiling
+ overhead compared to other values.
+
etc.
PERF MEM AND PERF C2C
@@ -216,6 +246,15 @@ sort keys. For example:
Please refer to their man page for more detail.
+NOTES
+-----
+Hardware privilege filtering uses bit 63 to distinguish between kernel
+and userspace addresses. Hardware privilege filtering is not supported
+on 32-bit systems. Also, the bit 63 convention is not universal and can
+fail in specific environments, such as, using 64-bit host IBS to profile
+a 32-bit guest, using 64-bit host IBS to profile non-Linux 64-bit guests
+that do not adhere to the bit 63 privilege standard etc.
+
SEE ALSO
--------
--
2.43.0
^ permalink raw reply related [flat|nested] 11+ messages in thread