linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* questions around Book III-E and branch trace
@ 2013-04-17 18:44 Chris Friesen
  2013-04-17 23:30 ` BUG: branch trace support for 64-bit Book-E (was Re: questions around Book III-E and branch trace) Chris Friesen
  2013-04-18  6:28 ` questions around Book III-E and branch trace Benjamin Herrenschmidt
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Friesen @ 2013-04-17 18:44 UTC (permalink / raw)
  To: Kumar Gala, linuxppc-dev, Benjamin Herrenschmidt, Paul Mackerras

Hi,

I'm trying to wrap my head around how linux handles branch tracing on 
Book III-E.  I think I understand how we set MSR[DE] and DBCR0[IDM|BT], 
and how we handle fixing things up if an instruction being traced causes 
an exception.

I have a few questions though:

1) Does user_enable_block_step() have a bug in it?  The current code has

task->thread.dbcr0 = DBCR0_IDM | DBCR0_BT;

Should that be as follows (to match the singel-step case)?

task->thread.dbcr0 |= DBCR0_IDM | DBCR0_BT;


2) Why doesn't DBCR0_ACTIVE_EVENTS include DBCR0_BT?


3) In sys_debug_setcontext() why does SIG_DBG_BRANCH_TRACING return 
-EINVAL if CONFIG_PPC_ADV_DEBUG_REGS is set?  Would it not be possible 
to use DBCR0_BT?

Thanks,
Chris


-- 

Chris Friesen
Software Designer

500 Palladium Drive, Suite 2100
Ottawa, Ontario K2N 1C2, Canada
www.genband.com
office:+1.343.883.2717
chris.friesen@genband.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* BUG: branch trace support for 64-bit Book-E (was Re: questions around Book III-E and branch trace)
  2013-04-17 18:44 questions around Book III-E and branch trace Chris Friesen
@ 2013-04-17 23:30 ` Chris Friesen
  2013-04-18  6:28 ` questions around Book III-E and branch trace Benjamin Herrenschmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Friesen @ 2013-04-17 23:30 UTC (permalink / raw)
  To: Kumar Gala, linuxppc-dev, Benjamin Herrenschmidt, Paul Mackerras

On 04/17/2013 12:44 PM, Chris Friesen wrote:
> Hi,
>
> I'm trying to wrap my head around how linux handles branch tracing on
> Book III-E. I think I understand how we set MSR[DE] and DBCR0[IDM|BT],
> and how we handle fixing things up if an instruction being traced causes
> an exception.

While poking around looking for answers to my previous questions I seem 
to have stumbled over a bug in branch tracing for 64-bit Book-E.

Commit ec097c8 added support for branch tracing for 32-bit code, but 
didn't do the 64-bit path.  As it stands, debug_crit/debug_debug in 
exceptions-64e.S only check DBSR_IC, so branch tracing will not get 
fixed up and will die a horrible death (typically in a tbr exception 
handler).

I was banging my head trying to figure out why this wasn't working when 
I finally clued in to the fact that head_booke.h only applied to the 
32-bit implementation.  This might be something useful to put in a 
comment up at the top of the file.

Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: questions around Book III-E and branch trace
  2013-04-17 18:44 questions around Book III-E and branch trace Chris Friesen
  2013-04-17 23:30 ` BUG: branch trace support for 64-bit Book-E (was Re: questions around Book III-E and branch trace) Chris Friesen
@ 2013-04-18  6:28 ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2013-04-18  6:28 UTC (permalink / raw)
  To: Chris Friesen; +Cc: Paul Mackerras, linuxppc-dev

On Wed, 2013-04-17 at 12:44 -0600, Chris Friesen wrote:
> Hi,
> 
> I'm trying to wrap my head around how linux handles branch tracing on 
> Book III-E.  I think I understand how we set MSR[DE] and DBCR0[IDM|BT], 
> and how we handle fixing things up if an instruction being traced causes 
> an exception.

That code is a mess and it wouldn't surprise me if it was broken...

At this point, the people who care the most about it are FSL, so
that's where you have the most chance to find a satisfactory answer.

Cheers,
Ben.

> I have a few questions though:
> 
> 1) Does user_enable_block_step() have a bug in it?  The current code has
> 
> task->thread.dbcr0 = DBCR0_IDM | DBCR0_BT;
> 
> Should that be as follows (to match the singel-step case)?
> 
> task->thread.dbcr0 |= DBCR0_IDM | DBCR0_BT;
> 
> 
> 2) Why doesn't DBCR0_ACTIVE_EVENTS include DBCR0_BT?
> 
> 
> 3) In sys_debug_setcontext() why does SIG_DBG_BRANCH_TRACING return 
> -EINVAL if CONFIG_PPC_ADV_DEBUG_REGS is set?  Would it not be possible 
> to use DBCR0_BT?
> 
> Thanks,
> Chris
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-18  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-17 18:44 questions around Book III-E and branch trace Chris Friesen
2013-04-17 23:30 ` BUG: branch trace support for 64-bit Book-E (was Re: questions around Book III-E and branch trace) Chris Friesen
2013-04-18  6:28 ` questions around Book III-E and branch trace Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).