Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: sashiko-reviews@lists.linux.dev
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH 2/5] mailbox: imx: Move the RX part of the mailbox into the threaded handler
Date: Mon, 1 Jun 2026 18:07:02 +0200	[thread overview]
Message-ID: <20260601160702.eZoCBpfm@linutronix.de> (raw)
In-Reply-To: <20260529172635.A1EDB1F00893@smtp.kernel.org>

On 2026-05-29 17:26:35 [+0000], sashiko-bot@kernel.org wrote:
> commit 7ab3fb54b60e0decf23b64d1d78df0e2b4409f2a
> Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> 
> mailbox: imx: Move the RX part of the mailbox into the threaded handler
> 
> This commit moves the RX mailbox callback handling into the threaded
> interrupt handler. It updates the driver to mask the RX interrupt in the
> primary handler and unmask it in the threaded handler upon success.
> 
> > diff --git a/drivers/mailbox/imx-mailbox.c b/drivers/mailbox/imx-mailbox.c
> > --- a/drivers/mailbox/imx-mailbox.c
> > +++ b/drivers/mailbox/imx-mailbox.c
> 
> [ ... ]
> 
> > @@ -524,6 +522,12 @@ static irqreturn_t imx_mu_isr_th(int irq, void *p)
> >  		mbox_chan_txdone(chan, 0);
> >  		return IRQ_HANDLED;
> >  
> > +	case IMX_MU_TYPE_RX:
> > +		cp->pending = 0;
> > +		if (!priv->dcfg->rx(priv, cp))
> > +			imx_mu_xcr_rmw(priv, IMX_MU_RCR, IMX_MU_xCR_RIEn(priv->dcfg->type, cp->idx), 0);
> 
> [Severity: High]
> This is a pre-existing issue, but does bypassing the unmasking step on
> error permanently disable the channel?

Yes, I think this is the intention. The RX callback does not unmask the
event on error.

> If imx_mu_specific_rx() encounters an error, such as a read timeout or
> receiving a message that exceeds the maximum size, it returns a negative
> error code. When this happens, the condition evaluates to false and the
> interrupt remains masked.
> 
> Since there does not seem to be a mechanism to automatically reset the
> channel after these errors, could a buggy remote processor trigger this
> to cause a permanent denial of service for the RX channel?
> 
> [Severity: High]
> Can this unmasking step also race with channel shutdown?
> 
> If mbox_free_channel() is called concurrently, imx_mu_shutdown() masks the
> interrupt and invokes free_irq(). The free_irq() function synchronizes
> with the threaded handler and will block until imx_mu_isr_th() finishes
> processing.
> 
> Because imx_mu_isr_th() proceeds to unmask the interrupt here after
> processing, the hardware interrupt will be left enabled after the kernel
> IRQ handler is fully unregistered. If a new message arrives afterward,
> won't this cause an interrupt storm and prompt the genirq core to disable
> the shared IRQ line entirely?

Yes, we had this.

> > +		return IRQ_HANDLED;
> > +
> >  	default:
> >  		dev_warn_ratelimited(priv->dev, "Unhandled channel type %d\n",

Sebastian

  reply	other threads:[~2026-06-01 16:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29 16:01 [PATCH 0/5] mailbox: imx: Use threaded handler to avoid kworker in imx's remoteproc Sebastian Andrzej Siewior
2026-05-29 16:01 ` [PATCH 1/5] mailbox: imx: Start splitting the IRQ handler in primary and threaded handler Sebastian Andrzej Siewior
2026-05-29 16:43   ` sashiko-bot
2026-06-01 15:28     ` Sebastian Andrzej Siewior
2026-05-29 16:01 ` [PATCH 2/5] mailbox: imx: Move the RX part of the mailbox into the " Sebastian Andrzej Siewior
2026-05-29 17:26   ` sashiko-bot
2026-06-01 16:07     ` Sebastian Andrzej Siewior [this message]
2026-05-29 16:01 ` [PATCH 3/5] mailbox: imx: Move the RXDB " Sebastian Andrzej Siewior
2026-05-29 17:34   ` sashiko-bot
2026-06-01 16:15     ` Sebastian Andrzej Siewior
2026-05-29 16:01 ` [PATCH 4/5] mailbox: imx: Don't force-thread the primary handler Sebastian Andrzej Siewior
2026-05-29 18:13   ` sashiko-bot
2026-06-02 10:03     ` Sebastian Andrzej Siewior
2026-05-29 16:01 ` [PATCH 5/5] remoteproc: imx_rproc: Invoke the callback directly Sebastian Andrzej Siewior
2026-05-29 19:08   ` sashiko-bot
2026-06-02 12:11     ` Sebastian Andrzej Siewior
2026-06-02 16:51 ` [PATCH 0/5] mailbox: imx: Use threaded handler to avoid kworker in imx's remoteproc Mathieu Poirier

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=20260601160702.eZoCBpfm@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=Frank.Li@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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