public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Kairui Song <kasong@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [RFC PATCH v3] perf/x86: make perf callchain work without CONFIG_FRAME_POINTER
Date: Fri, 19 Apr 2019 11:43:13 +0200	[thread overview]
Message-ID: <20190419094313.GO7905@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <CACPcB9fsYqs+xaj6w6ExKdpi-Pk4RqiD5HxTyURpee_arYQANg@mail.gmail.com>

On Fri, Apr 19, 2019 at 10:17:49AM +0800, Kairui Song wrote:
> On Fri, Apr 19, 2019 at 8:58 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > I still don't like using regs->bp because it results in different code
> > paths for FP and ORC.  In the FP case, the regs are treated like real
> > regs even though they're fake.
> >
> > Something like the below would be much simpler.  Would this work?  I don't
> > know if any other code relies on the fake regs->bp or regs->sp.
> 
> Works perfectly. My only concern is that FP path used to work very
> well, not sure it's a good idea to change it, and this may bring some
> extra overhead for FP path.

Given Josh wrote all that code, I'm fairly sure it is still OK :-)

But also looking at the code in unwind_frame.c, __unwind_start() seems
to pretty much do what the removed caller_frame_pointer() did (when
.regs=NULL) but better.

> > +       if (perf_hw_regs(regs)) {
> > +               if (perf_callchain_store(entry, regs->ip))
> > +                       return;
> > +               unwind_start(&state, current, regs, NULL);
> > +       } else {
> > +               unwind_start(&state, current, NULL, (void *)regs->sp);
> > +       }

> >  #define perf_arch_fetch_caller_regs(regs, __ip)                {       \
> >         (regs)->ip = (__ip);                                    \
> > +       (regs)->sp = (unsigned long)__builtin_frame_address(0); \
> >         (regs)->cs = __KERNEL_CS;                               \
> >         regs->flags = 0;                                        \
> >  }

  reply	other threads:[~2019-04-19 19:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18 16:07 [RFC PATCH v3] perf/x86: make perf callchain work without CONFIG_FRAME_POINTER Kairui Song
2019-04-19  0:58 ` Josh Poimboeuf
2019-04-19  2:17   ` Kairui Song
2019-04-19  9:43     ` Peter Zijlstra [this message]
2019-04-19 11:47       ` Kairui Song
2019-04-19 15:45         ` Josh Poimboeuf

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=20190419094313.GO7905@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bp@alien8.de \
    --cc=jolsa@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=kasong@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /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