The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Chrispine Tinega <dev@chrispinetinega.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rpmsg: char: Drop messages that arrive while the device is closed
Date: Fri, 4 Dec 2026 09:18:27 -0600	[thread overview]
Message-ID: <axLZw5oOIsWKlST0@p14s> (raw)
In-Reply-To: <20261204040411.2238449-1-dev@chrispinetinega.com>

On Fri, Dec 04, 2026 at 07:04:11AM +0300, Chrispine Tinega wrote:
> Hi Mathieu,
> 
> On Thu, Dec 03, 2026 at 11:24:48AM -0600, Mathieu Poirier wrote:
> > > +	if (eptdev->default_ept && !eptdev->ept) {
> >
> > Is there a point in checking @eptdev->default at all?  From what I understand,
> > checking @eptdev->ept should be sufficient.
> >
> > Otherwise I'm good with your patch.
> 
> For a non-default endpoint, rpmsg_eptdev_open() calls rpmsg_create_ept()
> and only assigns eptdev->ept after it returns. A transport can invoke
> rpmsg_ept_cb() inside that window while eptdev->ept is still NULL.
>

Right, and in that case messages should be dropped.
 
> For example, qcom_smd_create_ept() -> qcom_smd_channel_open() installs
> the callback and moves the channel to SMD_CHANNEL_OPENED before sleeping
> for the remote state. If the remote side opens and sends an initial
> message, qcom_smd_channel_intr() runs rpmsg_ept_cb() in IRQ context
> before rpmsg_eptdev_open() wakes up to set eptdev->ept.
> virtio_rpmsg_create_ept() also registers the endpoint in vrp->endpoints
> before returning.
> 

Again, we agree.  In either cases messages should be dropped until ->ept is
valid.  I don't see a point in checking for ->default_ept.  What am I missing?

> Checking !eptdev->ept unconditionally would drop those initial messages
> on a newly opened non-default endpoint. On release, non-default
> endpoints are already torn down by rpmsg_destroy_ept(), so only
> eptdev->default_ept needs this guard.
> 
> Let me know if you want a brief comment noting that in rpmsg_ept_cb() in
> a v3, or if v2 is fine as is.
> 
> Regards,
> Chrispine

      reply	other threads:[~2026-12-04 15:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 19:14 [PATCH v2] rpmsg: char: Drop messages that arrive while the device is closed Chrispine Tinega
2026-12-03 17:24 ` Mathieu Poirier
2026-12-04  4:04   ` Chrispine Tinega
2026-12-04 15:18     ` Mathieu Poirier [this message]

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=axLZw5oOIsWKlST0@p14s \
    --to=mathieu.poirier@linaro.org \
    --cc=andersson@kernel.org \
    --cc=dev@chrispinetinega.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.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