STRUCT MSM_PERFCNTR_CONTEXT_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ struct msm_perfcntr_context_state(9) πŸ’œ

ok okay so this is a Kernel API Manual page, section 9, all about struct msm_perfcntr_context_state β€” the per-msm_context counter state. yes bestie, we're going deep into the DRM/msm mines today, grab a lil snack πŸ“


✨ NAME ✨

struct msm_perfcntr_context_state β€” literally the per-msm_context counter state, that's the whole vibe πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

struct msm_perfcntr_context_state {
    unsigned dummy;
    unsigned reserved_counters[];
};

look at her. small. mighty. flexible array at the end. iconic behavior ngl πŸ‘‘


🌸 Members 🌸

the little guys inside

  • dummy β€” a whole unsigned just existing as structural support, because some compilers simply cannot handle a struct that's only a flex array 😭 like they throw a fit. so dummy is here to keep the peace. main character energy honestly 🫢
  • reserved_counters β€” the number of reserved counters, indexed by perfcntr group. that's the index, that's the data, no cap πŸ“Š

πŸ¦‹ Description πŸ¦‹

ok so listen, a given counter can be in one of three states, and this is the whole plot:

  1. it can be completely unused β€” just chilling, not doing anything 🌈
  2. it can be reserved for global counter collection exclusively β€” like, only for that, don't even try it
  3. it can be reserved for local per-context counter collection inclusively β€” the inclusive bestie version πŸ’–

and here's the slay: multiple contexts can reserve the same counter at the same time. not a bug. not a fight. because SEL reg programming and counter begin/end sampling happen locally β€” meaning within a single GEM_SUBMIT ioctl πŸ”₯ so everyone's doing their own thing in their own little sandbox and nobody's stepping on anybody. periodt.

ngl this is the kind of design decision that makes you go "ohhhh" out loud πŸ™ˆ

⭐ SEE ALSO ⭐

  • Kernel file ./drivers/gpu/drm/msm/msm_perfcntr.h β€” go read it, it's right there, it's giving source-of-truth 🧚
  • struct msm_perfcntr_stream(9) β€” the sibling, the companion, the other one you also need πŸ’€

and that's the whole page bestie!! πŸ’…βœ¨ this one lives in ./drivers/gpu/drm/msm and it's dated October 2026, so like... future vibes fr fr πŸ•°οΈπŸ’œ love that for us. now go read msm_perfcntr_stream(9) too, i'm not asking πŸŽ€

πŸ“¦ where this page comes from