linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/core: add taint on "BUG: sleeping function called from invalid context"
@ 2016-07-22 19:46 Vegard Nossum
  2016-07-29  1:22 ` Rusty Russell
  2016-08-10 18:14 ` [tip:sched/core] sched/debug: Add taint on "BUG: Sleeping " tip-bot for Vegard Nossum
  0 siblings, 2 replies; 5+ messages in thread
From: Vegard Nossum @ 2016-07-22 19:46 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Vegard Nossum, Paul E. McKenney, Thomas Gleixner,
	Ingo Molnar, Rusty Russel

Seeing this, it occurs to me that we should probably add a taint here:

    BUG: sleeping function called from invalid context at mm/slab.h:388
    in_atomic(): 0, irqs_disabled(): 0, pid: 32211, name: trinity-c3
    Preemption disabled at:[<ffffffff811aaa37>] console_unlock+0x2f7/0x930

    CPU: 3 PID: 32211 Comm: trinity-c3 Not tainted 4.7.0-rc7+ #19
                                       ^^^^^^^^^^^
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
     0000000000000000 ffff8800b8a17160 ffffffff81971441 ffff88011a3c4c80
     ffff88011a3c4c80 ffff8800b8a17198 ffffffff81158067 0000000000000de6
     ffff88011a3c4c80 ffffffff8390e07c 0000000000000184 0000000000000000
    Call Trace:
    [...]

    BUG: sleeping function called from invalid context at arch/x86/mm/fault.c:1309
    in_atomic(): 0, irqs_disabled(): 0, pid: 32211, name: trinity-c3
    Preemption disabled at:[<ffffffff8119db33>] down_trylock+0x13/0x80

    CPU: 3 PID: 32211 Comm: trinity-c3 Not tainted 4.7.0-rc7+ #19
                                       ^^^^^^^^^^^
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
     0000000000000000 ffff8800b8a17e08 ffffffff81971441 ffff88011a3c4c80
     ffff88011a3c4c80 ffff8800b8a17e40 ffffffff81158067 0000000000000000
     ffff88011a3c4c80 ffffffff83437b20 000000000000051d 0000000000000000
    Call Trace:
    [...]

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Rusty Russel <rusty@rustcorp.com.au>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 kernel/sched/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 97ee9ac..7171cf9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7573,6 +7573,7 @@ void ___might_sleep(const char *file, int line, int preempt_offset)
 	}
 #endif
 	dump_stack();
+	add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
 }
 EXPORT_SYMBOL(___might_sleep);
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/core: add taint on "BUG: sleeping function called from invalid context"
  2016-07-22 19:46 [PATCH] sched/core: add taint on "BUG: sleeping function called from invalid context" Vegard Nossum
@ 2016-07-29  1:22 ` Rusty Russell
  2016-07-29  6:29   ` Vegard Nossum
  2016-07-29 13:01   ` Thomas Gleixner
  2016-08-10 18:14 ` [tip:sched/core] sched/debug: Add taint on "BUG: Sleeping " tip-bot for Vegard Nossum
  1 sibling, 2 replies; 5+ messages in thread
From: Rusty Russell @ 2016-07-29  1:22 UTC (permalink / raw)
  To: Vegard Nossum, Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Vegard Nossum, Paul E. McKenney, Thomas Gleixner,
	Ingo Molnar

Vegard Nossum <vegard.nossum@oracle.com> writes:
> Seeing this, it occurs to me that we should probably add a taint here:

Taint has traditionally meant "the user did something unsupported, take
the bug report with a grain of salt".  Such as force removing a module.

So this seems wrong...

Cheers,
Rusty.


>
>     BUG: sleeping function called from invalid context at mm/slab.h:388
>     in_atomic(): 0, irqs_disabled(): 0, pid: 32211, name: trinity-c3
>     Preemption disabled at:[<ffffffff811aaa37>] console_unlock+0x2f7/0x930
>
>     CPU: 3 PID: 32211 Comm: trinity-c3 Not tainted 4.7.0-rc7+ #19
>                                        ^^^^^^^^^^^
>     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
>      0000000000000000 ffff8800b8a17160 ffffffff81971441 ffff88011a3c4c80
>      ffff88011a3c4c80 ffff8800b8a17198 ffffffff81158067 0000000000000de6
>      ffff88011a3c4c80 ffffffff8390e07c 0000000000000184 0000000000000000
>     Call Trace:
>     [...]
>
>     BUG: sleeping function called from invalid context at arch/x86/mm/fault.c:1309
>     in_atomic(): 0, irqs_disabled(): 0, pid: 32211, name: trinity-c3
>     Preemption disabled at:[<ffffffff8119db33>] down_trylock+0x13/0x80
>
>     CPU: 3 PID: 32211 Comm: trinity-c3 Not tainted 4.7.0-rc7+ #19
>                                        ^^^^^^^^^^^
>     Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
>      0000000000000000 ffff8800b8a17e08 ffffffff81971441 ffff88011a3c4c80
>      ffff88011a3c4c80 ffff8800b8a17e40 ffffffff81158067 0000000000000000
>      ffff88011a3c4c80 ffffffff83437b20 000000000000051d 0000000000000000
>     Call Trace:
>     [...]
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Rusty Russel <rusty@rustcorp.com.au>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
>  kernel/sched/core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 97ee9ac..7171cf9 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7573,6 +7573,7 @@ void ___might_sleep(const char *file, int line, int preempt_offset)
>  	}
>  #endif
>  	dump_stack();
> +	add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
>  }
>  EXPORT_SYMBOL(___might_sleep);
>  #endif
> -- 
> 1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/core: add taint on "BUG: sleeping function called from invalid context"
  2016-07-29  1:22 ` Rusty Russell
@ 2016-07-29  6:29   ` Vegard Nossum
  2016-07-29 13:01   ` Thomas Gleixner
  1 sibling, 0 replies; 5+ messages in thread
From: Vegard Nossum @ 2016-07-29  6:29 UTC (permalink / raw)
  To: Rusty Russell, Ingo Molnar, Peter Zijlstra
  Cc: linux-kernel, Paul E. McKenney, Thomas Gleixner, Ingo Molnar

On 07/29/2016 03:22 AM, Rusty Russell wrote:
> Vegard Nossum <vegard.nossum@oracle.com> writes:
>> Seeing this, it occurs to me that we should probably add a taint here:
>
> Taint has traditionally meant "the user did something unsupported, take
> the bug report with a grain of salt".  Such as force removing a module.
>
> So this seems wrong...

There are many types of taints. This is the one you mentioned:

    2 - A module was force loaded by insmod -f.

This is the one I'd like to set:

  512 - A kernel warning has occurred.

(from Documentation/sysctl/kernel.txt).

The flag I want to set is also set on any kind of WARN().

>>      BUG: sleeping function called from invalid context at mm/slab.h:388
>>      in_atomic(): 0, irqs_disabled(): 0, pid: 32211, name: trinity-c3
>>      Preemption disabled at:[<ffffffff811aaa37>] console_unlock+0x2f7/0x930

I am not proposing this patch on a whim: it was actually hiding real
bugs because I only saw an oops that happened later when in fact the
real bug happened where the "sleeping function called from invalid
context" was called.


Vegard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sched/core: add taint on "BUG: sleeping function called from invalid context"
  2016-07-29  1:22 ` Rusty Russell
  2016-07-29  6:29   ` Vegard Nossum
@ 2016-07-29 13:01   ` Thomas Gleixner
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2016-07-29 13:01 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Vegard Nossum, Ingo Molnar, Peter Zijlstra, linux-kernel,
	Paul E. McKenney, Ingo Molnar

On Fri, 29 Jul 2016, Rusty Russell wrote:
> Vegard Nossum <vegard.nossum@oracle.com> writes:
> > Seeing this, it occurs to me that we should probably add a taint here:
> 
> Taint has traditionally meant "the user did something unsupported, take
> the bug report with a grain of salt".  Such as force removing a module.

We have changed the meaning of taint quite some time ago. It also denotes
e.g. that there was a bug, warning etc. So it's not necessarily 'user did
something wrong'.

It's very helpful to see that there was already a warnon/bug before the
backtrace you get from the reporter.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:sched/core] sched/debug: Add taint on "BUG: Sleeping function called from invalid context"
  2016-07-22 19:46 [PATCH] sched/core: add taint on "BUG: sleeping function called from invalid context" Vegard Nossum
  2016-07-29  1:22 ` Rusty Russell
@ 2016-08-10 18:14 ` tip-bot for Vegard Nossum
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Vegard Nossum @ 2016-08-10 18:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: paulmck, mingo, akpm, linux-kernel, tglx, rusty, efault,
	vegard.nossum, peterz, torvalds, hpa

Commit-ID:  f0b22e39e3409109d40ef036b1f46b419e82f58e
Gitweb:     http://git.kernel.org/tip/f0b22e39e3409109d40ef036b1f46b419e82f58e
Author:     Vegard Nossum <vegard.nossum@oracle.com>
AuthorDate: Fri, 22 Jul 2016 21:46:02 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 10 Aug 2016 16:13:48 +0200

sched/debug: Add taint on "BUG: Sleeping function called from invalid context"

Seeing this, it occurs to me that we should probably add a taint here:

    BUG: sleeping function called from invalid context at mm/slab.h:388
    in_atomic(): 0, irqs_disabled(): 0, pid: 32211, name: trinity-c3
    Preemption disabled at:[<ffffffff811aaa37>] console_unlock+0x2f7/0x930

    CPU: 3 PID: 32211 Comm: trinity-c3 Not tainted 4.7.0-rc7+ #19
                                       ^^^^^^^^^^^
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
     0000000000000000 ffff8800b8a17160 ffffffff81971441 ffff88011a3c4c80
     ffff88011a3c4c80 ffff8800b8a17198 ffffffff81158067 0000000000000de6
     ffff88011a3c4c80 ffffffff8390e07c 0000000000000184 0000000000000000
    Call Trace:
    [...]

    BUG: sleeping function called from invalid context at arch/x86/mm/fault.c:1309
    in_atomic(): 0, irqs_disabled(): 0, pid: 32211, name: trinity-c3
    Preemption disabled at:[<ffffffff8119db33>] down_trylock+0x13/0x80

    CPU: 3 PID: 32211 Comm: trinity-c3 Not tainted 4.7.0-rc7+ #19
                                       ^^^^^^^^^^^
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
     0000000000000000 ffff8800b8a17e08 ffffffff81971441 ffff88011a3c4c80
     ffff88011a3c4c80 ffff8800b8a17e40 ffffffff81158067 0000000000000000
     ffff88011a3c4c80 ffffffff83437b20 000000000000051d 0000000000000000
    Call Trace:
    [...]

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rusty Russel <rusty@rustcorp.com.au>
Link: http://lkml.kernel.org/r/1469216762-19626-1-git-send-email-vegard.nossum@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a656816..3b6b23c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7608,6 +7608,7 @@ void ___might_sleep(const char *file, int line, int preempt_offset)
 		pr_cont("\n");
 	}
 	dump_stack();
+	add_taint(TAINT_WARN, LOCKDEP_STILL_OK);
 }
 EXPORT_SYMBOL(___might_sleep);
 #endif

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-10 20:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-22 19:46 [PATCH] sched/core: add taint on "BUG: sleeping function called from invalid context" Vegard Nossum
2016-07-29  1:22 ` Rusty Russell
2016-07-29  6:29   ` Vegard Nossum
2016-07-29 13:01   ` Thomas Gleixner
2016-08-10 18:14 ` [tip:sched/core] sched/debug: Add taint on "BUG: Sleeping " tip-bot for Vegard Nossum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).