Hacker News new | ask | show | jobs
by mikeyen 4590 days ago
Does anyone know if any mmap support can be added in .ko to allow for read, write of msr be done via pointer dereferencing instead of ioctl?

I think that is be much less overhead for profiling if possible.

2 comments

While this can be done for the uncore PCI counters, I don't think there is any reasonable way to do this for the MSRs. And you'd still be relying on the kernel to service your request since 'wrmsr' and 'rdmsr' can only be executed from Ring 0 (kernel mode).

But if your goal is to reduce overhead, you can read the performance counters with 'rdpmc', which can be configured to be usable from Ring 3 (user level). This is a route that I'm currently pursuing. More details in some of the messages here: https://groups.google.com/forum/#!forum/likwid-developers

This link about mapping PCI configuration space to be accessible to non-root users might be useful too: http://www.cs.usfca.edu/~cruse/cs698f11/uhci.c

How would that work? The MSRs are _not_ memory mapped.