From: Joonwon Kang <joonwonkang@google.com>
To: jassisinghbrar@gmail.com
Cc: jonathanh@nvidia.com, joonwonkang@google.com,
linux-kernel@vger.kernel.org, sudeep.holla@arm.com,
thierry.reding@gmail.com
Subject: Re: [PATCH] mailbox: Allow NULL message sending
Date: Thu, 4 Dec 2025 05:57:26 +0000 [thread overview]
Message-ID: <20251204055733.759998-1-joonwonkang@google.com> (raw)
In-Reply-To: <CABb+yY25mpUQjW7N-+uYWZ9s4xYLpvV00S9CJigtiO7wa_EGnQ@mail.gmail.com>
On Tue, Nov 25, 2025 at 11:00 PM Joonwon Kang <joonwonkang@google.com> wrote:
> >
> > Clients may want to send interrupt only without any useful message
> > involved. Since the current mailbox framework does not allow NULL
> > message sending(although it allows receiving it), the clients should
> > allocate a dummy message buffer and pretend sending it. Besides, if
> > the mailbox controller calls `mbox_chan_txdone()` when the client
> > drivers happen to send NULL message anyway, it will result in unexpected
> > results by making the tx status messed up. This commit lifts the
> > limitation and allows the clients to send interrupt only without any
> > message buffer allocated.
> >
> Interrupts without data messages are called 'doorbells' and we already
> support them.
> thanks
I am not sure if it is already supported. Let me draw two cases which imply
that it is not supported. If the cases make sense, could you reconsider the
patch? If it is supported in another branch, could you refer me to that
branch? I am currently referring to the `for-next` branch of your mailbox
repo.
Case 1: Send API never returns.
```
mbox_client->tx_block = true;
mbox_chan = mbox_request_channel(mbox_client, index);
/*
* This send function never returns. It is because the mailbox framework
* will **not** call `complete(&mbox_chan->tx_complete)` when the sent
* message is NULL. Refer to `tx_tick()` implementation.
*/
ret = mbox_send_message(mbox_chan, NULL);
```
Case 2: TX status is messed up when NULL and non-NULL messages are sent.
```
/* Thread 1: Send NULL message to the remote. */
ret = mbox_send_message(mbox_chan, NULL);
/*
* Let's say that the mailbox controller has not received an ACK interrupt
* from the remote. In this case, the mailbox framework should **not** try
* picking up the next message from `mbox_chan->msg_data[]` and sending it.
*/
/*
* Thread 2: However, the mailbox framework will think that there is no
* pending message in `mbox_chan->msg_data[]`, because `mbox_chan->active_req`
* is NULL, and thus try sending the message of `msg_buf`. Now,
* `mbox_chan->active_req` will point to `msg_buf`.
*/
ret = mbox_send_message(mbox_chan, &msg_buf);
/*
* Let's say that the mailbox controller now has received an ACK interrupt
* for the NULL message sent by Thread 1 and not received it for Thread 2 yet.
* Then, it will call in chain `mbox_chan_txdone(mbox_chan, 0)` -->
* `tx_tick(mbox_chan, 0)`, and the last function will mark as if the message
* sent by Thread 2 is done by assigning `mbox_chan->active_req` with NULL.
* Now, the TX status is messed up.
*/
```
Thanks.
next prev parent reply other threads:[~2025-12-04 5:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 4:59 [PATCH] mailbox: Allow NULL message sending Joonwon Kang
2025-12-04 2:08 ` Jassi Brar
2025-12-04 5:57 ` Joonwon Kang [this message]
2025-12-07 21:56 ` Jassi Brar
2025-12-08 6:51 ` Joonwon Kang
2025-12-18 8:11 ` Lee Jones
2025-12-20 23:38 ` Jassi Brar
2025-12-22 10:56 ` Joonwon Kang
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=20251204055733.759998-1-joonwonkang@google.com \
--to=joonwonkang@google.com \
--cc=jassisinghbrar@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=thierry.reding@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