All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Blanchard <anton@samba.org>
To: akpm@linux-foundation.org, mingo@elte.hu, arjan@linux.intel.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] Make lib/bug.c WARN implementation match the kernel/panic.c one
Date: Sun, 27 Jun 2010 05:10:59 +1000	[thread overview]
Message-ID: <20100626191059.GA2345@kryten> (raw)


There are a few issues with the exception based WARN implementation in
lib/bug.c:

- Inconsistent printk flags. The "cut here" line is printed at KERN_EMERG, so
  the console and all logged in users see the single line:

------------[ cut here ]------------

  for each WARN. Fix this so we print everything at KERN_WARNING to match the
  kernel/panic.c version.

- The lib/bug.c WARN would print "Badness at". Change it to match the
  kernel/panic.c version which prints "WARNING: at". 

- Print the list of modules, similar to kernel/panic.c of modules, similar to
  kernel/panic.c

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Index: linux-2.6/lib/bug.c
===================================================================
--- linux-2.6.orig/lib/bug.c	2010-06-26 06:09:59.000000000 +1000
+++ linux-2.6/lib/bug.c	2010-06-26 06:24:28.000000000 +1000
@@ -136,8 +136,6 @@ enum bug_trap_type report_bug(unsigned l
 
 	bug = find_bug(bugaddr);
 
-	printk(KERN_EMERG "------------[ cut here ]------------\n");
-
 	file = NULL;
 	line = 0;
 	warning = 0;
@@ -156,19 +154,24 @@ enum bug_trap_type report_bug(unsigned l
 
 	if (warning) {
 		/* this is a WARN_ON rather than BUG/BUG_ON */
+		printk(KERN_WARNING "------------[ cut here ]------------\n");
+
 		if (file)
-			printk(KERN_ERR "Badness at %s:%u\n",
+			printk(KERN_WARNING "WARNING: at %s:%u\n",
 			       file, line);
 		else
-			printk(KERN_ERR "Badness at %p "
+			printk(KERN_WARNING "WARNING: at %p "
 			       "[verbose debug info unavailable]\n",
 			       (void *)bugaddr);
 
+        	print_modules();
 		show_regs(regs);
 		add_taint(BUG_GET_TAINT(bug));
 		return BUG_TRAP_TYPE_WARN;
 	}
 
+	printk(KERN_EMERG "------------[ cut here ]------------\n");
+
 	if (file)
 		printk(KERN_CRIT "kernel BUG at %s:%u!\n",
 		       file, line);

             reply	other threads:[~2010-06-26 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-26 19:10 Anton Blanchard [this message]
2010-06-26 19:13 ` [PATCH 2/2] Add oops end marker to lib/bug.c WARN implementation Anton Blanchard
2010-06-26 19:54 ` [PATCH 1/2] Make lib/bug.c WARN implementation match the kernel/panic.c one Kirill A. Shutemov

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=20100626191059.GA2345@kryten \
    --to=anton@samba.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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.