public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Joonwon Kang <joonwonkang@google.com>
To: jassisinghbrar@gmail.com
Cc: angelogioacchino.delregno@collabora.com, jonathanh@nvidia.com,
	 joonwonkang@google.com, linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,  linux-tegra@vger.kernel.org,
	matthias.bgg@gmail.com, stable@vger.kernel.org,
	 thierry.reding@gmail.com
Subject: Re: [PATCH v3 1/2] mailbox: Use per-thread completion to fix wrong completion order
Date: Fri, 17 Apr 2026 08:41:34 +0000	[thread overview]
Message-ID: <20260417084135.2091007-1-joonwonkang@google.com> (raw)
In-Reply-To: <CABb+yY0uDQh-3cadPQONV=NJKjMtc4mJekgjmHYVaHnfHXvGZQ@mail.gmail.com>

> On Fri, Apr 3, 2026 at 9:51 AM Joonwon Kang <joonwonkang@google.com> wrote:
> >
> > > On Thu, Apr 2, 2026 at 12:07 PM Joonwon Kang <joonwonkang@google.com> wrote:
> > > >
> > > > Previously, a sender thread in mbox_send_message() could be woken up at
> > > > a wrong time in blocking mode. It is because there was only a single
> > > > completion for a channel whereas messages from multiple threads could be
> > > > sent in any order; since the shared completion could be signalled in any
> > > > order, it could wake up a wrong sender thread.
> > > >
> > > > This commit resolves the false wake-up issue with the following changes:
> > > > - Completions are created just as many as the number of concurrent sender
> > > >   threads
> > > > - A completion is created on a sender thread's stack
> > > > - Each slot of the message queue, i.e. `msg_data`, contains a pointer to
> > > >   its target completion
> > > > - tx_tick() signals the completion of the currently active slot of the
> > > >   message queue
> > > >
> > > I think I reviewed it already or is this happening on
> > > one-channel-one-client usage? Because mailbox api does not support
> > > channels shared among multiple clients.
> >
> > Yes, this patch is handling the one-channel-one-client usage but when that
> > single channel is shared between multiple threads.
> 
> hmm.... how is this not single-channel-multiple-clients ?
> A channel is returned as an opaque token to the clients, if that
> client shares that with other threads - they will race.
> It is the job of the original client to serialize its threads' access
> to the channel.
> 
> > From my understanding, the
> > discussion back then ended with how to circumvent the issue rather than whether
> > we will eventually solve this in the mailbox framework or not, and if yes, how
> > we will, and if not, why.
> 
> It will be interesting to see how many current clients actually need
> to share channels. If there are enough, it makes sense to implement
> some helper api
> on top of existing code, instead of changing its nature totally.
> 
> Thanks
> Jassi

Hi Jassi, can we continue discussing this matter? We can start from the recent
comments from me.

Thanks,
Joonwon Kang

  parent reply	other threads:[~2026-04-17  8:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 17:06 [PATCH v3 0/2] mailbox: Fix wrong completion order and improper send result in the blocking mode send API Joonwon Kang
2026-04-02 17:06 ` [PATCH v3 1/2] mailbox: Use per-thread completion to fix wrong completion order Joonwon Kang
2026-04-02 17:59   ` Jassi Brar
2026-04-03 14:51     ` Joonwon Kang
2026-04-03 16:19       ` Jassi Brar
2026-04-04 12:44         ` Joonwon Kang
2026-04-05  0:58           ` zhang
2026-04-17  8:41         ` Joonwon Kang [this message]
2026-04-02 17:06 ` [PATCH v3 2/2] mailbox: Make mbox_send_message() return error code when tx fails Joonwon Kang
2026-04-02 18:03   ` Jassi Brar
2026-04-03 15:19     ` Joonwon Kang
2026-04-03 16:36       ` Jassi Brar
2026-04-04 11:47         ` Joonwon Kang
2026-04-17  8:43         ` 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=20260417084135.2091007-1-joonwonkang@google.com \
    --to=joonwonkang@google.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=stable@vger.kernel.org \
    --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