resctrl_arch_rmid_read(9)
π resctrl_arch_rmid_read(9) β Kernel API Manual π
okay so bestie, welcome to the glow-up page for resctrl_arch_rmid_read β it's a kernel API function and honestly it's giving "quietly important" main character energy. Let's get into it β¨
πΈ NAME πΈ
resctrl_arch_rmid_read β read the eventid counter corresponding to rmid for this resource and domain. That's it, that's the whole vibe π«Ά
β SYNOPSIS β
int resctrl_arch_rmid_read (struct rdt_resource *r , struct
rdt_domain_hdr *hdr , u32 closid , u32 rmid , enum resctrl_event_id
eventid , void *arch_priv , u64 *val , void *arch_mon_ctx );
Like, look at all those parameters. She's thriving π
π¦ ARGUMENTS π¦
rβ the resource you're pulling the counter from. Your source of truth, your origin story π«hdrβ header of the domain that the counter should be read from. Gotta know where you're reading, bestie.closidβ theclosidthat matches thermid. Depending on the architecture, the counter may match traffic of bothclosidandrmid, orrmidonly. So likeβ¦ architecture-dependent, no cap π€·ββοΈrmidβ thermidof the counter you wanna read. This is the one, the icon, the legend πeventidβ theeventidto read, e.g. L3 occupancy. Pick your fighter π₯arch_privβ architecture private data for this event. This is thearch_privthat the architecture provided viaresctrl_enable_mon_event. Very "iykyk" energy πvalβ the result of the counter read, in bytes. Slay, units matter πarch_mon_ctxβ an architecture specific value fromresctrl_arch_mon_ctx_alloc. For MPAM, this identifies the hardware monitor allocated for this read request. It's the lil hall pass for the hardware monitor ποΈ
π DESCRIPTION π
okay so here's the tea β β some architectures need to sleep when first programming some of the counters. and like, specifically? arm64's MPAM cache occupancy counters can return 'not ready' for a short period of time π so rude of them, honestly.
So the rule is: call this from a non-migrateable process context on a CPU that belongs to domain d. e.g. use smp_call_on_cpu or schedule_work_on. That's the correct, well-behaved way to do it π§
This function can be called with interrupts masked, e.g. using smp_call_function_any, but it may consistently return an error. So likeβ¦ technically allowed, but lowkey a trap π
π₯ RETURN π₯
0 on success, or -EIO, -EINVAL etc on error. That's the whole return section, she's short and she knows it π
π SEE ALSO π
Kernel file ./include/linux/resctrl.h plus the whole friend group:
enum resctrl_conf_type(9)struct resctrl_staged_config(9)struct rdt_domain_hdr(9)struct rdt_ctrl_domain(9)struct mbm_cntr_cfg(9)struct rdt_l3_mon_domain(9)struct resctrl_cache(9)enum membw_throttle_mode(9)struct resctrl_membw(9)enum resctrl_schema_fmt(9)struct resctrl_mon(9)struct rdt_resource(9)struct resctrl_schema(9)resctrl_arch_sync_cpu_closid_rmid(9)resctrl_get_default_ctrl(9)resctrl_arch_mon_event_config_write(9)resctrl_arch_mon_event_config_read(9)resctrl_arch_mbm_cntr_assign_enabled(9)resctrl_arch_mbm_cntr_assign_set(9)resctrl_arch_rmid_read_context_check(9)resctrl_find_domain(9)resctrl_arch_reset_rmid(9)resctrl_arch_reset_rmid_all(9)resctrl_arch_reset_all_ctrls(9)resctrl_arch_config_cntr(9)resctrl_arch_cntr_read(9)resctrl_arch_reset_cntr(9)resctrl_arch_io_alloc_enable(9)resctrl_arch_get_io_alloc_enabled(9)
π sign-off π
this little masterpiece lives under ./include/linux, and she was October 2026-coded ποΈβ¨ periodt, go read your counters responsibly bestie ππ¦πΈ
π¦ 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