From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Zhu GuangLei <zhugl3@xiaopeng.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
linux-kernel@vger.kernel.org, liuwb@xiaopeng.com,
stable@vger.kernel.org
Subject: Re: [PATCH v3] misc/pvpanic: share the shutdown handler across devices
Date: Wed, 25 Nov 2026 13:12:20 +0100 [thread overview]
Message-ID: <2026112547-dayroom-proofing-0658@gregkh> (raw)
In-Reply-To: <20261125115602.72420-1-zhugl3@xiaopeng.com>
On Wed, Nov 25, 2026 at 07:56:02PM +0800, Zhu GuangLei wrote:
> Each pvpanic device registers its own power-off handler at
> SYS_OFF_PRIO_LOW. register_sys_off_handler() accepts only one handler
> per non-default priority, so when a second pvpanic device is probed the
> registration fails with -EBUSY and the driver logs "Could not register
> sys_off_handler". The handler that did get registered notifies every
> device on the list, but it is owned by the first device. Once that
> device is unbound, or its shutdown event is masked through sysfs, the
> handler is unregistered and the remaining device stops reporting
> shutdowns even though its events mask still has PVPANIC_SHUTDOWN set.
>
> 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, and also
> update the mask under the list spinlock, which is the only lock taken
> by the panic and power-off paths.
>
> The shutdown event only reaches pvpanic when no higher priority
> power-off handler, such as the ACPI one, turns the machine off first.
> Tested on a v6.18 based guest booted with acpi=off under QEMU 8.2.2
> (TCG) with two pvpanic-pci devices created with events=7: after
> unbinding the first device, or masking its shutdown event through
> sysfs, and powering off, QEMU did not receive the shutdown byte (0x4)
> without this change and does receive it with it.
> Masking the shutdown event on a single device still suppresses the
> write.
>
> OpenAI Codex was used to write the code change and the QEMU test
> scripts, and to run the tests. GitHub Copilot was used to review the
> change, to rewrite this changelog and to prepare v2.
>
> Fixes: 7b51b1373321 ("misc/pvpanic: add support for normal shutdowns")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhu GuangLei <zhugl3@xiaopeng.com>
Please slow down, there is no rush, at MOST do a new version after
waiting 24 hours for others to review and catch up. Usually a few days
is fine.
thanks,
greg k-h
prev parent reply other threads:[~2026-11-25 12:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 8:06 [PATCH] misc/pvpanic: share the shutdown handler across devices Zhu GuangLei
2026-11-25 8:34 ` Greg Kroah-Hartman
2026-11-25 9:15 ` Zhu GuangLei
2026-11-25 9:15 ` [PATCH v2] " Zhu GuangLei
2026-11-25 10:06 ` Greg Kroah-Hartman
2026-11-25 11:56 ` Zhu GuangLei
2026-11-25 11:56 ` [PATCH v3] " Zhu GuangLei
2026-11-25 12:12 ` Greg Kroah-Hartman [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=2026112547-dayroom-proofing-0658@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=arnd@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=liuwb@xiaopeng.com \
--cc=stable@vger.kernel.org \
--cc=zhugl3@xiaopeng.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