Commit 411b2e36 authored by Stephen Rothwell's avatar Stephen Rothwell

Merge commit 'hwlat/for-linus'

parents 3dec6fcf a2c8b6b9
Introduction:
-------------
The module 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. The code was developed
originally to detect SMIs (System Management 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 usually 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.
Usage:
------
Loading the module hwlat_detector passing the parameter "enabled=1" (or by
setting the "enable" entry in "hwlat_detector" debugfs toggled on) is the only
step required to start the hwlat_detector. It is possible to redefine the
threshold in microseconds (us) above which latency spikes will be taken
into account (parameter "threshold=").
Example:
# modprobe hwlat_detector enabled=1 threshold=100
After the module is loaded, it creates a directory named "hwlat_detector" under
the debugfs mountpoint, "/debug/hwlat_detector" for this text. It is necessary
to have debugfs mounted, which might be on /sys/debug on your system.
The /debug/hwlat_detector interface contains the following files:
count - number of latency spikes observed since last reset
enable - a global enable/disable toggle (0/1), resets count
max - maximum hardware latency actually observed (usecs)
sample - a pipe from which to read current raw sample data
in the format <timestamp> <latency observed usecs>
(can be opened O_NONBLOCK for a single sample)
threshold - minimum latency value to be considered (usecs)
width - time period to sample with CPUs held (usecs)
must be less than the total window size (enforced)
window - total period of sampling, width being inside (usecs)
By default we will set width to 500,000 and window to 1,000,000, meaning that
we will sample every 1,000,000 usecs (1s) for 500,000 usecs (0.5s). If we
observe any latencies that exceed the threshold (initially 100 usecs),
then we write to a global sample ring buffer of 8K samples, which is
consumed by reading from the "sample" (pipe) debugfs file interface.
...@@ -2263,6 +2263,15 @@ W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/ ...@@ -2263,6 +2263,15 @@ W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/
S: Maintained S: Maintained
F: drivers/hwmon/hdaps.c F: drivers/hwmon/hdaps.c
HARDWARE LATENCY DETECTOR
P: Jon Masters
M: jcm@jonmasters.org
W: http://www.kernel.org/pub/linux/kernel/people/jcm/hwlat_detector/
S: Supported
L: linux-kernel@vger.kernel.org
F: Documentation/hwlat_detector.txt
F: drivers/misc/hwlat_detector.c
HYPERVISOR VIRTUAL CONSOLE DRIVER HYPERVISOR VIRTUAL CONSOLE DRIVER
L: linuxppc-dev@ozlabs.org L: linuxppc-dev@ozlabs.org
S: Odd Fixes S: Odd Fixes
......
...@@ -76,6 +76,35 @@ config IBM_ASM ...@@ -76,6 +76,35 @@ config IBM_ASM
information on the specific driver level and support statement information on the specific driver level and support statement
for your IBM server. for your IBM server.
config HWLAT_DETECTOR
tristate "Testing module to detect hardware-induced latencies"
depends on DEBUG_FS
depends on RING_BUFFER
default m
---help---
A simple hardware latency detector. Use this module to detect
large latencies introduced by the behavior of the underlying
system firmware external to Linux. We do this using periodic
use of stop_machine to grab all available CPUs and measure
for unexplainable gaps in the CPU timestamp counter(s). By
default, the module is not enabled until the "enable" file
within the "hwlat_detector" debugfs directory is toggled.
This module is often used to detect SMI (System Management
Interrupts) on x86 systems, though is not x86 specific. To
this end, we default to using a sample window of 1 second,
during which we will sample for 0.5 seconds. If an SMI or
similar event occurs during that time, it is recorded
into an 8K samples global ring buffer until retreived.
WARNING: This software should never be enabled (it can be built
but should not be turned on after it is loaded) in a production
environment where high latencies are a concern since the
sampling mechanism actually introduces latencies for
regular tasks while the CPU(s) are being held.
If unsure, say N
config PHANTOM config PHANTOM
tristate "Sensable PHANToM (PCI)" tristate "Sensable PHANToM (PCI)"
depends on PCI depends on PCI
......
...@@ -21,5 +21,6 @@ obj-$(CONFIG_HP_ILO) += hpilo.o ...@@ -21,5 +21,6 @@ obj-$(CONFIG_HP_ILO) += hpilo.o
obj-$(CONFIG_ISL29003) += isl29003.o obj-$(CONFIG_ISL29003) += isl29003.o
obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o obj-$(CONFIG_EP93XX_PWM) += ep93xx_pwm.o
obj-$(CONFIG_C2PORT) += c2port/ obj-$(CONFIG_C2PORT) += c2port/
obj-$(CONFIG_HWLAT_DETECTOR) += hwlat_detector.o
obj-y += eeprom/ obj-y += eeprom/
obj-y += cb710/ obj-y += cb710/
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment