RE: Some unc_cha_tor_* events appear to be "not supported"?

From: Wang, Weilin
Date: Thu Jul 25 2024 - 13:52:49 EST




> -----Original Message-----
> From: Ian Rogers <irogers@xxxxxxxxxx>
> Sent: Thursday, July 25, 2024 10:00 AM
> To: Song Liu <song@xxxxxxxxxx>; Wang, Weilin <weilin.wang@xxxxxxxxx>;
> Taylor, Perry <perry.taylor@xxxxxxxxx>
> Cc: Liang, Kan <kan.liang@xxxxxxxxxxxxxxx>; Arnaldo Carvalho de Melo
> <acme@xxxxxxxxxx>; Hunter, Adrian <adrian.hunter@xxxxxxxxx>; linux-perf-
> users@xxxxxxxxxxxxxxx; open list <linux-kernel@xxxxxxxxxxxxxxx>; Namhyung
> Kim <namhyung@xxxxxxxxxx>; Jiri Olsa <jolsa@xxxxxxxxxx>; jonesz@xxxxxxxx
> Subject: Re: Some unc_cha_tor_* events appear to be "not supported"?
>
> On Thu, Jul 25, 2024 at 9:39 AM Song Liu <song@xxxxxxxxxx> wrote:
> >
> > Hi Kan,
> >
> > Thanks for your quick response!
> >
> > On Thu, Jul 25, 2024 at 6:37 AM Liang, Kan <kan.liang@xxxxxxxxxxxxxxx>
> wrote:
> > >
> > >
> > >
> > > On 2024-07-24 6:39 p.m., Song Liu wrote:
> > > > Hi folks,
> > > >
> > > > We noticed that some unc_cha_tor_occupancy and unc_cha_tor_inserts
> events
> > > > appear to be "not supported" and always counting zero (see an example
> below).
> > > > Is this a known issue? We are testing with 6.10 kernel and perf.
> > > >
> > > > Thanks,
> > > > Song
> > > >
> > > >
> > > > [root@kerneltest008.05.atn6 ~]# ./perf list | grep
> > > > unc_cha_tor_occupancy.ia_hit_llcprefdrd
> > > > unc_cha_tor_occupancy.ia_hit_llcprefdrd
> > > > [root@kerneltest008.05.atn6 ~]# ./perf stat -e
> > > > unc_cha_tor_occupancy.ia_hit_llcprefdrd -a -- sleep 1
> > > > WARNING: event 'N/A' not valid (bits 10,12-13,15 of config1 '4b433'
> > >
> > >
> > > The value '4b433' is for the 'Filter1', according to the original event
> > > list.
> > >
> > >
> https://github.com/intel/perfmon/blob/main/SKX/events/skylakex_uncore.js
> on#L4634
> > >
> > > "EventName": "UNC_CHA_TOR_OCCUPANCY.IA_MISS_LlcPrefDRD",
> > > "BriefDescription":
> "UNC_CHA_TOR_OCCUPANCY.IA_MISS_LlcPrefDRD",
> > > "PublicDescription":
> "UNC_CHA_TOR_OCCUPANCY.IA_MISS_LlcPrefDRD",
> > > "Counter": "0",
> > > "MSRValue": "0x00",
> > > "ELLC": "0",
> > > "Filter": "Filter1",
> > > "ExtSel": "0",
> > > "Deprecated": "0",
> > > "FILTER_VALUE": "0x4b433"
> > >
> > > There are two filters for CHA on SKX. Each filter is 32 bits wide.
> > > So the Linux kernel driver uses config1 (64 bits wide) to represent both
> > > of them. The low 32 bits are for filter0 and high 32 bits are for filter1.
> > >
> > > It should be an issue of the convert script, which set the filter1 value
> > > to the low 32 bits.
> > >
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/
> perf/pmu-events/arch/x86/skylakex/uncore-cache.json#n4489
> > >
> > > Can you please try the below event?
> > > uncore_cha/event=0x35,umask=0x11,config1=0x4b43300000000/
> >
> > This appears to work. I also tried events like:
> >
> >
> uncore_cha/UNC_CHA_TOR_OCCUPANCY.IA_MISS,config1=0x40432000000
> 00/
> >
> uncore_cha/UNC_CHA_TOR_INSERTS.IA_MISS,config1=0x4043200000000/
> >
> > Do you have an idea on how to fix the convert script? I haven't looked
> > into these codes.
>
> The converter script logic is here:
> https://github.com/intel/perfmon/blob/main/scripts/create_perf_json.py#L3
> 95
> but presumably this worked at some point or is needed on other models.
> Checking the perf json I see:
> ```
> $ grep -rl config1 tools/perf/pmu-events/arch/x86/
> tools/perf/pmu-events/arch/x86/snowridgex/uncore-cache.json
> tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json
> tools/perf/pmu-events/arch/x86/skylakex/uncore-cache.json
> tools/perf/pmu-events/arch/x86/cascadelakex/uncore-cache.json
> tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json
> ```
> Since CLX is near equal to SKX, and the metrics will presumably be
> false hits, perhaps shifting this value will break snowridgex - I have
> no such machine to test on.
>
> Using config1 values rather than formats is odd to me. On a SkylakeX I see:
> ```
> $ grep -r config1 /sys/devices/uncore_cha_0/format/
> /sys/devices/uncore_cha_0/format/filter_rem:config1:32
> /sys/devices/uncore_cha_0/format/filter_opc0:config1:41-50
> /sys/devices/uncore_cha_0/format/filter_isoc:config1:63
> /sys/devices/uncore_cha_0/format/filter_tid:config1:0-8
> /sys/devices/uncore_cha_0/format/filter_loc:config1:33
> /sys/devices/uncore_cha_0/format/filter_nc:config1:62
> /sys/devices/uncore_cha_0/format/filter_opc1:config1:51-60
> /sys/devices/uncore_cha_0/format/filter_all_op:config1:35
> /sys/devices/uncore_cha_0/format/filter_not_nm:config1:37
> /sys/devices/uncore_cha_0/format/filter_state:config1:17-26
> /sys/devices/uncore_cha_0/format/filter_nm:config1:36
> ```
>
> Adding Weilin and Perry as I'm unsure what the right fix should be. My
> thought is the input Intel perfmon json should break apart the filter
> value into opcodes, etc. and then in the converter script we add these
> to perf events like filter_opc0=0xb4.
>

Adding Ed and Dilip for event related questions. I can follow up to update the
converter script once we are clear about the content we need/could provide
in event JSON.

Thanks,
Weilin

> Thanks,
> Ian
>
> > Thanks,
> > Song
> >
> > [...]