]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/trace/trace_hwlat.c
Merge branch 'work.vboxsf' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux.git] / kernel / trace / trace_hwlat.c
index 862f4b0139fcb33bf0902fcd635c9bd6f440522c..a48808c4324917cb150f749a85b3474a57e23d83 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * trace_hwlatdetect.c - A simple Hardware Latency detector.
+ * trace_hwlat.c - A simple Hardware Latency detector.
  *
  * Use this tracer to detect large system latencies induced by the behavior of
  * certain underlying system hardware or firmware, independent of Linux itself.
@@ -104,7 +104,7 @@ static void trace_hwlat_sample(struct hwlat_sample *sample)
 {
        struct trace_array *tr = hwlat_trace;
        struct trace_event_call *call = &event_hwlat;
-       struct ring_buffer *buffer = tr->trace_buffer.buffer;
+       struct trace_buffer *buffer = tr->array_buffer.buffer;
        struct ring_buffer_event *event;
        struct hwlat_entry *entry;
        unsigned long flags;
@@ -237,6 +237,7 @@ static int get_sample(void)
        /* If we exceed the threshold value, we have found a hardware latency */
        if (sample > thresh || outer_sample > thresh) {
                struct hwlat_sample s;
+               u64 latency;
 
                ret = 1;
 
@@ -253,11 +254,13 @@ static int get_sample(void)
                s.nmi_count = nmi_count;
                trace_hwlat_sample(&s);
 
+               latency = max(sample, outer_sample);
+
                /* Keep a running maximum ever recorded hardware latency */
-               if (sample > tr->max_latency)
-                       tr->max_latency = sample;
-               if (outer_sample > tr->max_latency)
-                       tr->max_latency = outer_sample;
+               if (latency > tr->max_latency) {
+                       tr->max_latency = latency;
+                       latency_fsnotify(tr);
+               }
        }
 
 out:
@@ -276,7 +279,7 @@ static void move_to_next_cpu(void)
                return;
        /*
         * If for some reason the user modifies the CPU affinity
-        * of this thread, than stop migrating for the duration
+        * of this thread, then stop migrating for the duration
         * of the current test.
         */
        if (!cpumask_equal(current_mask, current->cpus_ptr))
@@ -553,7 +556,7 @@ static int init_tracefs(void)
        return 0;
 
  err:
-       tracefs_remove_recursive(top_dir);
+       tracefs_remove(top_dir);
        return -ENOMEM;
 }