Re: [PATCH][RFC] printk: make pr_cont buffer per-cpu
From: Petr Mladek
Date: Thu Aug 25 2016 - 17:34:12 EST
On Thu 2016-08-25 23:27:40, Petr Mladek wrote:
> On Wed 2016-08-24 23:27:29, Sergey Senozhatsky wrote:
> > On (08/24/16 10:19), Petr Mladek wrote:
> > > > On (08/23/16 13:47), Petr Mladek wrote:
> > > > [..]
> > > > > > if (!(lflags & LOG_NEWLINE)) {
> > > > > > + if (!this_cpu_read(cont_printing)) {
> > > > > > + if (system_state == SYSTEM_RUNNING) {
> > > > > > + this_cpu_write(cont_printing, true);
> > > > > > + preempt_disable();
> > > > > > + }
> > > > > > + }
> > > > >
> > > > > I am afraid that this is not acceptable. It means that printk() will have
> > > > > an unexpected side effect. The missing "\n" at the end of a printed
> > > > > string would disable preemption. See below for more.
> > > >
> > > > missing '\n' must WARN about "sched while atomic" eventually, so it
> > > > shouldn't go unnoticed or stay hidden.
> > >
> > > Well, it will still force people to rebuilt a test kernel because they
> > > forget to use '\n" and the test kernel is unusable.
> >
> > you are right. misusage of printk() will now force user to go and fix
> > it. the kernel most likely will be rebuilt anyway - there is a missing
> > \n after all.
> Of course, it would be great to fix it transparently. But if there must
> be a burden, I would prefer to keep it on the "corner" case users
> rather than to push it on everyday users.
Not to say that a messed log is much less painful than a locked system.
Best Regards,
Petr