Re: [PATCH v3 4/4] kdb: Adapt kdb_msg_write to work with NBCON consoles
From: Petr Mladek
Date: Tue Sep 09 2025 - 11:04:03 EST
On Tue 2025-09-09 16:29:50, John Ogness wrote:
> On 2025-09-09, Petr Mladek <pmladek@xxxxxxxx> wrote:
> > The problem is that wctxt->unsafe_takeover would need to get updated
> > after acquiring the context. And might be reused for different
> > consoles, ...
>
> You are right. I think it is best to make nbcon_write_context_set_buf()
> available.
I am fine with it.
> > But wait. I do not see any code using wctxt->unsafe_takeover.
> >
> > It seems that the motivation was that console drivers might
> > do something else when there was an unsafe_takeover in the past,
> > see https://lore.kernel.org/lkml/87cyz6ro62.fsf@xxxxxxxxxxxxxxxxxxxxx/
> > But it seems that no console driver is using it.
> >
> > So, I would prefer to remove the "unsafe_takeover" field from
> > struct nbcon_write_context and keep this kdb code as it is now.
>
> No one is using it because the nbcon drivers are still implementing the
> "hope and pray" model on unsafe takeovers. The flag is an important part
> of the API to allow drivers to maximize their safety.
>
> I think it is too early to remove the flag when there are still so few
> nbcon drivers in existance.
I feel that that I should be more strict and push for removing
the flag because it is not used and complicates the design.
I am sure that there are cleaner ways how to provide
the information when anyone would need it.
But I do not want to fight for it. It is not worth a blood
(changing code back and forth). I am fine with exporting
nbcon_write_context_set_buf() for now. We might know more
about real users next time it causes problems ;-)
Best Regards,
Petr