LIBPFM(3)

πŸŽ€ NAME πŸŽ€

Hii bestie πŸ’– so the page you're looking at is LIBPFM(3) from the Linux Programmer's Manual, and the star of this particular show is libpfm_intel_skx_unc_cha β€” the support for the Intel Skylake X Server CHA-Box uncore PMU. That's the whole vibe. ✨


✨ SYNOPSIS ✨

#include <perfmon/pfmlib.h>
  • PMU name: skx_unc_cha[0-27]
  • PMU desc: Intel Skylake X CHA uncore PMU

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, this library has your back for the Intel Skylake X CHA-Box uncore PMU β€” CHA being the coherency and home agent engine, iykyk. 🫢

Here's the tea: there is one CHA-box PMU per physical core. So that means there are up to twenty-eight identical CHA-Box PMU instances, numbered from 0 up to possibly 27. Twenty-eight. That's a lot of little guys. 😭

And on dual-socket systems? The number refers to the CHA-Box PMU on the socket where the program is running. Let's spell that out:

  • if you're running on CPU18, then skx_unc_cha0 refers to the CHA-Box for physical core 0 on socket 1
  • but if you're running on CPU0, then that same skx_unc_cha0 refers to the CHA-Box for physical core 0 but on socket 0

Same name, different socket, depending on where you are. Main character energy but make it socket-aware. πŸ’…

Each CHA-Box PMU implements 4 generic counters and two filter registers used only with certain events and umasks. Those filters get accessed either via modifiers (scroll down, bestie) or via umasks, like the opcode or cache state filter. 🌸


πŸ’– MODIFIERS πŸ’–

These are the modifiers supported on the Intel Skylake CHA-Box uncore PMU. Every single one, no skipping, periodt:

  • e β€” enable edge detection, i.e. count only when there's a state transition from no occurrence of the event to at least one occurrence. Lowkey important: this modifier must be combined with a threshold modifier (t) with a value greater or equal to one. It's a boolean modifier. βœ…
  • t β€” set the threshold value. When it's set to a non-zero value, the counter counts the number of C-Box cycles in which the number of occurrences of the event is greater or equal to the threshold. This is an integer modifier, values in the range [0:255]. πŸ”’
  • i β€” invert the meaning of the event. The counter will now count cycles in which the event is not occurring. Also a boolean modifier. πŸ™ƒ
  • loc β€” match on local node target. This filter is only supported on UNC_C_TOR_INSERTS and UNC_C_TOR_OCCUPANCY. It's a boolean filter. πŸ“
  • rem β€” match on remote node target. This filter is only supported on UNC_C_TOR_INSERTS and UNC_C_TOR_OCCUPANCY. boolean filter. πŸ“‘
  • lmem β€” match near memory cacheable. This filter is only supported on UNC_C_TOR_INSERTS and UNC_C_TOR_OCCUPANCY. boolean filter. 🧠
  • rmem β€” match not near memory cacheable. This filter is only supported on UNC_C_TOR_INSERTS and UNC_C_TOR_OCCUPANCY. boolean filter. 🚫🧠
  • nc β€” match non-coherent requests. This filter is only supported on UNC_C_TOR_INSERTS and UNC_C_TOR_OCCUPANCY. boolean filter. 🌊
  • isoc β€” match isochronous requests. This filter is only supported on UNC_C_TOR_INSERTS and UNC_C_TOR_OCCUPANCY. boolean filter. ⏱️

πŸ”₯ Opcode filtering πŸ”₯

Okay this part is giving precision, and honestly? Obsessed. 🎯

Events UNC_C_TOR_INSERTS and UNC_C_TOR_OCCUPANCY support opcode matching. The processor implements two opcode filters, and both are used at the same time. No picking favourites, they ride together. πŸ’ž

  • The OPC0 umasks correspond to the first opcode matcher.
  • OPC1 corresponds to the second opcode matcher.

If you only need to track one opcode, then the unused filter gets set to 0. Simple as that. ✨

⚠️ Heads up bestie, this is the part where the library will straight up reject you: the opcode umasks must be used in combination with a specific queue umask, otherwise the library rejects the event. Not a vibe. πŸ’€

The umask description shows which queue umask is required for each opcode. For instance, OPC0_RFO/OPC1_RFO require the IRQ queue and thus the IRQ umask. πŸ“¬

And the good news? The opcode match umasks can be combined with other modifiers. Mix and match, you're free. πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

This iconic work was brought to you by Stephane Eranian <eranian@gmail.com>. Give them their flowers. πŸ’


Okay that's the whole page, bestie! This one's from the Linux Programmer's Manual, version/date stamped January, 2018, and it lives at LIBPFM(3). Go forth and count those C-Box cycles. Slay. πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from