Re: synchronization model: was: Re: [PATCH printk-rework 09/14] printk: introduce a kmsg_dump iterator

John Ogness
2021-02-26T08:41:10Z

On 2021-02-25, Petr Mladek <pmladek@suse.com> wrote:
> IMHO, a better design would be:
>
> 1. dumper->dump() callback should have only one parameter @reason.
> The callback should define its own iterator, buffer, and
> do the dump.

Unfortunately this won't work because drivers/mtd/mtdoops.c is using the
dumper parameter for container_of().

So we will need 2 parameters: dumper and reason.

Can we agree to proceed with 2 parameters in the callback?

> 2. dumpe->dump() callback should synchronize the entire operation
> using its own locks. Only the callback knows whether it is
> safe to do more dumps in parallel. Only the callback knows
> whether it is called only during panic() when no locks
> are needed.

Agreed. I implemented this part for the v3 series.

John Ogness