mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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.
Link: https://lore.kernel.org/lkml/a066fb667c7136d86dcddb3c7ccd72587db3e7c7.1691162043.git.bristot@kernel.org
Fixes: 27e348b221
("rtla/timerlat: Add auto-analysis core")
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
This commit is contained in:
parent
02d89917ef
commit
6c73daf264
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user