From: Zhu GuangLei <zhugl3@xiaopeng.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
liuwb@xiaopeng.com
Subject: Re: [PATCH] misc/pvpanic: share the shutdown handler across devices
Date: Wed, 25 Nov 2026 17:15:19 +0800 [thread overview]
Message-ID: <20261125091519.173761-1-zhugl3@xiaopeng.com> (raw)
In-Reply-To: <2026112504-halves-payer-1293@gregkh>
On Wed, Nov 25, 2026 at 09:34:22AM +0100, Greg Kroah-Hartman wrote:
> > Register a single handler for the driver and keep it as long as at
> > least one device has the shutdown event enabled. Serialize updates of
> > the events mask and of the handler registration with a mutex. The
> > panic and power-off paths still take only the list spinlock, so access
> > the events mask with READ_ONCE()/WRITE_ONCE().
>
> If a spinlock is used, why is the read/write once stuff needed?
Because the writer did not take that spinlock: v1 updated the mask
under the new mutex only, while pvpanic_send_event() reads it under
pvpanic_lock. That is not a good reason, though. v2 updates the mask
under pvpanic_lock as well and drops READ_ONCE()/WRITE_ONCE().
> > + mutex_lock(&pvpanic_sys_off_lock);
>
> guard()?
Yes, will do in v2.
> > + WRITE_ONCE(pi->events, events);
>
> As you have a global lock here, again, why is WRITE_ONCE() needed?
Same reason as above, it is gone in v2.
thanks,
Zhu GuangLei
next prev parent reply other threads:[~2026-11-25 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:06 Zhu GuangLei
2026-11-25 8:34 ` Greg Kroah-Hartman
2026-11-25 9:15 ` Zhu GuangLei [this message]
2026-11-25 9:15 ` [PATCH v2] " Zhu GuangLei
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=20261125091519.173761-1-zhugl3@xiaopeng.com \
--to=zhugl3@xiaopeng.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuwb@xiaopeng.com \
--cc=stable@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
all inboxes | Powered by JetHome®