Re: [PATCH] printk: rebalance printk

From: Greg Kroah-Hartman
Date: Tue Aug 11 2015 - 14:16:16 EST


On Tue, Aug 11, 2015 at 07:23:01PM +0800, Pan Xinhui wrote:
> From: Pan Xinhui <xinhuix.pan@xxxxxxxxx>
>
> printk can be called in any context, It's very useful to output debug
> info.
>
> But it might cause very bad issues on some special cases. For example,
> some driver hit errors, and it dumps many messages like reg values, etc.
>
> Sometimes, printk is called when irqs disabled. This is OKay if there is
> a few messages. But What would happen if many messages outputted by other
> drivers at same time.
>
> Here is the scenario.
> CPUA CPUB
> local_irq_save(flags);
> printk()
> while(..) { --> console_unlock
> printk(...);
> //hundreds or thousands loops
> } //all messages flushed out to consoles
> local_irq_restore(flags);
>

Where are you seeing this type of scenario "in the wild"? Or is this
just a "debug/bringup hardware" issue? We shouldn't be ever stuck in a
printk that prints hundreds or thousands of loops, if so, we need to fix
the kernel code that does that, as we do have control over this.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/