STRUCT MSM_PERFCNTR_STREAM(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– struct msm_perfcntr_stream(9) ๐Ÿ’–

okay bestie, welcome to the Kernel API Manual โ€” section 9, no less. this page is all about struct msm_perfcntr_stream, and it's giving "state for a single open stream fd" energy. periodt. ๐Ÿซถ

๐ŸŒธ NAME ๐ŸŒธ

struct msm_perfcntr_stream - state for a single open stream fd. that's it, that's the name. โœจ

โœจ SYNOPSIS โœจ

       struct msm_perfcntr_stream {
           struct msm_gpu *gpu;
           struct hrtimer sample_timer;
           wait_queue_head_t poll_wq;
           uint64_t sample_period_ns;
           uint32_t nr_groups;
           uint32_t seqno;
           uint32_t sel_fence;
           struct work_struct sel_work;
           struct kthread_work sample_work;
           struct mutex read_lock;
           uint32_t *group_idx;
           struct circ_buf fifo;
           size_t fifo_size;
           size_t period_size;
        };

๐Ÿ’… Members ๐Ÿ’…

okay now the member-by-member vibe check. every field gets its moment. ๐Ÿ‘‘

  • gpu โ€” Back-link to the GPU. literally the GPS back to the GPU. ๐Ÿฆ‹
  • sample_timer โ€” Timer to sample counters. it's the clock bestie. โฐ
  • poll_wq โ€” Wait queue for waiting for OA data to be available. yes, the OA data has to show up before anyone gets to poll. ๐Ÿ’ค
  • sample_period_ns โ€” Sampling period. it's giving timing energy. โฑ๏ธ
  • nr_groups โ€” # of counter groups with enabled counters. not "number" โ€” it says "#" and I respect it. ๐Ÿ”ข
  • seqno โ€” counter for collected samples. keeping count, always. ๐Ÿงฎ
  • sel_fence โ€” Fence for SEL reg programming. a little fence, doing fence things. ๐Ÿšง
  • sel_work โ€” Worker for SEL reg programming.
important caveat time, bestie: Initial SEL reg programming (as opposed to restoring the SEL regs on runpm resume) must run on the same ordered wq as is used by drm_sched, to serialize it with GEM_SUBMITs written into the same ringbuffer. no cap, that serialization is the whole point. ๐Ÿ’€
  • sample_work โ€” Worker for collecting samples. get those samples, queen. ๐Ÿงบ
  • read_lock โ€” Fifo access is synchronied on the producer side by virtue of there being a single timer collecting samples and writing into the fifo. It is protected on the consumer side by read_lock. producer side? one timer, one fifo, that's the synchronization vibe. consumer side? read_lock has your back. ๐Ÿ”’
  • group_idx โ€” array of nr_groups.

it maps the order of groups in the PERFCNTR_CONFIG ioctl to group idx, so that results in the results stream can be ordered to match the ioctl call that setup the stream. yes, the ordering is matching on purpose. ๐ŸŽฏ

  • fifo โ€” circular buffer for samples. it's a circle, it's a buffer, it's for samples. ๐ŸŒ€
  • fifo_size โ€” circular buffer size. how big is the circle? this big. ๐Ÿ“
  • period_size โ€” size of data for single sampling period. one period, one size. ๐Ÿ’ซ

๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

  • Kernel file ./drivers/gpu/drm/msm/msm_perfcntr.h, plus struct msm_perfcntr_context_state(9). go read those too, bestie. ๐Ÿ“š

mwah ๐Ÿ’‹ โ€” this page lives at ./drivers/gpu/drm/msm, dated October 2026, and it's all about struct msm_perfcntr_stream(9). slay. ๐ŸŽ€

๐Ÿ“ฆ where this page comes from