Hello, John Ogness <[email protected]> wrote on Wed, 3 Mar 2021 11:15:15 +0100:
> The kmsg_dumper can be called from any context and CPU, possibly > from multiple CPUs simultaneously. Since the writing of the buffer > can occur from a later scheduled work queue, the oops buffer must > be protected against simultaneous dumping. > > Use an atomic bit to mark when the buffer is protected. Release the > protection in between setting the buffer and the actual writing in > order for a possible panic (immediate write) to be written during > the scheduling of a previous oops (delayed write). > > An atomic bit (rather than a spinlock) was chosen so that no > scheduling or preemption side-effects would be introduced. The MTD > kmsg_dumper may dump directly or it may be delayed (via scheduled > work). Depending on the context, different MTD callbacks are used. > For example, mtd_write() expects to be called in a non-atomic > context and may take a mutex. > > Signed-off-by: John Ogness <[email protected]> > Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Miquel Raynal <[email protected]> Thanks, Miquèl

