Re: [RFC][PATCH -next 2/2] printk: set may_schedule for some of console_trylock callers
From: Petr Mladek
Date: Wed Jan 20 2016 - 07:38:30 EST
On Wed 2016-01-20 20:51:43, Sergey Senozhatsky wrote:
> On (01/20/16 12:50), Sergey Senozhatsky wrote:
> > > Hmm, the notifiers are called via __raw_notifier_call_chain().
> > > There is a comment above this function:
> > >
> > > * Calls each function in a notifier chain in turn. The functions
> > > * run in an undefined context.
> > > * All locking must be provided by the caller.
> > >
> > > But hmm, you are right that the notifiers do malloc, take mutextes,
> > > etc. The question is if schedule does something in this case. I would
> > > expect that the is no running task assigned to this CPU at this stage.
> > > So, cond_resched is probably a noop in this case.
> I did some modifications to notifier, just to check how real that theoretical
> race condition can possible be.
After all I think that this was a false alarm. As you said, there are
used locks in the notifiers. I do not see any special handling of
preemption. If the locks do not care about this special CPU state
and rescheduling, printk should not need to take care of it as well.
In each case, thanks a lot for the analyze. These are all interesting
things and any piece of information helps better understanding.