On 2023-04-19, Petr Mladek <pmladek@xxxxxxxx> wrote: > A solution would be to make this more clear in the comment. > Something like: > > /* > * The printk_deferred_enter/exit macros are available only as a hack. > * They define a per-CPU context where all printk console printing > * is deferred because it might cause a deadlock otherwise. > * > * The API user is responsible for calling the corresponding enter/exit > * pair on the same CPU. It is highly recommended to use them only in > * a context with interrupts disabled. Otherwise, other unrelated > * printk() calls might be deferred when they interrupt/preempt > * the deferred code section. > */ I an happy with this comment. I saw Michal's follow-up suggestion, but would prefer this one. It is a more technical desciption of the issue and clearly recommends that the user should disable interrupts. If you use this comment: Reviewed-by: John Ogness <john.ogness@xxxxxxxxxxxxx> > Another solution would be to stay on the "safe" side and keep the > comment as is or even enforce disabling interrupts by the API. > > I would personally just improve the comment. It is good to describe > the situation correctly. We could always add restrictions when > there are problems in practice. Agreed. John