[PATCH] powerpc: Instrument Hypervisor Calls
Stephen Rothwell
sfr at canb.auug.org.au
Tue Aug 15 11:03:19 EST 2006
On Mon, 14 Aug 2006 16:21:44 -0700 Mike Kravetz <kravetz at us.ibm.com> wrote:
>
> diff -Naupr powerpc2/arch/powerpc/platforms/pseries/hvCall.S powerpc2.work/arch/powerpc/platforms/pseries/hvCall.S
> --- powerpc2/arch/powerpc/platforms/pseries/hvCall.S 2006-08-14 18:00:55.000000000 +0000
> +++ powerpc2.work/arch/powerpc/platforms/pseries/hvCall.S 2006-08-14 22:17:04.000000000 +0000
> @@ -10,9 +10,66 @@
> #include <asm/hvcall.h>
> #include <asm/processor.h>
> #include <asm/ppc_asm.h>
> +#include <asm/asm-offsets.h>
>
> #define STK_PARM(i) (48 + ((i)-3)*8)
>
> +#ifdef CONFIG_HCALL_STATS
> +/*
> + * precall must preserve all registers. use unused STK_PARM()
> + * areas to save snapshots and opcode.
> + */
> +#define HCALL_INST_PRECALL \
> + std r3,STK_PARM(r3)(r1); /* save opcode */ \
> + mftb r3; /* get timebase and */ \
> + std r3,STK_PARM(r5)(r1); /* save for later */ \
> +BEGIN_FTR_SECTION; \
> + mfspr r3,SPRN_PURR; /* get PURR and */ \
> +END_FTR_SECTION_IFSET(CPU_FTR_PURR); \
> + std r3,STK_PARM(r6)(r1); /* save for later */ \
So if we have no PURR, we use the TB value (this is fine)
> + ld r3,STK_PARM(r3)(r1); /* opcode back in r3 */
> +
> +/*
> + * postcall is performed immediately before function return which
> + * allows liberal use of volital registers.
> + */
> +#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.
--
Cheers,
Stephen Rothwell sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20060815/4bce8ffb/attachment.pgp>
More information about the Linuxppc-dev
mailing list