public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: chas williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
	netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	lkp@01.org, linux-atm-general@lists.sourceforge.net
Subject: Re: [setsockopt] WARNING: CPU: 0 PID: 1444 at kernel/sched/core.c:7088 __might_sleep+0x51/0x16f()
Date: Thu, 7 Aug 2014 19:25:14 +0200	[thread overview]
Message-ID: <20140807172514.GY9918@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140807125948.2b7f1472@thirdoffive.cmf.nrl.navy.mil>

[-- Attachment #1: Type: text/plain, Size: 2093 bytes --]

On Thu, Aug 07, 2014 at 12:59:48PM -0400, chas williams - CONTRACTOR wrote:
> On Thu, 7 Aug 2014 17:17:41 +0200
> Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > Subject: atm: Fix blocking in wait loop
> > 
> > One should not call blocking primitives inside a wait loop, since both
> > require task_struct::state to sleep, so the inner will destroy the outer
> > state.
> > 
> > In this instance sigd_enq() will possible sleep for alloc_skb(), now if
> > I understand the code right, we do not actually need to call sigd_enq()
> > after the initial prepare_to_wait(), because we test the termination
> > condition before schedule() anyhow.
> > 
> > So we can simply move it up a bit and avoid the entire confusion.
> > 
> > Signed-off-by: Peter Zijlstra <peterz@infradead.org>
> > ---
> >  net/atm/svc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/atm/svc.c b/net/atm/svc.c
> > index d8e5d0c2ebbc..445ac238b69b 100644
> > --- a/net/atm/svc.c
> > +++ b/net/atm/svc.c
> > @@ -297,8 +297,8 @@ static int svc_listen(struct socket *sock, int backlog)
> >  		goto out;
> >  	}
> >  	set_bit(ATM_VF_WAITING, &vcc->flags);
> > -	prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE);
> >  	sigd_enq(vcc, as_listen, NULL, NULL, &vcc->local);
> > +	prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE);
> >  	while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) {
> >  		schedule();
> >  		prepare_to_wait(sk_sleep(sk), &wait, TASK_UNINTERRUPTIBLE);
> 
> 
> This isn't the only place that we queue a message for the signalling
> daemon after a prepare_to_wait() uninterruptibly so this patch would
> be incomplete as is.

I'm not sure I follow, this is the only place you do so while then going
to sleep. All other sites don't sleep while they're enqueued on the
waitqueue.

> What bothers me is the TASK_UNINTERRUPTIBLE -- I don't have a good
> reason why any of these should be sleeping uninterruptibly.

That's a whole different story, there's tons of ugly in there, but its
all ancient code.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-08-07 17:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 21:46 [setsockopt] WARNING: CPU: 0 PID: 1444 at kernel/sched/core.c:7088 __might_sleep+0x51/0x16f() Fengguang Wu
2014-08-05 21:54 ` Fengguang Wu
2014-08-07 15:17 ` Peter Zijlstra
2014-08-07 16:59   ` chas williams - CONTRACTOR
2014-08-07 17:25     ` Peter Zijlstra [this message]
2014-08-07 17:29       ` Peter Zijlstra
2014-08-12 12:12         ` [PATCH] atm/svc: Fix blocking in wait loop chas williams - CONTRACTOR
2014-08-12 22:02           ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140807172514.GY9918@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=fengguang.wu@intel.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox