From: Johan Hovold <johan@kernel.org>
To: Tapio Reijonen <tapio.reijonen@vaisala.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 2/2] serial: core: do not touch the port after dropping the last reference
Date: Mon, 16 Nov 2026 08:53:11 +0100 [thread overview]
Message-ID: <avq2Z-eLXc-F5KxA@hovoldconsulting.com> (raw)
In-Reply-To: <4038c504-0f04-49a5-a9ef-2dd881b7d653@vaisala.com>
On Mon, Nov 16, 2026 at 09:49:45AM +0200, Tapio Reijonen wrote:
> On Thu, Nov 12, 2026 at 03:32:34PM +0100, Johan Hovold wrote:
> > On Thu, Nov 12, 2026 at 04:37:28AM +0000, Tapio Reijonen wrote:
> > > static inline void uart_port_deref(struct uart_port *uport)
> > > {
> > > - if (atomic_dec_and_test(&uport->state->refcount))
> > > - wake_up(&uport->state->remove_wait);
> > > + struct uart_state *state = uport->state;
> >
> > Hmm. Don't we also need a READ_ONCE() here to prevent the compiler
> > from doing something silly?
>
> Yes. Nothing writes uport->state once the port has been added, so I
> wrote it as a plain load. But the point of the patch is that the load
> must not happen after the decrement, and only READ_ONCE() rules out a
> reload there. I'll send a v3 with
>
> struct uart_state *state = READ_ONCE(uport->state);
>
> and keep your Reviewed-by unless you object.
Sounds good.
Johan
prev parent reply other threads:[~2026-11-16 7:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 4:37 [PATCH v2 0/2] serial: core: two fixes for the port removal path Tapio Reijonen
2026-11-12 4:37 ` [PATCH v2 1/2] serial: core: do not hold the port mutex while waiting for references Tapio Reijonen
2026-11-12 4:37 ` [PATCH v2 2/2] serial: core: do not touch the port after dropping the last reference Tapio Reijonen
2026-11-12 14:32 ` Johan Hovold
2026-11-16 7:49 ` Tapio Reijonen
2026-11-16 7:53 ` Johan Hovold [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=avq2Z-eLXc-F5KxA@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tapio.reijonen@vaisala.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