diff options
| author | Josh Poimboeuf <jpoimboe@redhat.com> | 2016-03-17 17:23:04 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 18:09:34 -0400 |
| commit | 2553b67a1fbe7bf202e4e8070ab0b00d3d3a06a2 (patch) | |
| tree | fc3ae8145246c0914b83693988f3d9f1a695d9bb /lib | |
| parent | 4cc7ecb7f2a60e8deb783b8fbf7c1ae467acb920 (diff) | |
lib/bug.c: use common WARN helper
The traceoff_on_warning option doesn't have any effect on s390, powerpc,
arm64, parisc, and sh because there are two different types of WARN
implementations:
1) The above mentioned architectures treat WARN() as a special case of a
BUG() exception. They handle warnings in report_bug() in lib/bug.c.
2) All other architectures just call warn_slowpath_*() directly. Their
warnings are handled in warn_slowpath_common() in kernel/panic.c.
Support traceoff_on_warning on all architectures and prevent any future
divergence by using a single common function to emit the warning.
Also remove the '()' from '%pS()', because the parentheses look funky:
[ 45.607629] WARNING: at /root/warn_mod/warn_mod.c:17 .init_dummy+0x20/0x40 [warn_mod]()
Reported-by: Chunyu Hu <chuhu@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/bug.c | 26 |
1 files changed, 2 insertions, 24 deletions
| @@ -167,30 +167,8 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) | |||
| 167 | 167 | ||
| 168 | if (warning) { | 168 | if (warning) { |
| 169 | /* this is a WARN_ON rather than BUG/BUG_ON */ | 169 | /* this is a WARN_ON rather than BUG/BUG_ON */ |
| 170 | pr_warn("------------[ cut here ]------------\n"); | 170 | __warn(file, line, (void *)bugaddr, BUG_GET_TAINT(bug), regs, |
| 171 | 171 | NULL); | |
| 172 | if (file) | ||
| 173 | pr_warn("WARNING: at %s:%u\n", file, line); | ||
| 174 | else | ||
| 175 | pr_warn("WARNING: at %p [verbose debug info unavailable]\n", | ||
| 176 | (void *)bugaddr); | ||
| 177 | |||
| 178 | if (panic_on_warn) { | ||
| 179 | /* | ||
| 180 | * This thread may hit another WARN() in the panic path. | ||
| 181 | * Resetting this prevents additional WARN() from | ||
| 182 | * panicking the system on this thread. Other threads | ||
| 183 | * are blocked by the panic_mutex in panic(). | ||
| 184 | */ | ||
| 185 | panic_on_warn = 0; | ||
| 186 | panic("panic_on_warn set ...\n"); | ||
| 187 | } | ||
| 188 | |||
| 189 | print_modules(); | ||
| 190 | show_regs(regs); | ||
| 191 | print_oops_end_marker(); | ||
| 192 | /* Just a warning, don't kill lockdep. */ | ||
| 193 | add_taint(BUG_GET_TAINT(bug), LOCKDEP_STILL_OK); | ||
| 194 | return BUG_TRAP_TYPE_WARN; | 172 | return BUG_TRAP_TYPE_WARN; |
| 195 | } | 173 | } |
| 196 | 174 | ||
