mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Hugh Dickins <hugh@veritas.com>
Cc: Andi Kleen <ak@linux.intel.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Jakub Jelinek <jakub@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Jesper Nilsson <jesper.nilsson@axis.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] Fix print out of function which called WARN_ON()
Date: Sun, 17 May 2009 15:18:19 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0905171502160.3301@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0905171536470.23834@blonde.anvils>



On Sun, 17 May 2009, Hugh Dickins wrote:

> On Sat, 16 May 2009, Linus Torvalds wrote:
> > 
> > This patch not only avoids the warnings and gets the right caller 
> > information, it cleans up the code too:
> > 
> >  - it uses '%pS' instead of of sprint_symbol
> 
> > -	char function[KSYM_SYMBOL_LEN];
> 
> This should be a big improvement, because that buffer on the stack
> was netting lots of stale return addresses, printed out with ?s in
> the warning's dump_stack().  I had been wanting to add a memset,
> but your %pS should circumvent the need for that nicely.

Are you sure it was that function[] array?

The thing is, on at least x86-64, any function using va_start() will 
allocate something like 64 bytes of stack space for the reg-save area. I'm 
not quite sure _why_ it does that, but it's very irritating, and it showed 
up quite clearly in some of the stackspace usage things.

I even sent the gcc people a patch to fix the worst of it (gcc used to 
allocate about twice as much space because it also had a XMM save area 
even if you compiled without XMM support or something like that), but my 
point is, I'm afraid there is still a noticeable gap on the stack due to 
this, at least for the _fmt() case.

But yes, for the _null() case we now have neither that function buffer 
_nor_ the stupid va_list save area, so that case should be much better.

Of course, we could avoid that entirely if we were to just pass in the 
right stack pointer to dump_stack(), and the "warn_slowpath_xyz()" 
functions could just pass in the stack of their caller. Sadly, we 
currently have no way to do that :(

We could change the dump_stack() calling convention to give a stack 
pointer or NULL, and then use __builtin_frame_address(0) in the caller.. 
But we have a _lot_ of "dump_stack()" users.

		Linus

  reply	other threads:[~2009-05-17 22:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-15 16:17 Ian Campbell
2009-05-15 17:52 ` Linus Torvalds
2009-05-15 19:50   ` Andi Kleen
2009-05-16 20:47     ` Linus Torvalds
2009-05-17 14:43       ` Hugh Dickins
2009-05-17 22:18         ` Linus Torvalds [this message]
2009-05-17 22:24           ` David Miller
2009-05-17 22:47             ` Linus Torvalds
2009-05-17 22:45           ` Hugh Dickins
2009-05-17 22:54             ` Linus Torvalds
2009-05-18  9:09       ` Ian Campbell
2009-05-18 14:11         ` Arjan van de Ven

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=alpine.LFD.2.01.0905171502160.3301@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=hugh@veritas.com \
    --cc=ian.campbell@citrix.com \
    --cc=jakub@redhat.com \
    --cc=jesper.nilsson@axis.com \
    --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®