public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Michael Neuling <mikey@neuling.org>
Cc: eranian@google.com, Linux PPC dev <linuxppc-dev@ozlabs.org>,
	linux-kernel@vger.kernel.org, michael@ellerman.id.au,
	Anshuman Khandual <anshuman.khandual@in.ibm.com>
Subject: Re: Invalid perf_branch_entry.to entries question
Date: Fri, 10 May 2013 12:43:52 +0200	[thread overview]
Message-ID: <20130510104352.GF31235@dyad.programming.kicks-ass.net> (raw)
In-Reply-To: <14691.1368052755@ale.ozlabs.ibm.com>

On Thu, May 09, 2013 at 08:39:15AM +1000, Michael Neuling wrote:
> > Just because I'm curious.. however does that happen? Surely the CPU
> > knows where next to fetch instructions?
> 
> For computed gotos (ie. branch to a register value), the hardware gives
> you the from and to address in the branch history buffer.
> 
> For branches where the branch target address is an immediate encoded in
> the instruction, the hardware only logs the from address.  It assumes
> that software (perf irq handler in this case) can read this branch
> instruction, calculate the corresponding offset and hence the
> to/target address.
> 
> It's entirely possible that when the perf IRQ handler happens, the
> instruction in question is not readable or is no longer a branch (self
> modifying code).  Hence we aren't able to calculate a valid to address.

Ohh how cute! You've gotta love lazy hardware :-)

  reply	other threads:[~2013-05-10 10:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-07  1:35 Invalid perf_branch_entry.to entries question Michael Neuling
2013-05-08 15:59 ` Peter Zijlstra
2013-05-08 21:33   ` Stephane Eranian
2013-05-08 22:45     ` Michael Neuling
2013-05-09  0:02       ` Michael Ellerman
2013-05-08 22:39   ` Michael Neuling
2013-05-10 10:43     ` Peter Zijlstra [this message]
2013-05-10 10:50       ` Michael Neuling
2013-05-10 11:51         ` Benjamin Herrenschmidt

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=20130510104352.GF31235@dyad.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=anshuman.khandual@in.ibm.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    --cc=mikey@neuling.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