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

Add support for direct rdpmc access #7

Open
jimblandy opened this issue Jul 19, 2020 · 1 comment
Open

Add support for direct rdpmc access #7

jimblandy opened this issue Jul 19, 2020 · 1 comment

Comments

@jimblandy
Copy link
Owner

The perf_event_mmap_page structure permits direct access to hardware performance monitoring counters, via the index field, protected by a sequence lock. We could use this to provide extremely light-weight measurement APIs.

(I have never tried this, but @eddyb says they're going to try it out.)

@jimblandy
Copy link
Owner Author

jimblandy commented Jul 19, 2020

Possibly relevant:
Can SeqLocks Get Along With Programming Language Memory Models?

tl;dr: SeqLock code like that shown in the rdpmc example code on the perf_event_open man page, use non-atomic speculative racing loads, which are UB in Rust. They'll need to become atomic reads, at least.

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