STRUCT MSM_PERFCNTR_STATE(9)
π struct msm_perfcntr_state(9) β the whole global perfcntr vibe
okay bestie, so this is a page from the Kernel API Manual β section 9, kernel API, we love a niche corner of the docs β¨ β and today's main character is struct msm_perfcntr_state, which is the overall global perfcntr state. that's the whole assignment. she's global, she's a struct, she holds the perfcntr situation together. periodt π
π SYNOPSIS π
like, literally, this is her:
struct msm_perfcntr_state {
struct msm_perfcntr_stream *stream;
uint32_t sel_seqno;
struct msm_perfcntr_group_state *groups[];
};
no cap, that's it. three fields and a lot of responsibility π«Ά
πΈ Members πΈ
okay let's go field by field, i'm obsessed with each of them:
streamβ the current global counter stream, but only if active bestie. if it's not active, she's not streaming, that's the whole point πsel_seqnoβ a counter forsel_fence. that's her job. counting. for the fence. iconic behavior honestly βgroupsβ the Global perfcntr stream group state</> π¦ that's the state of the stream groups, globally. yes queen.
π§ the lore (a.k.a. why she exists like this)
so, conceptually, this thing is part of msm_perfcntr_stream state. like emotionally, she belongs to the stream. but she doesn't live there, because she's statically pre-allocated when the gpu is initialized β and the reason is genuinely so real:
it simplifies error path cleanup in the PERFCNTR_CONFIG ioctl π because as the docs literally put it: __free(kfree) doesn't really help with variable length arrays of allocated pointers. and that's the truth, ngl. the cleanup would be a whole mess, so we just don't go there. static allocation. slay.
lowkey important: the "conceptually part of msm_perfcntr_stream state" thing is the actual explanation from the page β she's not physically in that struct, she's just spiritually adjacent, and the pre-allocation at gpu init is why. iykyk π
π₯ SEE ALSO π₯
go read these next, bestie, they're the friend group:
- Kernel file
./drivers/gpu/drm/msm/msm_gpu.hβ the file, yes, the whole file, go look at it π struct msm_gpu_devfreq(9)struct msm_perfcntr_group_state(9)struct msm_context(9)msm_context_is_vmbind(9)msm_gpu_convert_priority(9)struct msm_gpu_submitqueue(9)
read them in order or don't, we don't gatekeep π
mwah π this page lives in ./drivers/gpu/drm/msm, it's from October 2026, and it's the struct msm_perfcntr_state(9) page β tag yourself, i'm the variable length array of allocated pointers that nobody wants to free πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms