[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.01.0905171502160.3301@localhost.localdomain>
Date: Sun, 17 May 2009 15:18:19 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Hugh Dickins <hugh@...itas.com>
cc: Andi Kleen <ak@...ux.intel.com>,
Ian Campbell <ian.campbell@...rix.com>,
Jakub Jelinek <jakub@...hat.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Jesper Nilsson <jesper.nilsson@...s.com>,
Johannes Weiner <hannes@...xchg.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] Fix print out of function which called WARN_ON()
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists