public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ahmed S. Darwish" <darwi@linutronix.de>
To: yosi yarchi <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: Fri, 18 Nov 2022 12:15:40 +0100	[thread overview]
Message-ID: <Y3dpXJ/gswWR6qdL@lx-t490> (raw)
In-Reply-To: <656ed13b-df87-ac56-ea39-7222dcb80bf6@gmail.com>

On Thu, Nov 17, 2022, yosi yarchi wrote:
>
> 1. SAM9X35 (8 CAN mailboxes),
>

This is a *very* very low-end core (ARM926), so be careful that some
latency issues would be expected.

If you don't have a specific Linux use-case, maybe you can try something
like ZephyrOS instead?

Given that low-end core, and if you're stuck with Linux, a mainline
kernel with preemption disabled (CONFIG_PREEMPT_NONE) might actually be
more beneficial latency-wise than PREEMPT_RT...

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

"5.4.41-linux4sam-2020.04-rt24". This is a vendored RT kernel, and
vendored RT kernels are known to have latency issues.

Can you please try official RT kernels instead? More info is here:

  https://wiki.linuxfoundation.org/realtime/preempt_rt_versions

Make sure that debugging options are disabled, e.g.
CONFIG_PROVE_LOCKING, and so on. Afterwards, you'd like to measure the
latencies of your (single-core) system with something like:

  cyclictest                    \
        --default-system        \
        --secaligned            \
        --mlockall              \
        --interval=500          \
        --priority=98           \
        --histogram=2000

And then check the reported worst-case latencies.

> 3. CAN threaded interrupt (irq/30-can0-346) is configured to be
> highest priority on system.

Please not that in RT, many system-critical kernel threads run at rtprio
99. The hight (sane) priority to be assigned should thus be 98.

>
> my problem is that from time to time I get CAN RX overflow.
>

That would be kinda expected with such a low-end core, even when
everything else is "perfect".

>
> 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)
>

That's wrong in so many ways, please don't do that.

> 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.

ditto.

Good luck,

--
Ahmed S. Darwish
Linutronix GmbH

      reply	other threads:[~2022-11-18 11:15 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
2022-11-18 11:15   ` Ahmed S. Darwish [this message]

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=Y3dpXJ/gswWR6qdL@lx-t490 \
    --to=darwi@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=yosi.yarchi@gmail.com \
    /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