Following the series started with Markus Metzger ds.c interface, I
would like to report that I have now successfully
connected perfmon to Roland McGrath's utrace interface using 2.6.25 +
Utrace is an internal kernel subsystem which makes it easy to control
user threads and trace events such as fork, exec, signals.
In particular it provides an interface to stop and resume user threads
(quiesce). This is a key property for perfmon as certain
syscalls need to operate on the PMU state, e.g. pfm_write_pmcs(). A
thread can either be the current thread in
which case the operation is trivial. But it can be another thread, in
which case, the thread must be stopped before its
machine can be modified. In the current code base, perfmon does not
internally stop a thread when it detects
non self-monitoring. Some syscalls fail unless the application has
stopped the thread using the ptrace() interface.
Utrace allows perfmon to internally stop the thread if necessary,
which is not a trivial operation. Utrace is not a user
interface. The ptrace() interface can be built on top of utrace. That
means that a utrace kernel can support existing perfmon
applications which are using ptrace(). But new per-thread tools can
now call perfmon directly without using ptrace() to stop/resume
threads. That can greatly simplify writing per-thread tools. I have
not yet measured the performance impact of that when the
context is attached.
Overall, I found the utrace interface very easy to use. It provides a
nice improvement to perfmon.
I will add the support as an option for the 2.6.26 kernel patch.
Get latest updates about Open Source Projects, Conferences and News.