mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jan Beulich <JBeulich@suse.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Alexander van Heukelum <heukelum@fastmail.fm>,
	fweisbec@gmail.com, Arjan van de Ven <arjan@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: Use -m-omit-leaf-frame-pointer to shrink text size
Date: Fri, 16 Dec 2011 13:00:01 +0100	[thread overview]
Message-ID: <20111216120001.GA27801@elte.hu> (raw)
In-Reply-To: <4EEB3D8B0200007800068759@nat28.tlf.novell.com>


* Jan Beulich <JBeulich@suse.com> wrote:

> >>> On 16.12.11 at 10:23, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> > On 12/16/2011 12:53 AM, Ingo Molnar wrote:
> >> * Ingo Molnar <mingo@elte.hu> wrote:
> >>
> >>> [...]
> >>>
> >>> The call-chains are still intact for quality backtraces 
> >>> and for call-chain profiling (perf record -g), as the 
> >>> backtrace walker can deduct the full backtrace from the 
> >>> RIP of a leaf function and the parent chain.
> 
> Are you sure about that even if the leaf function uses rBP for 
> a different purpose?

Well, i assumed that GCC does not mess with %bp in leaf 
functions - a frame pointer is barely useful if it's destroyed 
spuriously in leaf functions.

A quick grep of the assembly appears to support that assumption:

 $ objdump -d vmlinux | grep ',%rbp$' | cut -d: -f2- | sort | uniq -c | sort -n | tail -10

      3 	48 89 d5             	mov    %rdx,%rbp
      3 	4c 89 cd             	mov    %r9,%rbp
      4 	48 0f 45 e8          	cmovne %rax,%rbp
      4 	48 83 cd ff          	or     $0xffffffffffffffff,%rbp
      5 	4c 89 dd             	mov    %r11,%rbp
      7 	48 21 fd             	and    %rdi,%rbp
     10 	48 d3 e5             	shl    %cl,%rbp
     14 	48 85 ed             	test   %rbp,%rbp
     14 	48 8b 6c 24 20       	mov    0x20(%rsp),%rbp
  31042 	48 89 e5             	mov    %rsp,%rbp

%rbp is not touched, except in a few special assembly glue/entry 
pieces of code.

> >> Hm, noticed one complication while looking at annotated 
> >> assembly code in perf top. Code doing function calls from 
> >> within asm() is incorrectly marked 'leaf' by GCC:
> >>
> >> ffffffff812b82d8 <arch_local_save_flags>:
> >> ffffffff812b82d8:       ff 14 25 00 d9 c1 81    callq  *0xffffffff81c1d900
> >> ffffffff812b82df:       c3                      retq   
> >>
> >> So all the paravirt details will have to be fixed, so that 
> >> GCC is able to see that there's a real function call done 
> >> inside. Jeremy, Konrad?
> 
> If the above is not a problem, wouldn't this simply result in 
> a skipped function layer?

Yeah - i guess we can live with that, as long as the frame 
pointer chain is otherwise usable and walkable.

Thanks,

	Ingo

  reply	other threads:[~2011-12-16 12:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16  8:19 Ingo Molnar
2011-12-16  8:48 ` Andrew Morton
2011-12-16  8:54   ` Ingo Molnar
2011-12-16  8:53 ` Ingo Molnar
2011-12-16  9:23   ` Jeremy Fitzhardinge
2011-12-16 10:20     ` Peter Zijlstra
2011-12-16 16:27       ` Richard Henderson
2011-12-16 11:46     ` Jan Beulich
2011-12-16 12:00       ` Ingo Molnar [this message]
2011-12-16 15:32         ` H. Peter Anvin
2011-12-16 14:01 ` Frederic Weisbecker
2011-12-16 14:06 ` Frederic Weisbecker

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=20111216120001.GA27801@elte.hu \
    --to=mingo@elte.hu \
    --cc=JBeulich@suse.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=fweisbec@gmail.com \
    --cc=heukelum@fastmail.fm \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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

Powered by JetHome