Re: [PATCH] perf/amd/ibs: add phy_addr_only software filter for ibs_op
From: Ravi Bangoria
Date: Fri Oct 30 2026 - 00:15:41 EST
Huang,
>> Can you please confirm if those additional samples are genuinely valid.
>
> Yes.
> To answer this properly I re-ran the mysql test,
> and verified the physical address of every captured sample against
> the System RAM ranges in /proc/iomem.
>
> Setup: 384-CPU Hygon box, v7.3-based kernel, MySQL 8 under sysbench
> oltp_read_only, 400 threads. Each round is a fresh 60s
> sysbench run; after 15s of warmup, perf records ibs_op for 3s:
>
> $ perf record -e ibs_op/phy_addr_only=1/ -c 100000 --phys-data \
> -p <mysqld> # my patch
> $ perf record -e ibs_op// --phys-data --filter 'phys_addr != 0' \
> -c 100000 -p <mysqld> # your suggestion
>
> Rounds alternate p1 -> b1 -> p2 -> b2 -> p3 -> b3 so both methods see
> the same load conditions. Each record's phys_addr is then dumped with
> "perf script -F pid,tid,phys_addr" and bisect-checked against the
> System RAM ranges (read from /proc/iomem as root).
>
> samples phys_addr==0 non-zero in
> round filter captured (valid=1,MSR=0) System RAM
> ----- -------- --------- --------------- -----------
> p1 phy_only 15710042 0.10 % 98.61 %
> b1 bpf 14041851 0.00 % 98.55 %
> p2 phy_only 15580497 0.10 % 98.56 %
> b2 bpf 15416187 0.00 % 98.58 %
> p3 phy_only 15732582 0.10 % 98.59 %
> b3 bpf 15447397 0.00 % 98.58 %
>
> Two observations:
> 1. The validity ratio is identical for both methods. Of the non-zero
> addresses phy_addr_only delivers, 98.6 % fall inside System RAM --
> the same ratio the BPF-filtered set shows.
>
> 2. The only set-level difference is 0.10 % of samples where
> dc_phy_addr_valid is set but IBSDCPHYSAD reads 0.
The BPF filter is giving more accurate data here because neither kernel
nor userspace should access the first physical page:
$ sudo head -1 /proc/iomem
00000000-00000fff : Reserved
Thanks,
Ravi