x86_perf_rdpmc_index(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, this is the x86_perf_rdpmc_index(9) page from the Kernel API Manual πŸ’– and it's short, but the safety note is important important, so stay with me.

🌸 NAME 🌸

x86_perf_rdpmc_index β€” return the PMC counter used for event ✨

✨ SYNOPSIS ✨

int x86_perf_rdpmc_index (struct perf_event *event );

πŸŽ€ ARGUMENTS πŸŽ€

  • event β€” the perf_event to which the PMC counter was assigned 🫢

πŸ’… DESCRIPTION πŸ’…

okay so here's the tea β˜•: the counter assigned to this performance event may change if interrupts are enabled 😭. so this counter should never be used while interrupts are enabled β€” periodt, no cap. 🚨

before this function is used to obtain the assigned counter, the event should be checked for validity β€” using, for example, perf_event_read_local β€” and that check needs to happen within the same interrupt disabled section in which this counter is planned to be used. iykyk πŸ’…

🫢 RETURN 🫢

The index of the performance monitoring counter assigned to perf_event πŸ’–

πŸ”₯ SEE ALSO πŸ”₯

  • Kernel file ./arch/x86/events/core.c β€” go look, bestie 🌈

xoxo πŸ’– source/version: ./arch/x86/events Β· date: October 2026

πŸ“¦ where this page comes from