Re: [PATCH] arm64: kexec: flush log to console in nmi_panic()
From: Will Deacon
Date: Mon Jun 21 2021 - 06:08:45 EST
On Fri, Jun 18, 2021 at 09:03:26AM +0000, Huang Shijie wrote:
> On Thu, Jun 17, 2021 at 06:58:23PM +0100, Will Deacon wrote:
> > On Thu, Jun 17, 2021 at 01:55:08PM -0400, Pavel Tatashin wrote:
> > > On Thu, Jun 17, 2021 at 1:52 PM Will Deacon <will@xxxxxxxxxx> wrote:
> > > >
> > > > On Thu, Jun 17, 2021 at 12:50:23PM +0000, Huang Shijie wrote:
> > > > > If kdump is configured, nmi_panic() may run to machine_kexec().
> > > > >
> > > > > But in NMI context, the log is put in PER-CPU nmi_print_seq.
> > > > > So we can not see any log on the console since we entered the NMI context,
> > > > > such as the "Bye!" in previous line.
> > > > >
> > > > > This patch fixes this issue by two steps:
> > > > > 1) Uses printk_safe_flush_on_panic() to flush the log from
> > > > > nmi_print_seq to global printk ring buffer,
> > > > > 2) Then uses console_flush_on_panic() to flush to console.
> > > > >
> > > > > After this patch, we can see the "Bye!" log in the panic console.
> > > >
> > > > Does it matter? I'd be more inclined to remove the print altogether...
> We may remove the log in the arm64 code.
>
> But in the panic() itself, it still has many log, such as:
>
> ..............
> pr_emerg("Kernel panic - not syncing: %s\n", buf);
> ..............
> dump_stack();
> ..............
> kdb_printf("PANIC: %s\n", msg);
>
> Without this patch, all these log above will loss..
>
> > >
> > > I agree, the print could be removed entirely. But, my assumption was
> > > that this patch meant to flush other buffered prints beside this last
> > > "Bye" one.
> >
> > That sounds like something which should be done in the core code, rather
> > than the in the architecture backend (and looks like panic() might do this
> > already?)
> In the non-kdump code path, the core code will take care of it, please read the
> code in panic().
>
> But in the kdump code path, the architecture code should take care of it.
Why the discrepancy? Wouldn't it make more sense to do this in panic() for
both cases, if the prints that we want to display are coming from panic()
itself?
Will