mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Andi Kleen <ak@muc.de>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Put the BUG __FILE__ and __LINE__ info out of line
Date: Thu, 28 Sep 2006 16:30:19 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0609281626001.25939@blonde.wat.veritas.com> (raw)
In-Reply-To: <20060928103853.GB99906@muc.de>

On Thu, 28 Sep 2006, Andi Kleen wrote:
> On Thu, Sep 28, 2006 at 03:30:12AM -0700, Jeremy Fitzhardinge wrote:
> > Andi Kleen wrote:
> > >But no out of line section. So overall it's smaller, although the cache 
> > >footprint
> > >is 2 bytes larger. But then is 2 bytes larger really an issue? We don't 
> > >have
> > >_that_ many BUGs anyways.
> > >  
> > 
> > I think the out of line section is a feature; no point in crufting up 
> > the icache with BUG gunk, especially since a number of them are on 
> > fairly hot paths.
> 
> It's 10 bytes per BUG. 

Or 9 bytes per BUG: I protested about the disassembly problem back
when the minimized BUG() first went in, and have been using "ljmp"
in my i386 builds ever since:

--- 2.6.18-git9/arch/i386/kernel/traps.c	2006-09-28 12:03:47.000000000 +0100
+++ linux/arch/i386/kernel/traps.c	2006-09-28 16:23:56.000000000 +0100
@@ -422,10 +422,10 @@ static void handle_BUG(struct pt_regs *r
 		char *file;
 		char c;
 
-		if (probe_kernel_address((unsigned short __user *)(eip + 2),
+		if (probe_kernel_address((unsigned short __user *)(eip + 7),
 					line))
 			break;
-		if (__get_user(file, (char * __user *)(eip + 4)) ||
+		if (__get_user(file, (char * __user *)(eip + 3)) ||
 		    (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
 			file = "<bad filename>";
 
--- 2.6.18-git9/include/asm-i386/bug.h	2006-09-20 04:42:06.000000000 +0100
+++ linux/include/asm-i386/bug.h	2006-09-28 16:23:56.000000000 +0100
@@ -13,9 +13,11 @@
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 #define BUG()				\
  __asm__ __volatile__(	"ud2\n"		\
-			"\t.word %c0\n"	\
-			"\t.long %c1\n"	\
-			 : : "i" (__LINE__), "i" (__FILE__))
+			"\t.byte 0xea\n" \
+			"\t.long %c0\n"	\
+			"\t.word %c1\n"	\
+			 : : "i" (__FILE__), "i" (__LINE__))
+	/* "ljmp long short" so disassemblers can make sense of it */
 #else
 #define BUG() __asm__ __volatile__("ud2\n")
 #endif

  reply	other threads:[~2006-09-28 15:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-28  6:00 Jeremy Fitzhardinge
2006-09-28  6:35 ` Andrew Morton
2006-09-28  6:49   ` Jeremy Fitzhardinge
2006-09-28  7:00     ` Andrew Morton
2006-09-28  7:17       ` Andi Kleen
2006-09-28  7:26         ` Andrew Morton
2006-09-28 10:15           ` Andi Kleen
2006-09-28 10:30             ` Jeremy Fitzhardinge
2006-09-28 10:38               ` Andi Kleen
2006-09-28 15:30                 ` Hugh Dickins [this message]
2006-09-28 19:44                   ` Andi Kleen
2006-09-28 10:27       ` Jeremy Fitzhardinge
2006-09-28 16:18         ` Andrew Morton
2006-09-28 16:32           ` Jeremy Fitzhardinge
2006-09-28  7:16 ` Andi Kleen

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=Pine.LNX.4.64.0609281626001.25939@blonde.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®