On Tue, Nov 25, 2014 at 12:48 AM, Taylor R Campbell <campbell+netbsd-tech-k...@mumble.net> wrote: > Date: Tue, 25 Nov 2014 00:42:58 +0900 > From: Masao Uebayashi <uebay...@gmail.com> > > On Mon, Nov 24, 2014 at 11:16 PM, Taylor R Campbell > <campbell+netbsd-tech-k...@mumble.net> wrote: > > Date: Mon, 24 Nov 2014 15:26:21 +0900 > > From: Masao Uebayashi <uebay...@gmail.com> > > > > I think pserialize_read_{enter,exit}() should explicitly call > > KPREEMPT_{DISABLE,ENABLE}(), as is done in percpu_{getref,putref}(). > > > > Not necessary -- splsoftserial is sufficient to prevent switching, and > > is necessary to block the pserialize cross-call until the reader is > > finished. > > I want stronger constraint than softint context. Softint prevents > threads from being preempted implicitly, but still allows to sleep. I > want pserialize(9)'ed readers to never sleep (critical section). > KPREEMPT_DISABLE() (and kpreempt_disable()) sets l_noprempt. Which > seems the official way to declare entering critical section. > > Different kinds of critical section. Neither one actually prevents > sleep. It would be nice if pserialize_read and percpu communicated > with ASSERT_SLEEPABLE, but that's not the case right now.
Right, I misread assertions in mi_switch().... Maybe separating l_nopreempt into that of internal (scheduler) reason and anything else helps?