Subject: [PATCH 0/3] rtla fixes for 6.5

Here are some fixes for rtla timerlat auto-analysis.

The first one zeroes the variable that accounts for the amount of
thread interference when a new cycle begins.

The second fixes an imprecision on the IRQ delay account when
the value is near 0.

The last one fixes the case when an IRQ interference for the
next activation is considered for the previous one.


Daniel Bristot de Oliveira (3):
rtla/timerlat_aa: Zero thread sum after every sample analysis
rtla/timerlat_aa: Fix negative irq delay
rtla/timerlat_aa: Fix previous IRQ delay for IRQs that happens after
thread sample

tools/tracing/rtla/src/timerlat_aa.c | 32 ++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)

--
2.38.1



Subject: [PATCH 2/3] rtla/timerlat_aa: Fix negative IRQ delay

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.

Fixes: 27e348b221f6 ("rtla/timerlat: Add auto-analysis core")
Signed-off-by: Daniel Bristot de Oliveira <[email protected]>
---
tools/tracing/rtla/src/timerlat_aa.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/timerlat_aa.c
index dec5b4c4511e..baf1efda0581 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.
--
2.38.1