Skip to contentSkip to conversation

high latency introduced by hrtimer_interrupt

DISCUSSION yosi yarchi 2 participants 2 messages May 12, 2022 – May 25, 2022

lore
Share & tools
lore
#0 lore raw

hi

I'm using linux-rt, 5.4.41, at91 sam9x35 (single core).

AFAIK, the hrtimer_interrupt must run at HW context, and could not be threaded.
On my system, hrtimer_interrupt processing takes ~100us in average, ~40us in best case and ~200us in worst case. when adding the overhead of the re-scheduling that follow each interrupt, we get to worst case overhead of ~250us for the hrtimer_interrupt. This worst case and the huge variance are too high for some of my threaded interrupts, which have to record timestamps of HW events with precision < 100us.

Digging in documentation and mailing lists, I didn't find any solution...

Any idea on how to overcome this problem?

With best regards
Yosi Yarchi

#1 lore raw
Quoted 1 line · yosi yarchi

hi

Hi,

Quoted 12 lines

I'm using linux-rt, 5.4.41, at91 sam9x35 (single core).

AFAIK, the hrtimer_interrupt must run at HW context, and could not be threaded.
On my system, hrtimer_interrupt processing takes ~100us in average, ~40us in best case and ~200us in worst case. when adding the overhead of the re-scheduling that follow each interrupt, we get to worst case overhead of ~250us for the hrtimer_interrupt.
This worst case and the huge variance are too high for some of my threaded interrupts, which have to record timestamps of HW events with precision < 100us.

Quoted 3 lines

Digging in documentation and mailing lists, I didn't find any solution...

Any idea on how to overcome this problem?

So the hrtimer runs in hardirq context for the important timer like the system tick or a wake up of RT tasks. It can run at lower priority (threaded) if it is a timer for non-RT tasks. Nevertheless even the "threaded" hrtimer needs a wake up from the hard irq context. You could enable additional events to figure out what exactly is the hrtimer doing (processing a specific callback, waking a task, …).

Either there is a timer doing something nasty, leading to these long runs of the callback _or_ your CPU is simply slow and this is the best you can get.

Quoted 2 lines

With best regards
Yosi Yarchi

Sebastian