resctrl_arch_rmid_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the closid that matches the rmid. Depending on the architecture, the counter may match traffic of both closid and rmid, or rmid only. So like… architecture-dependent, no cap πŸ€·β€β™€οΈ
  • rmid β€” the rmid of the counter you wanna read. This is the one, the icon, the legend πŸ‘‘
  • eventid β€” the eventid to read, e.g. L3 occupancy. Pick your fighter πŸ₯Š
  • arch_priv β€” architecture private data for this event. This is the arch_priv that the architecture provided via resctrl_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 from resctrl_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:


πŸ“ 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