diff mbox

[3/3] powerpc perf_event: Add alignment-faults and emulation-faults software events

Message ID 20091018111300.GM4808@kryten (mailing list archive)
State Accepted
Delegated to: Paul Mackerras
Headers show

Commit Message

Anton Blanchard Oct. 18, 2009, 11:13 a.m. UTC
Hook up the alignment-faults and emulation-faults events for powerpc.

Signed-off-by: Anton Blanchard <anton@samba.org>
---

Comments

Michael Ellerman Oct. 18, 2009, 11:50 p.m. UTC | #1
On Sun, 2009-10-18 at 22:13 +1100, Anton Blanchard wrote:
> Hook up the alignment-faults and emulation-faults events for powerpc.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> 
> Index: linux.trees.git/arch/powerpc/include/asm/emulated_ops.h
> ===================================================================
> --- linux.trees.git.orig/arch/powerpc/include/asm/emulated_ops.h	2009-09-22 13:45:07.000000000 +1000
> +++ linux.trees.git/arch/powerpc/include/asm/emulated_ops.h	2009-09-22 13:45:27.000000000 +1000
> @@ -19,6 +19,7 @@
>  #define _ASM_POWERPC_EMULATED_OPS_H
>  
>  #include <asm/atomic.h>
> +#include <linux/perf_event.h>
>  
> 
>  #ifdef CONFIG_PPC_EMULATED_STATS
> @@ -71,7 +72,18 @@ extern void ppc_warn_emulated_print(cons
>  
>  #endif /* !CONFIG_PPC_EMULATED_STATS */
>  
> -#define PPC_WARN_EMULATED(type, regs)	__PPC_WARN_EMULATED(type)
> -#define PPC_WARN_ALIGNMENT(type, regs)	__PPC_WARN_EMULATED(type)
> +#define PPC_WARN_EMULATED(type, regs)					\
> +	do {								\
> +		perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,		\
> +			1, 0, regs, 0);					\
> +		__PPC_WARN_EMULATED(type);				\
> +	} while (0)
> +
> +#define PPC_WARN_ALIGNMENT(type, regs)					\
> +	do {								\
> +		perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,		\
> +			1, 0, regs, regs->dar);				\
> +		__PPC_WARN_EMULATED(type);				\
> +	} while (0)

Does that work with perfxxx configured off?

cheers
Anton Blanchard Oct. 19, 2009, 12:42 a.m. UTC | #2
Hi,

> > +#define PPC_WARN_ALIGNMENT(type, regs)				\
> > +	do {								\
> > +		perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,		\
> > +			1, 0, regs, regs->dar);				\
> > +		__PPC_WARN_EMULATED(type);				\
> > +	} while (0)
> 
> Does that work with perfxxx configured off?

Yeah, perf_event.h defines an empty version if its configured off:

static inline void
perf_sw_event(u32 event_id, u64 nr, int nmi,
                     struct pt_regs *regs, u64 addr)                    { }

Anton
Ingo Molnar Oct. 19, 2009, 7:25 a.m. UTC | #3
* Anton Blanchard <anton@samba.org> wrote:

> Hook up the alignment-faults and emulation-faults events for powerpc.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

nice.

The first patch is for perf events - it would be nice if we could do the 
two PowerPC changes via the perf events tree - that would speed up the 
upstream availability of this new feature. Ben, what do you think?

	Ingo
diff mbox

Patch

Index: linux.trees.git/arch/powerpc/include/asm/emulated_ops.h
===================================================================
--- linux.trees.git.orig/arch/powerpc/include/asm/emulated_ops.h	2009-09-22 13:45:07.000000000 +1000
+++ linux.trees.git/arch/powerpc/include/asm/emulated_ops.h	2009-09-22 13:45:27.000000000 +1000
@@ -19,6 +19,7 @@ 
 #define _ASM_POWERPC_EMULATED_OPS_H
 
 #include <asm/atomic.h>
+#include <linux/perf_event.h>
 
 
 #ifdef CONFIG_PPC_EMULATED_STATS
@@ -71,7 +72,18 @@  extern void ppc_warn_emulated_print(cons
 
 #endif /* !CONFIG_PPC_EMULATED_STATS */
 
-#define PPC_WARN_EMULATED(type, regs)	__PPC_WARN_EMULATED(type)
-#define PPC_WARN_ALIGNMENT(type, regs)	__PPC_WARN_EMULATED(type)
+#define PPC_WARN_EMULATED(type, regs)					\
+	do {								\
+		perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,		\
+			1, 0, regs, 0);					\
+		__PPC_WARN_EMULATED(type);				\
+	} while (0)
+
+#define PPC_WARN_ALIGNMENT(type, regs)					\
+	do {								\
+		perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,		\
+			1, 0, regs, regs->dar);				\
+		__PPC_WARN_EMULATED(type);				\
+	} while (0)
 
 #endif /* _ASM_POWERPC_EMULATED_OPS_H */