Re: [PATCH v5 2/3] s390: Implement arch_do_panic()

[email protected]
Newsgroups org.kernel.vger.linux-s390
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The newly introduced `arch_do_panic()` hook is placed before the final console flushes, which causes the 'end Kernel panic' marker to remain unflushed in deferred printk contexts on s390.
--

--- Patch [2]: [PATCH v5 2/3] s390: Implement arch_do_panic() ---
commit b9b01d12abb499c817ce8c2a246d404e0331bf81
Author: Mete Durlu <[email protected]>

s390: Implement arch_do_panic()

This commit introduces a s390-specific arch_do_panic() implementation, removing
an ifdef section from vpanic(). It moves the disabled_wait() call so it occurs
after the "end Kernel panic" marker is printed.

> diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
> index 564403496a7ce..309d3d3e95fd9 100644
> --- a/arch/s390/kernel/traps.c
> +++ b/arch/s390/kernel/traps.c
[ ... ]
> @@ -275,6 +277,11 @@ static void monitor_event_exception(struct pt_regs *regs)
>  	}
>  }
>  
> +void arch_do_panic(void)
> +{
> +	disabled_wait();
> +}
> +

[Severity: Medium]
Will this prevent the final console flushes from executing on s390?

Looking at vpanic() in kernel/panic.c, arch_do_panic() is called before the
final console flushes:

	pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);

	arch_do_panic();
	/* Do not scroll important messages printed above */
	suppress_printk = 1;

	/*
	 * The final messages may not have been printed if in a context that
	 * defers printing (such as NMI) and irq_work is not available.
	 * Explicitly flush the kernel log buffer one last time.
	 */
	console_flush_on_panic(CONSOLE_FLUSH_PENDING);
	nbcon_atomic_flush_unsafe();

Since disabled_wait() puts the CPU into an infinite wait state, it never
returns to vpanic(). If the panic occurs in a context that defers printk
(such as an NMI), does this mean the "end Kernel panic" marker will remain
unflushed and not visible on the console?

>  void kernel_stack_invalid(struct pt_regs *regs)
>  {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.