Subject: Re: [PATCH] powerpc: Instrument Hypervisor Calls

From: Mike Kravetz <[email-masked]>
Date: Mon, 14 Aug 2006 19:32:24 -0700

On Tue, Aug 15, 2006 at 11:03:19AM +1000, Stephen Rothwell wrote:
> On Mon, 14 Aug 2006 16:21:44 -0700 Mike Kravetz <[email-masked]> wrote:
> > +#define HCALL_INST_POSTCALL					\
> > +	/* get time and PURR snapshots after hcall */		\
> > +	mftb	r7;			/* timebase after */	\
> > +BEGIN_FTR_SECTION;						\
> > +	mfspr	r8,SPRN_PURR;		/* PURR after */	\
> > +END_FTR_SECTION_IFSET(CPU_FTR_PURR);				\
> > +								\
> > +	/* calculate time and PURR deltas for call */		\
> > +	ld	r5,STK_PARM(r5)(r1);	/* timebase before */	\
> > +	subf	r5,r5,r7;					\
> > +	ld	r6,STK_PARM(r6)(r1);	/* PURR before */	\
> > +	subf	r6,r6,r8;					\
> 
> But here, if we have no PURR we produce random numbers.  Maybe you should
> reuse the TB value so the values reported may make some sense.

Good catch!

My intention was to detect the presence of PURR in the display (debugfs)
code.  If there is no PURR, then no PURR values are displayed.  My thought
is that it doesn't matter what values are in the field if we don't display
them.  

Unfortunately, I left that bit of code out of the patch.

How does that sound?  Suppose I can also put all the 'calculate PURR delta'
code in the FTR_SECTION to save a few cycles.
-- 
Mike