All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Hurley <peter@hurleysoftware.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ilya Dryomov <ilya.dryomov@inktank.com>,
	Mike Galbraith <umgwanakikbuti@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>
Subject: Re: Linux 3.19-rc5
Date: Thu, 5 Feb 2015 22:14:36 +0100	[thread overview]
Message-ID: <20150205221436.01bc24f2@neptune.home> (raw)
In-Reply-To: <CA+55aFxYo1fpVoGVXhA0VPNAKKEZPAQDpF47pk+yPSnArvDEdA@mail.gmail.com>

On Thu, 29 January 2015 Linus Torvalds wrote:
> On Thu, Jan 29, 2015 at 5:12 PM, Linus Torvalds wrote:
> >
> > The WARN() was already changed to a WARN_ONCE().
> 
> Oh, but I notice that the "__set_current_state(TASK_RUNNING) ends up
> always happening.
> 
> So I think the right fix is to:
> 
>  - warn once like we do
> 
>  - but *not* do that __set_current_state() which was always total crap anyway
> 
> Why do I say "total crap"? Because of two independent issues:
> 
>  (a) it actually changes behavior for a debug vs non-debug kernel,
> which is a really bad idea to begin with
> 
>  (b) it's really wrong. The whole "nested sleep" case was never a
> major bug to begin with, just a possible inefficiency where constant
> nested sleeps would possibly make the outer sleep not sleep. But that
> "could possibly make" case was the unlikely case, and the debug patch
> made it happen *all* the time by explicitly setting things running.
> 
> So I think the proper patch is the attached.
> 
> The comment is also crap. The comment says
> 
>     "Blocking primitives will set (and therefore destroy) current->state [...]"
> 
> but the reality is that they *may* set it, and only in the unlikely
> slow-path where they actually block.
> 
> So doing this in "__may_sleep()" is just bogus and horrible horrible
> crap. It turns the "harmless ugliness" into a real *harmful* bug. The
> key word of "__may_sleep()" is that "MAY" part. It's a debug thing to
> make relatively rare cases show up.
> 
> PeterZ, please don't make "debugging" patches like this. Ever again.
> Because this was just stupid, and it took me too long to realize that
> despite the warning being shut up, the debug patch was still actively
> doing bad bad things.
> 
> Ingo, maybe you'd want to apply this through the scheduler tree, the
> way you already did the WARN_ONCE() thing.
> 
> Bruno, does this finally actually fix your pccard thing?

Tested the variant that was applied by running rc7 and it fixes the
endless loop.
The loop is now replaced by a single WARN() trace - I guess expected:

[    3.083647] ------------[ cut here ]------------
[    3.087477] WARNING: CPU: 0 PID: 67 at /usr/src/linux-git/kernel/sched/core.c:7300 __might_sleep+0x79/0x90()
[    3.091357] do not call blocking ops when !TASK_RUNNING; state=1 set at [<c1442040>] pccardd+0xa0/0x3e0
[    3.095232] Modules linked in:
[    3.099020] CPU: 0 PID: 67 Comm: pccardd Not tainted 3.19.0-rc7-00003-g67288c4 #17
[    3.102760] Hardware name: Acer TravelMate 660/TravelMate 660, BIOS 3A19 01/14/2004
[    3.106504]  c212def4 c212def4 c212deb4 c16caf23 c212dee4 c10416fd c1907334 c212df10
[    3.110315]  00000043 c1907380 00001c84 c105a099 c105a099 c1442040 00000001 f5f54bc0
[    3.114143]  c212defc c104176e 00000009 c212def4 c1907334 c212df10 c212df30 c105a099
[    3.117960] Call Trace:
[    3.121703]  [<c16caf23>] dump_stack+0x16/0x18
[    3.125447]  [<c10416fd>] warn_slowpath_common+0x7d/0xc0
[    3.129172]  [<c105a099>] ? __might_sleep+0x79/0x90
[    3.132868]  [<c105a099>] ? __might_sleep+0x79/0x90
[    3.136500]  [<c1442040>] ? pccardd+0xa0/0x3e0
[    3.140092]  [<c104176e>] warn_slowpath_fmt+0x2e/0x30
[    3.143657]  [<c105a099>] __might_sleep+0x79/0x90
[    3.147209]  [<c1442040>] ? pccardd+0xa0/0x3e0
[    3.150747]  [<c1442040>] ? pccardd+0xa0/0x3e0
[    3.154256]  [<c16cf447>] mutex_lock+0x17/0x2a
[    3.157734]  [<c1442089>] pccardd+0xe9/0x3e0
[    3.161207]  [<c1441fa0>] ? pcmcia_socket_uevent+0x30/0x30
[    3.164660]  [<c1056990>] kthread+0xa0/0xc0
[    3.168059]  [<c16d1040>] ret_from_kernel_thread+0x20/0x30
[    3.171436]  [<c10568f0>] ? kthread_worker_fn+0x140/0x140
[    3.174796] ---[ end trace c3f708b642e3d8f0 ]---

>From my reading of the thread fixing pccardd/sched TASK_RUNNING usage/check
is another issue left for the future.

Thanks,
Bruno

>                               Linus

  parent reply	other threads:[~2015-02-05 21:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18  9:17 Linux 3.19-rc5 Linus Torvalds
2015-01-19 18:02 ` Bruno Prémont
2015-01-20  6:24   ` Linus Torvalds
2015-01-21 20:37     ` Bruno Prémont
2015-01-21 21:37       ` Bruno Prémont
2015-01-21 22:12         ` Davidlohr Bueso
2015-01-21 22:54           ` Peter Hurley
2015-01-30  1:22             ` Rafael J. Wysocki
2015-01-30  1:12               ` Linus Torvalds
2015-01-30  1:25                 ` Linus Torvalds
2015-01-30  1:35                   ` Linus Torvalds
2015-01-30  2:06                   ` Rafael J. Wysocki
2015-01-30 15:47                   ` Oleg Nesterov
2015-01-31 18:32                     ` Linus Torvalds
2015-01-31 20:16                       ` Peter Zijlstra
2015-01-31 21:54                         ` Linus Torvalds
2015-02-02 13:19                           ` Peter Zijlstra
2015-02-01 19:43                         ` Oleg Nesterov
2015-02-01 20:09                           ` Linus Torvalds
2015-02-01 20:19                             ` Oleg Nesterov
2015-02-02 15:34                             ` Peter Zijlstra
2015-01-31  9:16                   ` Bruno Prémont
2015-01-31  9:48                   ` Peter Zijlstra
2015-02-03 11:18                     ` Ingo Molnar
2015-02-05 21:14                   ` Bruno Prémont [this message]
2015-02-06 11:50                     ` Peter Zijlstra
2015-02-06 16:02                       ` Linus Torvalds
2015-02-06 16:39                         ` Peter Zijlstra
2015-02-06 16:46                           ` Linus Torvalds
2015-01-30  1:49                 ` Rafael J. Wysocki
2015-02-02  9:48                   ` Zdenek Kabelac

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=20150205221436.01bc24f2@neptune.home \
    --to=bonbons@linux-vserver.org \
    --cc=dave@stgolabs.net \
    --cc=ilya.dryomov@inktank.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peter@hurleysoftware.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=umgwanakikbuti@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.