mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Douglas Anderson <dianders@chromium.org>
Cc: Jassi Brar <jassisinghbrar@gmail.com>,
	Sudeep Holla <sudeep.holla@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mailbox: Only reset txdone_method to POLL if controller supports polling
Date: Wed, 4 Nov 2026 22:24:32 +0800	[thread overview]
Message-ID: <autAIFvNbRAFJ9mA@shlinux89> (raw)
In-Reply-To: <20261103164235.1.Ica21c7a396cf407fca02b7c0fb3a16150feaab90@changeid>

On Tue, Nov 03, 2026 at 04:42:36PM -0800, Douglas Anderson wrote:
>In mbox_controller_register(), a mailbox controller's default
>txdone_method is initialized to MBOX_TXDONE_BY_IRQ if mbox->txdone_irq
>is set, MBOX_TXDONE_BY_POLL if mbox->txdone_poll is set, or
>MBOX_TXDONE_BY_ACK if neither is set. Only controllers with
>mbox->txdone_poll set initialize mbox->poll_hrt and require
>mbox->ops->last_tx_done to be implemented.
>
>When a client with cl->knows_txdone = true binds to a channel whose
>controller uses MBOX_TXDONE_BY_POLL, __mbox_bind_client() overrides
>chan->txdone_method to MBOX_TXDONE_BY_ACK. Commit 33cd7123ac0b
>("mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone")
>attempted to restore chan->txdone_method to MBOX_TXDONE_BY_POLL when
>the channel is released, but did so unconditionally whenever
>chan->txdone_method == MBOX_TXDONE_BY_ACK:
>
>  if (chan->txdone_method == MBOX_TXDONE_BY_ACK)
>          chan->txdone_method = MBOX_TXDONE_BY_POLL;
>
>For controllers whose native txdone_method is MBOX_TXDONE_BY_ACK
>(!txdone_irq && !txdone_poll), releasing a channel (or failing in the
>controller's startup() callback) corrupts chan->txdone_method to
>MBOX_TXDONE_BY_POLL even though the controller does not support
>polling and has not initialized poll_hrt or ops->last_tx_done.
>
>Check chan->mbox->txdone_poll before resetting chan->txdone_method to
>MBOX_TXDONE_BY_POLL in mbox_clean_and_put_channel().
>
>Fixes: 33cd7123ac0b ("mailbox: reset txdone_method TXDONE_BY_POLL if client knows_txdone")
>Signed-off-by: Douglas Anderson <dianders@chromium.org>
>---

LGTM:
Reviewed-by: Peng Fan <peng.fan@nxp.com>

  reply	other threads:[~2026-11-04 14:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  0:42 Douglas Anderson
2026-11-04 14:24 ` Peng Fan [this message]
2026-11-04 15:30 ` Sudeep Holla

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=autAIFvNbRAFJ9mA@shlinux89 \
    --to=peng.fan@oss.nxp.com \
    --cc=dianders@chromium.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudeep.holla@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

all inboxes | Powered by JetHome®