tracing: Initial hwlat_detector code from the -rt patch
The hwlat_detector is a special purpose kernel module that is used to
detect large system latencies induced by the behavior of certain
underlying hardware or firmware, independent of Linux itself. This code
was developed originally to detect SMIs (System Managment Interrupts) on
x86 systems, however there is nothing x86 specific about this patchset.
It was originally written for use by the "RT" patch since the Real Time
kernel is highly latency sensitive.
SMIs are not serviced by the Linux kernel, which typically does not even
know that they are occuring. SMIs are instead are set up by BIOS code and
are serviced by BIOS code, usually for "critical" events such as
management of thermal sensors and fans. Sometimes though, SMIs are used
for other tasks and those tasks can spend an inordinate amount of time in
the handler (sometimes measured in milliseconds). Obviously this is a
problem if you are trying to keep event service latencies down in the
microsecond range.
The hardware latency detector works by hogging all of the cpus for
configurable amounts of time (by calling stop_machine()), polling the CPU
Time Stamp Counter for some period, then looking for gaps in the TSC data.
Any gap indicates a time when the polling was interrupted and since the
machine is stopped and interrupts turned off the only thing that could do
that would be an SMI.
Note that the SMI detector should *NEVER* be used in a production
environment. It is intended to be run manually to determine if the
hardware platform has a problem with long system firmware service
routines.
Signed-off-by: Jon Masters <jcm@redhat.com>
[
Modified the original hwlat_detector that is in the -rt patch and
prepared it to become an ftrace tracer.
This code can compile, but is not yet part of the build system.
This patch is only made to give the authorship to Jon Masters.
I did modify some of the code that was in the -rt patch, namely replaced
stop_machine with a kthread that disables interrupts. I also added
the outer loop code to look for latencies when it's figuring out if
a latency happened.
Later code will be added to make it into a full fledge tracer.
-- Steven Rostedt
]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 file changed