Re: [PATCH v2 0/3] Introduce arch_do_panic
Mete Durlu <[email protected]> Wed, 29 Jul 2026 12:48:49 +0200
| Newsgroups | org.kernel.vger.sparclinux,org.kernel.vger.linux-kernel,org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
On 29/07/2026 10:56, Heiko Carstens wrote: > On Mon, Jul 27, 2026 at 12:36:19PM +0200, Mete Durlu wrote: >> Changes in v2 - Address Sashiko findings; >> - Patch 2: Remove unused leftover code >> - Patch 2: Mention panic_timeout and shutdown_actions relationship for >> s390 in commit message >> - Patch 3: Use bug.h instead of setup.h to pass around arch_do_panic >> implementation of sparc >> >> Replace architecture-specific ifdef sections in vpanic() with a clean >> arch_do_panic() hook. Currently s390 and sparc embed their panic >> handlers directly in vpanic() using preprocessor conditionals, making >> the common code path harder to maintain. >> >> Introduce arch_do_panic() as an architecture extension point called at >> the end of vpanic(). Architectures can use this hook to implement their >> specific panic handling without polluting the generic panic code. >> >> Move s390 panic handling from the panic_notifier chain to >> arch_do_panic(). This corrects the execution order so that the >> panic_timeout is properly evaluated before architecture-specific >> actions. The previous notifier-based approach executed too early in the >> panic sequence. >> >> Move sparc panic handling from ifdef blocks to arch_do_panic(). Remove >> the preprocessor conditionals from vpanic() and place the Stop-A >> enablement code in architecture-specific files where it belongs. >> >> The cleanup reduces vpanic() complexity and establishes a pattern for other >> architectures needing custom panic behavior. >> >> Signed-off-by: Mete Durlu <[email protected]> >> --- >> Mete Durlu (3): >> panic: Introduce arch_do_panic >> s390: Implement arch_do_panic >> sparc: Implement arch_do_panic >> >> arch/s390/include/asm/setup.h | 3 +++ >> arch/s390/kernel/ipl.c | 15 +-------------- >> arch/sparc/include/asm/bug.h | 3 +++ >> arch/sparc/include/asm/setup.h | 1 - >> arch/sparc/kernel/setup.c | 8 ++++++++ >> kernel/panic.c | 18 ++++++------------ >> 6 files changed, 21 insertions(+), 27 deletions(-) > > Putting the define in a different header file per architecture doesn't > seem to be a good idea. There is no guarantee that this will work. So > either you find a common header file, where it is known that is (and > will be) included in panic.c, or you go with a weak function. I went over the headers included to panic.c, either they are really irrelevant or not present on other archs. To me the best candidate header seems like "asm/bug.h" $ find ./arch/ -name "bug.h" | grep include/asm | wc -l 16 $ ls ./arch | wc -l 22 # actually 21 as we shouldn't count Kconfig file The architectures missing bug.h in their include/asm/ directory are hexagon, microblaze, nios2, um and xtensa I believe 16/21 is a good ratio but if this is still not good enough, I'd like to fallback to __weak implementation. What do you think Heiko?