From: Joonwon Kang <joonwonkang@google.com>
To: jassisinghbrar@gmail.com
Cc: alexey.klimov@arm.com, jonathanh@nvidia.com,
joonwonkang@google.com, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org, sudeep.holla@arm.com,
thierry.reding@gmail.com
Subject:
Date: Tue, 22 Jul 2025 07:58:36 +0000 [thread overview]
Message-ID: <20250722075836.2295285-1-joonwonkang@google.com> (raw)
In-Reply-To: <CABb+yY3CBiLpZ1KrD8RFypRgkP9MOzBf1FB+gL2E-qEuSbrj6A@mail.gmail.com>
On Wed, Jun 18, 2025 at 3:04=E2=80=AFAM Joonwon Kang <joonwonkang@google.co=
m> 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 as many as the number of concurrent sender
>> threads
>> - A completion is created in 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
>>
>> Link: https://lore.kernel.org/all/1490809381-28869-1-git-send-email-jaswi=
>nder.singh@linaro.org
>
> Is your issue different from what is described in the Link?
>
> thanks
The issue is the same, but the solution is different.
The previous solution in the Link tried to have per-message completion; each
completion belongs to each slot of the message queue. However, the solution in
this patch tries to have per-thread completion; each completion belongs to each
sender thread and each slot of the message queue has a pointer to that
completion; `struct mbox_message` has the "pointer" field
`struct completion *tx_complete` which points to the completion which is
created in the stack of the sender instead of owning the completion by having
the non-pointer field `struct completion tx_complete`. This way, we could avoid
the window where the same completion is reused by different sender threads
which could lead to a wrong completion order, IMHO.
next prev parent reply other threads:[~2025-07-22 7:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 8:03 [PATCH 1/2] mailbox: Use per-thread completion to fix wrong completion order Joonwon Kang
2025-07-20 21:13 ` Jassi Brar
2025-07-22 6:46 ` Joonwon Kang
2025-07-22 6:50 ` Joonwon Kang
2025-07-22 7:58 ` Joonwon Kang [this message]
2025-07-22 8:15 ` 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=20250722075836.2295285-1-joonwonkang@google.com \
--to=joonwonkang@google.com \
--cc=alexey.klimov@arm.com \
--cc=jassisinghbrar@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@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
all inboxes | Powered by JetHome®