Re: [PATCH v3 0/6] allow ramoops to collect all kmesg_dump events

From: Kees Cook
Date: Wed May 13 2020 - 16:15:36 EST


On Wed, May 13, 2020 at 10:35:16AM -0400, Pavel Tatashin wrote:
> > > + reason: panic, oops, emergency, shutdown (ordered by severity)
> > > + handling: restart, halt, poweroff
> > >
> > > Or we might just replace KMSG_DUMP_RESTART, KMSG_DUMP_HALT,
> > > KMSG_DUMP_POWEROFF with a single KMSG_DUMP_SHUTDOWN.
> > >
> > > Then the max reason variable would make sense.
> >
> > That would work for me, yeah. Pavel, is that enough granularity for you?
> >
>
> Yes, I like the second approach: where we combine all shutdown type
> events into a single type.
> max_reason will have 4 levels:
>
> KMSG_DUMP_PANIC,
> KMSG_DUMP_OOPS,
> KMSG_DUMP_EMERG,
> KMSG_DUMP_SHUTDOWN,
>
> If needed it is possible to determine from dmesg logs what kind of
> shutdown was taken, because there is a message logged right before
> every kmsg_dump() for these events:
>
> 249 if (!cmd)
> 250 pr_emerg("Restarting system\n");
> 251 else
> 252 pr_emerg("Restarting system with command '%s'\n", cmd);
> 253 kmsg_dump(KMSG_DUMP_RESTART);
>
> 276 pr_emerg("System halted\n");
> 277 kmsg_dump(KMSG_DUMP_HALT);
>
> 294 pr_emerg("Power down\n");
> 295 kmsg_dump(KMSG_DUMP_POWEROFF);
>
> Kees, I will submit a new series with these changes soon.

Great; thanks!

-Kees

--
Kees Cook