Re: [PATCH] powerpc: Instrument Hypervisor Calls
From: Stephen Rothwell <hidden>
Date: 2006-08-15 01:03:33
On Mon, 14 Aug 2006 16:21:44 -0700 Mike Kravetz [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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@canb.auug.org.au http://www.canb.auug.org.au/~sfr/
Attachments
- (unnamed) [application/pgp-signature] 189 bytes