Skip to contentSkip to conversation

sched: set TAINT_UNSAFE_SMP after sleep-in-atomic bug

PATCH In review Konstantin Khlebnikov 2 participants 7 messages May 10, 2012 – May 18, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: set TAINT_UNSAFE_SMP after sleep-in-atomic bug

Usually sleep-in-atomic bugs are followed by dozens other warnings. This patch should help to figure out original source of problem. This taint flag also turns off lockdep, because it can go mad after that.

Original TAINT_UNSAFE_SMP is used only on various ancient buggy K7 Athlons. TAINT_UNSAFE_SMP is shown as 'S' in "Tainted" line, so let it be acronym for SMP, Scheduler and Sleep-in-atomic. Probably we should rename it into TAINT_SHIT, but TAINT_CRAP is already there. =)

---
 Documentation/oops-tracing.txt  |    2 +-
 Documentation/sysctl/kernel.txt |    1 +
 kernel/sched/core.c             |    1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
Documentation/oops-tracing.txt +1 -1
index 13032c0..ad9b9d8 100644
@@ -237,7 +237,7 @@ characters, each representing a particular tainted value.
   3: 'S' if the oops occurred on an SMP kernel running on hardware that
      hasn't been certified as safe to run multiprocessor.
      Currently this occurs only on various Athlons that are not
-     SMP capable.
+     SMP capable. Also cpu scheduler sets this after sleep-in-atomic bug.
 
   4: 'R' if a module was force unloaded by "rmmod -f", ' ' if all
      modules were unloaded normally.
Documentation/sysctl/kernel.txt +1 -0
index 6d78841..b573910 100644
@@ -590,6 +590,7 @@ can be ORed together:
    2 - A module was force loaded by insmod -f.
        Set by modutils >= 2.4.9 and module-init-tools.
    4 - Unsafe SMP processors: SMP with CPUs not designed for SMP.
+       Also cpu scheduler sets this after sleep-in-atomic bug.
    8 - A module was forcibly unloaded from the system by rmmod -f.
   16 - A hardware machine check error occurred on the system.
   32 - A bad page was discovered on the system.
kernel/sched/core.c +1 -0
index 0533a68..5e39914 100644
@@ -3113,6 +3113,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 	if (irqs_disabled())
 		print_irqtrace_events(prev);
 	dump_stack();
+	add_taint(TAINT_UNSAFE_SMP);
 }
 
 /*
#1 lore raw
Quoted 3 lines · Konstantin Khlebnikov

Usually sleep-in-atomic bugs are followed by dozens other warnings. This patch should help to figure out original source of problem. This taint flag also turns off lockdep, because it can go mad after that.

There's already TAINT_WARN any output with that set should be ignored.

#2 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 3 lines · Konstantin Khlebnikov

Usually sleep-in-atomic bugs are followed by dozens other warnings. This patch should help to figure out original source of problem. This taint flag also turns off lockdep, because it can go mad after that.

There's already TAINT_WARN any output with that set should be ignored.

Where? I do not see here anything which might set TAINT_WARN.

Or you suggest to use TAINT_WARN instead of TAINT_UNSAFE_SMP?

#3 lore raw
Quoted 11 lines · Konstantin Khlebnikov
Quoted 6 lines · Peter Zijlstra
Quoted 3 lines · Konstantin Khlebnikov

Usually sleep-in-atomic bugs are followed by dozens other warnings. This patch should help to figure out original source of problem. This taint flag also turns off lockdep, because it can go mad after that.

There's already TAINT_WARN any output with that set should be ignored.

Where? I do not see here anything which might set TAINT_WARN.

Or you suggest to use TAINT_WARN instead of TAINT_UNSAFE_SMP?

Gargh, yeah it doesn't use WARN and related infrastructure to print that msg so it missed out on the whole TAINT_WARN stuff.

Yeah, make it set TAINT_WARN or possibly convert the thing to use WARN.

#4 lore raw

PATCH v2 1/1 sched: taint kernel with TAINT_WARN after sleep-in-atomic bug

Usually sleep-in-atomic bugs are followed by dozens other warnings. This patch should help to figure out original source of problem.

---
 kernel/sched/core.c |    1 +
 1 file changed, 1 insertion(+)
kernel/sched/core.c +1 -0
index 0533a68..b6458e4 100644
@@ -3113,6 +3113,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 	if (irqs_disabled())
 		print_irqtrace_events(prev);
 	dump_stack();
+	add_taint(TAINT_WARN);
 }
 
 /*
#5 lore raw

Re: [PATCH v2] sched: taint kernel with TAINT_WARN after sleep-in-atomic bug

Quoted 4 lines · Konstantin Khlebnikov

Usually sleep-in-atomic bugs are followed by dozens other warnings. This patch should help to figure out original source of problem.

Thanks!

Quoted 17 lines
---
 kernel/sched/core.c |    1 +
 1 file changed, 1 insertion(+)
kernel/sched/core.c +1 -0
index 0533a68..b6458e4 100644
@@ -3113,6 +3113,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 	if (irqs_disabled())
 		print_irqtrace_events(prev);
 	dump_stack();
+	add_taint(TAINT_WARN);
 }
 
 /*
#6 lore raw

[tip:sched/core] sched: Taint kernel with TAINT_WARN after sleep-in-atomic bug

In reply to Konstantin Khlebnikov
Commit-ID:  1c2927f18576d65631d8e0ddd19e1d023183222e
Gitweb:     http://git.kernel.org/tip/1c2927f18576d65631d8e0ddd19e1d023183222e
Author:     Konstantin Khlebnikov <[email protected]>
AuthorDate: Thu, 10 May 2012 16:20:04 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 18 May 2012 13:07:40 +0200

sched: Taint kernel with TAINT_WARN after sleep-in-atomic bug

Usually sleep-in-atomic bugs are followed by dozens other warnings. This patch should help to figure out original source of problem.

---
 kernel/sched/core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/sched/core.c +1 -0
index 24ca677..ab9745f 100644
@@ -3138,6 +3138,7 @@ static noinline void __schedule_bug(struct task_struct *prev)
 	if (irqs_disabled())
 		print_irqtrace_events(prev);
 	dump_stack();
+	add_taint(TAINT_WARN);
 }
 
 /*