From: Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx> Sent: Wednesday, April 27, 2022 3:49 PM > > The goal of this new panic notifier is to allow its users to register > callbacks to run very early in the panic path. This aims hypervisor/FW > notification mechanisms as well as simple LED functions, and any other > simple and safe mechanism that should run early in the panic path; more > dangerous callbacks should execute later. > > For now, the patch is almost a no-op (although it changes a bit the > ordering in which some panic notifiers are executed). In a subsequent > patch, the panic path will be refactored, then the panic hypervisor > notifiers will effectively run very early in the panic path. > > We also defer documenting it all properly in the subsequent refactor > patch. While at it, we removed some useless header inclusions and > fixed some notifiers return too (by using the standard NOTIFY_DONE). > > Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx> > Cc: Andrea Parri (Microsoft) <parri.andrea@xxxxxxxxx> > Cc: Ard Biesheuvel <ardb@xxxxxxxxxx> > Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> > Cc: Brian Norris <computersforpeace@xxxxxxxxx> > Cc: Christian Borntraeger <borntraeger@xxxxxxxxxxxxx> > Cc: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> > Cc: David Gow <davidgow@xxxxxxxxxx> > Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> > Cc: Dexuan Cui <decui@xxxxxxxxxxxxx> > Cc: Doug Berger <opendmb@xxxxxxxxx> > Cc: Evan Green <evgreen@xxxxxxxxxxxx> > Cc: Florian Fainelli <f.fainelli@xxxxxxxxx> > Cc: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx> > Cc: Hari Bathini <hbathini@xxxxxxxxxxxxx> > Cc: Heiko Carstens <hca@xxxxxxxxxxxxx> > Cc: Julius Werner <jwerner@xxxxxxxxxxxx> > Cc: Justin Chen <justinpopo6@xxxxxxxxx> > Cc: "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx> > Cc: Lee Jones <lee.jones@xxxxxxxxxx> > Cc: Markus Mayer <mmayer@xxxxxxxxxxxx> > Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> > Cc: Michael Kelley <mikelley@xxxxxxxxxxxxx> > Cc: Mihai Carabas <mihai.carabas@xxxxxxxxxx> > Cc: Nicholas Piggin <npiggin@xxxxxxxxx> > Cc: Paul Mackerras <paulus@xxxxxxxxx> > Cc: Pavel Machek <pavel@xxxxxx> > Cc: Scott Branden <scott.branden@xxxxxxxxxxxx> > Cc: Sebastian Reichel <sre@xxxxxxxxxx> > Cc: Shile Zhang <shile.zhang@xxxxxxxxxxxxxxxxx> > Cc: Stephen Hemminger <sthemmin@xxxxxxxxxxxxx> > Cc: Sven Schnelle <svens@xxxxxxxxxxxxx> > Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> > Cc: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx> > Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx> > Cc: Wang ShaoBo <bobo.shaobowang@xxxxxxxxxx> > Cc: Wei Liu <wei.liu@xxxxxxxxxx> > Cc: zhenwei pi <pizhenwei@xxxxxxxxxxxxx> > Signed-off-by: Guilherme G. Piccoli <gpiccoli@xxxxxxxxxx> > --- > arch/mips/sgi-ip22/ip22-reset.c | 2 +- > arch/mips/sgi-ip32/ip32-reset.c | 3 +-- > arch/powerpc/kernel/setup-common.c | 2 +- > arch/sparc/kernel/sstate.c | 3 +-- > drivers/firmware/google/gsmi.c | 4 ++-- > drivers/hv/vmbus_drv.c | 4 ++-- > drivers/leds/trigger/ledtrig-activity.c | 4 ++-- > drivers/leds/trigger/ledtrig-heartbeat.c | 4 ++-- > drivers/misc/bcm-vk/bcm_vk_dev.c | 6 +++--- > drivers/misc/pvpanic/pvpanic.c | 4 ++-- > drivers/power/reset/ltc2952-poweroff.c | 4 ++-- > drivers/s390/char/zcore.c | 5 +++-- > drivers/soc/bcm/brcmstb/pm/pm-arm.c | 2 +- > include/linux/panic_notifier.h | 1 + > kernel/panic.c | 4 ++++ > 15 files changed, 28 insertions(+), 24 deletions(-) [ snip] > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > index f37f12d48001..901b97034308 100644 > --- a/drivers/hv/vmbus_drv.c > +++ b/drivers/hv/vmbus_drv.c > @@ -1614,7 +1614,7 @@ static int vmbus_bus_init(void) > hv_kmsg_dump_register(); > > register_die_notifier(&hyperv_die_report_block); > - atomic_notifier_chain_register(&panic_notifier_list, > + atomic_notifier_chain_register(&panic_hypervisor_list, > &hyperv_panic_report_block); > } > > @@ -2843,7 +2843,7 @@ static void __exit vmbus_exit(void) > if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) { > kmsg_dump_unregister(&hv_kmsg_dumper); > unregister_die_notifier(&hyperv_die_report_block); > - atomic_notifier_chain_unregister(&panic_notifier_list, > + atomic_notifier_chain_unregister(&panic_hypervisor_list, > &hyperv_panic_report_block); > } > Using the hypervisor_list here produces a bit of a mismatch. In many cases this notifier will do nothing, and will defer to the kmsg_dump() mechanism to notify the hypervisor about the panic. Running the kmsg_dump() mechanism is linked to the info_list, so I'm thinking the Hyper-V panic report notifier should be on the info_list as well. That way the reporting behavior is triggered at the same point in the panic path regardless of which reporting mechanism is used.