Patch "rtla/timerlat_aa: Fix negative IRQ delay" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    rtla/timerlat_aa: Fix negative IRQ delay

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rtla-timerlat_aa-fix-negative-irq-delay.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b01d61f4a9644f359e4bf2412dfed8d511fa9c29
Author: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
Date:   Fri Aug 4 17:52:12 2023 +0200

    rtla/timerlat_aa: Fix negative IRQ delay
    
    [ Upstream commit 6c73daf26420b97fb8b4a620e4ffee5c1f9d44d1 ]
    
    When estimating the IRQ timer delay, we are dealing with two different
    clock sources: the external clock source that timerlat uses as a reference
    and the clock used by the tracer. There are also two moments: the time
    reading the clock and the timer in which the event is placed in the
    buffer (the trace event timestamp).
    
    If the processor is slow or there is some hardware noise, the difference
    between the timestamp and the external clock, read can be longer than the
    IRQ handler delay, resulting in a negative time.
    
    If so, set IRQ to start delay as 0. In the end, it is less near-zero and relevant
    then the noise.
    
    Link: https://lore.kernel.org/lkml/a066fb667c7136d86dcddb3c7ccd72587db3e7c7.1691162043.git.bristot@xxxxxxxxxx
    
    Fixes: 27e348b221f6 ("rtla/timerlat: Add auto-analysis core")
    Signed-off-by: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/timerlat_aa.c
index dec5b4c4511e1..baf1efda0581d 100644
--- a/tools/tracing/rtla/src/timerlat_aa.c
+++ b/tools/tracing/rtla/src/timerlat_aa.c
@@ -338,7 +338,23 @@ static int timerlat_aa_irq_handler(struct trace_seq *s, struct tep_record *recor
 		taa_data->timer_irq_start_time = start;
 		taa_data->timer_irq_duration = duration;
 
-		taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start;
+		/*
+		 * We are dealing with two different clock sources: the
+		 * external clock source that timerlat uses as a reference
+		 * and the clock used by the tracer. There are also two
+		 * moments: the time reading the clock and the timer in
+		 * which the event is placed in the buffer (the trace
+		 * event timestamp). If the processor is slow or there
+		 * is some hardware noise, the difference between the
+		 * timestamp and the external clock read can be longer
+		 * than the IRQ handler delay, resulting in a negative
+		 * time. If so, set IRQ start delay as 0. In the end,
+		 * it is less relevant than the noise.
+		 */
+		if (expected_start < taa_data->timer_irq_start_time)
+			taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start;
+		else
+			taa_data->timer_irq_start_delay = 0;
 
 		/*
 		 * not exit from idle.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux