Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize --list-events #312

Closed
cvonelm opened this issue Dec 11, 2023 · 2 comments
Closed

Optimize --list-events #312

cvonelm opened this issue Dec 11, 2023 · 2 comments

Comments

@cvonelm
Copy link
Member

cvonelm commented Dec 11, 2023

On a recent Intel systems there can be over 890 PMU events, making --list-events take one and a half minutes to load, which is unacceptable, really.

There should hopefully be some way to get it go fast.

@cvonelm
Copy link
Member Author

cvonelm commented Feb 6, 2024

Apparently, this is caused by the kernel. Everytime perf_event_open is called (which is a lot for --list-events as we check if we can perf_event_open every PMU event) the kernel has to reallocate the memory for asynchronous event recording using PEBS. Due to what looks like a livelock/deadlock siituation, this memory allocation can take almost a second, which for hundreds of events with hundreds of perf_event_open's adds up quite a lot.

I personally think we can do away with the perf_event_open()-ing checks, as I think they are overtly paranoid:

  1. Whether events are only openable per-process only depends on the value of perf_event_paranoid. If it is greater than 0, then only per-process measurements are allowed.
  2. Which CPUs an event can be opened on, can be read from the cpus or cpumask files in /sys/bus/event_source

This should of course be tested by comparing what cpus, cpumask and perf_event_paranoid report for event openability and where the events can actually be opened.

@cvonelm
Copy link
Member Author

cvonelm commented May 31, 2024

I can not recreate this on Intel Xeon Max 9468 or Core i9-12900K anymore, so I presume that the underlying problem for the perf_event_open slowness has been fixed in subsequent kernel releases. Closing the issue for now.

@cvonelm cvonelm closed this as completed May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant