lkml.org 
[lkml]   [2015]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:locking/core] sched/wait: Fix signal handling in bit wait helpers




----- Original Message -----
> From: "Peter Zijlstra" <peterz@infradead.org>
> To: "Paul Turner" <pjt@google.com>
> Cc: "NeilBrown" <nfbrown@novell.com>, "Linus Torvalds" <torvalds@linux-foundation.org>, "Thomas Gleixner"
> <tglx@linutronix.de>, "LKML" <linux-kernel@vger.kernel.org>, "Mike Galbraith" <efault@gmx.de>, "Ingo Molnar"
> <mingo@kernel.org>, "Peter Anvin" <hpa@zytor.com>, "vladimir murzin" <vladimir.murzin@arm.com>,
> linux-tip-commits@vger.kernel.org, jstancek@redhat.com, "Oleg Nesterov" <oleg@redhat.com>
> Sent: Friday, 11 December, 2015 12:39:59 PM
> Subject: Re: [tip:locking/core] sched/wait: Fix signal handling in bit wait helpers
>
> On Fri, Dec 11, 2015 at 03:30:33AM -0800, Paul Turner wrote:
>
> > > Blergh, all I've managed to far is to confuse myself further. Even
> > > something like the original (+- the EINTR) should work when we consider
> > > the looping, even when mixed with an occasional spurious wakeup.
> > >
> > >
> > > int bit_wait()
> > > {
> > > if (signal_pending_state(current->state, current))
> > > return -EINTR;
> > > schedule();
> > > }
>
> So I asked Vladimir to test that (simply changing the return from 1 to
> -EINTR) and it made his fail much less likely but it still failed in the
> same way.
>
> So I'm fairly sure I'm still missing something :/
>
> > Hugh asked me about this after seeing a crash, here's another exciting
> > way in which the current code breaks -- this one actually quite
> > serious:
>
> Yep, this got reported by Jan and I did kick myself for that.
>
> > Peter's proposed follow-up above looks strictly more correct. We need
> > to evaluate the potential existence of a signal, *after* we return
> > from schedule, but in the context of the state which we previously
> > _entered_ schedule() on.
> >
> > Reviewed-by: Paul Turner <pjt@google.com>
>
> Right, its maybe a bit overkill, but at this point I'm a tad
> conservative/paranoid.
>
> Vladimir, Jan could you both please that patch?
>
> lkml.kernel.org/r/20151208104712.GJ6356@twins.programming.kicks-ass.net

This appears to exactly match patch I tested against v4.4-rc4 here:
http://marc.info/?l=linux-mm&m=144950957622869&w=2

Anyway, I repeated the test with v4.4-rc4-113-g0bd0f1e as base.
Results look good. With patch applied, I can't trigger
"kernel BUG at mm/filemap.c:238!" anymore.

Regards,
Jan

>
>
> Thanks!
>
>
>


\
 
 \ /
  Last update: 2015-12-11 14:41    [W:0.088 / U:1.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site