trace_hwlat.c (f8bade6c9a6213c2c5ba6e5bf32415ecab6e41e5) trace_hwlat.c (f2cc020d7876de7583feb52ec939a32419cf9468)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * trace_hwlat.c - A simple Hardware Latency detector.
4 *
5 * Use this tracer to detect large system latencies induced by the behavior of
6 * certain underlying system hardware or firmware, independent of Linux itself.
7 * The code was developed originally to detect the presence of SMIs on Intel
8 * and AMD systems, although there is no dependency upon x86 herein.

--- 69 unchanged lines hidden (view full) ---

78/* Individual latency samples are stored here when detected. */
79struct hwlat_sample {
80 u64 seqnum; /* unique sequence */
81 u64 duration; /* delta */
82 u64 outer_duration; /* delta (outer loop) */
83 u64 nmi_total_ts; /* Total time spent in NMIs */
84 struct timespec64 timestamp; /* wall time */
85 int nmi_count; /* # NMIs during this sample */
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * trace_hwlat.c - A simple Hardware Latency detector.
4 *
5 * Use this tracer to detect large system latencies induced by the behavior of
6 * certain underlying system hardware or firmware, independent of Linux itself.
7 * The code was developed originally to detect the presence of SMIs on Intel
8 * and AMD systems, although there is no dependency upon x86 herein.

--- 69 unchanged lines hidden (view full) ---

78/* Individual latency samples are stored here when detected. */
79struct hwlat_sample {
80 u64 seqnum; /* unique sequence */
81 u64 duration; /* delta */
82 u64 outer_duration; /* delta (outer loop) */
83 u64 nmi_total_ts; /* Total time spent in NMIs */
84 struct timespec64 timestamp; /* wall time */
85 int nmi_count; /* # NMIs during this sample */
86 int count; /* # of iteratons over threash */
86 int count; /* # of iterations over thresh */
87};
88
89/* keep the global state somewhere. */
90static struct hwlat_data {
91
92 struct mutex lock; /* protect changes */
93
94 u64 count; /* total since reset */

--- 289 unchanged lines hidden (view full) ---

384
385 hwlat_kthread = kthread;
386 wake_up_process(kthread);
387
388 return 0;
389}
390
391/**
87};
88
89/* keep the global state somewhere. */
90static struct hwlat_data {
91
92 struct mutex lock; /* protect changes */
93
94 u64 count; /* total since reset */

--- 289 unchanged lines hidden (view full) ---

384
385 hwlat_kthread = kthread;
386 wake_up_process(kthread);
387
388 return 0;
389}
390
391/**
392 * stop_kthread - Inform the hardware latency samping/detector kthread to stop
392 * stop_kthread - Inform the hardware latency sampling/detector kthread to stop
393 *
394 * This kicks the running hardware latency sampling/detector kernel thread and
395 * tells it to stop sampling now. Use this on unload and at system shutdown.
396 */
397static void stop_kthread(void)
398{
399 if (!hwlat_kthread)
400 return;

--- 244 unchanged lines hidden ---
393 *
394 * This kicks the running hardware latency sampling/detector kernel thread and
395 * tells it to stop sampling now. Use this on unload and at system shutdown.
396 */
397static void stop_kthread(void)
398{
399 if (!hwlat_kthread)
400 return;

--- 244 unchanged lines hidden ---