public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: yosi yarchi <yosi.yarchi@gmail.com>
To: yosi.yarchi@gmail.com
Cc: linux-rt-users@vger.kernel.org
Subject: Re: high prioritized threaded interrupt is delayed due to low priority softirq job
Date: Thu, 17 Nov 2022 09:12:00 +0200	[thread overview]
Message-ID: <656ed13b-df87-ac56-ea39-7222dcb80bf6@gmail.com> (raw)
In-Reply-To: <be1a23f2-f8c1-17f0-db77-a32469fa56fa@gmail.com>

Hi


I hope this mail will be more readable (prev mail lines had been cut):



my platform is:

1. SAM9X35 (8 CAN mailboxes),

2. Linux mscb 5.4.41-linux4sam-2020.04-rt24 #1 PREEMPT_RT Wed Nov 9 
06:12:28 UTC 2022 armv5tejl GNU/Linux

3. CAN threaded interrupt (irq/30-can0-346) is configured to be highest 
priority on system, and it is scheduled very quickly after CAN 
irq_handler expires (irq_handler_entry: irq=30 name=can0), doing its job 
(at91_irq).


my problem is that from time to time I get CAN RX overflow. problem 
analysis is as the following (see trace below): after CAN threaded 
interrupt completes its job (at91_irq_r), scheduler force it to run some 
other low priority softirq jobs (softirq_entry: vec=1 [action=TIMER], 
softirq_entry: vec=3 [action=NET_RX]). during the processing of those 
jobs, new HW CAN irq_handler expires (irq_handler_entry: irq=30 
name=can0), but scheduler schedule the at91_irq job at the end of job 
queue, which is too late, and I get CAN rx overflow.


I've tried some solutions, no one worked out of the box:

1. disable all relevant irqs (timer, network) at CAN irq_handler 
(irq_handler_entry: irq=30 name=can0), and enable them at the end of CAN 
threaded interrupt job processing (at91_irq_r)

2. configure CAN job (at91_irq) to run inside the CAN irq_handler 
(irq_handler_entry: irq=30 name=can0) by adding IRQF_NO_THREAD flag to 
request_irq.


is there built-in solution for this problem at linux-rt?
if not, what could be good 'hacked' solutions for the problem?

with best regards
Yosi Yarchi


kernel trace:
-------------

      <idle>-0   d..h1 1859: irq_handler_entry: irq=30 name=can0
      <idle>-0   d..h1 1875: irq_handler_exit: irq=30 ret=handled
irq/30-can0-346 d.... 1972: at91_irq: (at91_irq+0x0/0xab0)
irq/30-can0-346 d...1 2090: at91_irq_r: (irq_forced_thread_fn+0x3c/0
      <idle>-0   d..h1 2330: irq_handler_entry: irq=30 name=can0
      <idle>-0   d..h1 2347: irq_handler_exit: irq=30 ret=handled
irq/30-can0-346 d.... 2438: at91_irq: (at91_irq+0x0/0xab0)
irq/30-can0-346 d...1 2553: at91_irq_r: (irq_forced_thread_fn+0x3c/0
      <idle>-0   d..h1 2812: irq_handler_entry: irq=30 name=can0
      <idle>-0   d..h1 2829: irq_handler_exit: irq=30 ret=handled
irq/30-can0-346 d.... 2923: at91_irq: (at91_irq+0x0/0xab0)
irq/30-can0-346 d...1 3040: at91_irq_r: (irq_forced_thread_fn+0x3c/0
      <idle>-0   d..h1 3290: irq_handler_entry: irq=30 name=can0
      <idle>-0   d..h1 3308: irq_handler_exit: irq=30 ret=handled
irq/30-can0-346 d.... 3400: at91_irq: (at91_irq+0x0/0xab0)
irq/30-can0-346 d...1 3514: at91_irq_r: (irq_forced_thread_fn+0x3c/0
      <idle>-0   d..h1 3781: irq_handler_entry: irq=30 name=can0
      <idle>-0   d..h1 3799: irq_handler_exit: irq=30 ret=handled
irq/30-can0-346 d..h. 3891: irq_handler_entry: irq=16 name=tc_clkevt
irq/30-can0-346 d..h. 3956: softirq_raise: vec=1 [action=TIMER]
irq/30-can0-346 d..h. 4006: irq_handler_exit: irq=16 ret=handled
irq/30-can0-346 d.... 4048: at91_irq: (at91_irq+0x0/0xab0)
irq/30-can0-346 d...1 4169: at91_irq_r: (irq_forced_thread_fn+0x3c/0
irq/30-can0-346 ..... 4207: softirq_entry: vec=1 [action=TIMER]
irq/30-can0-346 d..h1 4254: irq_handler_entry: irq=30 name=can0
irq/30-can0-346 d..h1 4267: irq_handler_exit: irq=30 ret=handled
irq/30-can0-346 d.... 4493: softirq_raise: vec=3 [action=NET_RX]
irq/30-can0-346 ..... 5282: softirq_exit: vec=1 [action=TIMER]
irq/30-can0-346 ..... 5306: softirq_entry: vec=3 [action=NET_RX]
irq/30-can0-346 d..h. 5607: irq_handler_entry: irq=16 name=tc_clkevt
irq/30-can0-346 d..h. 5673: irq_handler_entry: irq=17 name=at91_rtc
irq/30-can0-346 d..h. 5685: irq_handler_exit: irq=17 ret=handled
irq/30-can0-346 d..h. 5706: irq_handler_entry: irq=17 name=atmel_usa
irq/30-can0-346 d..h. 5713: irq_handler_exit: irq=17 ret=handled
irq/30-can0-346 d..h. 5754: irq_handler_exit: irq=16 ret=handled
irq/30-can0-346 d..h. 6008: irq_handler_entry: irq=29 name=eth0
irq/30-can0-346 d..h. 6027: irq_handler_exit: irq=29 ret=handled
irq/30-can0-346 ..... 6571: softirq_exit: vec=3 [action=NET_RX]
irq/30-can0-346 d.... 6626: at91_irq: (at91_irq+0x0/0xab0)
irq/30-can0-346 d.... 6788: at91_rx_overflow_err: (at91_irq+0x200/0x


  reply	other threads:[~2022-11-17  7:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17  6:53 high prioritized threaded interrupt is delayed due to low priority softirq job yosi yarchi
2022-11-17  7:12 ` yosi yarchi [this message]
2022-11-18 11:15   ` Ahmed S. Darwish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=656ed13b-df87-ac56-ea39-7222dcb80bf6@gmail.com \
    --to=yosi.yarchi@gmail.com \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox