为什么与 LLC 相关的性能事件在 perf 中共享相同的事件 ID?

Why LLC related performance events share the same event id in perf?

提问人:Frontier_Setter 提问时间:4/14/2023 更新时间:4/14/2023 访问量:46

问:

我使用的是英特尔 spr 架构,内核版本为 5.14,性能版本为 4.18。

我试着根据这个答案中的方法分析LLC相关事件的含义,但发现所有事件都有相同的ID:

[ C(LL  ) ] = {
  [ C(OP_READ) ] = {
    [ C(RESULT_ACCESS) ] = 0x12a,
    [ C(RESULT_MISS)   ] = 0x12a,
  },
  [ C(OP_WRITE) ] = {
    [ C(RESULT_ACCESS) ] = 0x12a,
    [ C(RESULT_MISS)   ] = 0x12a,
  },
},

此外,我检查了英特尔的 perfmon,发现许多事件共享相同的事件代码和 umask,仅通过 MSRValue 进行区分。

{
  "EventCode": "0x2A,0x2B",        <== same
  "UMask": "0x01",                 <== same
  "EventName": "OCR.DEMAND_DATA_RD.ANY_RESPONSE",
  "BriefDescription": "Counts demand data reads that have any type of response.",
  "PublicDescription": "Counts demand data reads that have any type of response.",
  "Counter": "0,1,2,3",
  "PEBScounters": "0",
  "SampleAfterValue": "100003",
  "MSRIndex": "0x1a6,0x1a7",
  "MSRValue": "0x10001",         <== different
  "CollectPEBSRecord": "0",
  "TakenAlone": "0",
  "CounterMask": "0",
  "Invert": "0",
  "EdgeDetect": "0",
  "PEBS": "0",
  "Data_LA": "0",
  "L1_Hit_Indication": "0",
  "Errata": "null",
  "Offcore": "1",
  "Deprecated": "0",
  "Speculative": "0"
},
{
  "EventCode": "0x2A,0x2B",
  "UMask": "0x01",
  "EventName": "OCR.DEMAND_RFO.ANY_RESPONSE",
  "BriefDescription": "Counts demand reads for ownership (RFO) requests and software prefetches for exclusive ownership (PREFETCHW) that have any type of response.",
  "PublicDescription": "Counts demand reads for ownership (RFO) requests and software prefetches for exclusive ownership (PREFETCHW) that have any type of response.",
  "Counter": "0,1,2,3",
  "PEBScounters": "0",
  "SampleAfterValue": "100003",
  "MSRIndex": "0x1a6,0x1a7",
  "MSRValue": "0x3F3FFC0002",
  "CollectPEBSRecord": "0",
  "TakenAlone": "0",
  "CounterMask": "0",
  "Invert": "0",
  "EdgeDetect": "0",
  "PEBS": "0",
  "Data_LA": "0",
  "L1_Hit_Indication": "0",
  "Errata": "null",
  "Offcore": "1",
  "Deprecated": "0",
  "Speculative": "0"
},
...

在这种情况下,我应该如何区分 perfmon 数组中的哪个条目对应于 perf 中的每个 LLC 相关事件?

缓存 CPU-Architecture Perf Intel-PMU

评论

0赞 Margaret Bloom 4/15/2023
非核事件的测量方式是,像往常一样或多或少地对 PERFEVTSEL 寄存器进行编程,并对OFFCORE_RSP寄存器进行额外编程。后者过滤计数的请求和响应的类型,以便可以区分共享相同事件代码的各种事件。所以我认为你需要对内核进行更多的挖掘,看看这些事件对应于什么。
0赞 Frontier_Setter 4/17/2023
@MargaretBloom 在这种情况下,我应该如何在perf中以原始事件的形式指定对应的事件?喜欢 -e rXXX

答: 暂无答案