All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] hw_breakpoint: Let the user choose not to build it (and perf too)
@ 2011-05-24 21:52 ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, Ingo Molnar, Will Deacon,
	Peter Zijlstra, Prasad, Paul Mundt, Jason Wessel,
	H . Peter Anvin, Thomas Gleixner, linuxppc-dev

Mostly just a rebase against latest upstream
updates and acks from Will Deacon added In this second version.

Please tell me if you are ok with this set.

Thanks.

---

Frederic Weisbecker (6):
      hw_breakpoints: Split hardware breakpoints config
      hw_breakpoints: Migrate breakpoint conditional build under new config
      x86: Allow the user not to build hw_breakpoints
      hw_breakpoints: Breakpoints arch ability don't need perf events
      hw_breakpoints: Only force perf events if breakpoints are selected
      hw_breakpoints: Drop remaining misplaced dependency on perf


 arch/Kconfig                             |    1 -
 arch/arm/Kconfig                         |    2 +-
 arch/arm/include/asm/hw_breakpoint.h     |    4 +-
 arch/arm/include/asm/processor.h         |    2 +-
 arch/arm/kernel/Makefile                 |    2 +-
 arch/arm/kernel/entry-header.S           |    2 +-
 arch/arm/kernel/ptrace.c                 |    4 +-
 arch/powerpc/Kconfig                     |    2 +-
 arch/powerpc/include/asm/cputable.h      |    4 +-
 arch/powerpc/include/asm/hw_breakpoint.h |    6 ++--
 arch/powerpc/include/asm/processor.h     |    4 +-
 arch/powerpc/kernel/Makefile             |    2 +-
 arch/powerpc/kernel/process.c            |   18 ++++++++--------
 arch/powerpc/kernel/ptrace.c             |   13 ++++++-----
 arch/powerpc/lib/Makefile                |    2 +-
 arch/sh/Kconfig                          |    2 +-
 arch/sh/kernel/Makefile                  |    2 +-
 arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
 arch/x86/Kconfig                         |    3 +-
 arch/x86/include/asm/debugreg.h          |   33 ++++++++++++++++++++++++++++-
 arch/x86/kernel/Makefile                 |    3 +-
 arch/x86/kernel/process.c                |    1 +
 arch/x86/kernel/ptrace.c                 |   17 +++++++++++++++
 include/linux/hw_breakpoint.h            |    6 ++--
 include/linux/perf_event.h               |    4 +-
 include/linux/ptrace.h                   |    6 ++--
 include/linux/sched.h                    |    2 +-
 init/Kconfig                             |   11 ++++++++++
 kernel/events/Makefile                   |    2 +-
 kernel/events/core.c                     |    4 +-
 kernel/ptrace.c                          |    4 +-
 samples/Kconfig                          |    2 +-
 32 files changed, 115 insertions(+), 57 deletions(-)

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

* [PATCH v2] hw_breakpoint: Let the user choose not to build it (and perf too)
@ 2011-05-24 21:52 ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: linuxppc-dev, Peter Zijlstra, Frederic Weisbecker,
	H . Peter Anvin, Will Deacon, LKML, Paul Mundt, Jason Wessel,
	Ingo Molnar, Prasad, Thomas Gleixner

Mostly just a rebase against latest upstream
updates and acks from Will Deacon added In this second version.

Please tell me if you are ok with this set.

Thanks.

---

Frederic Weisbecker (6):
      hw_breakpoints: Split hardware breakpoints config
      hw_breakpoints: Migrate breakpoint conditional build under new config
      x86: Allow the user not to build hw_breakpoints
      hw_breakpoints: Breakpoints arch ability don't need perf events
      hw_breakpoints: Only force perf events if breakpoints are selected
      hw_breakpoints: Drop remaining misplaced dependency on perf


 arch/Kconfig                             |    1 -
 arch/arm/Kconfig                         |    2 +-
 arch/arm/include/asm/hw_breakpoint.h     |    4 +-
 arch/arm/include/asm/processor.h         |    2 +-
 arch/arm/kernel/Makefile                 |    2 +-
 arch/arm/kernel/entry-header.S           |    2 +-
 arch/arm/kernel/ptrace.c                 |    4 +-
 arch/powerpc/Kconfig                     |    2 +-
 arch/powerpc/include/asm/cputable.h      |    4 +-
 arch/powerpc/include/asm/hw_breakpoint.h |    6 ++--
 arch/powerpc/include/asm/processor.h     |    4 +-
 arch/powerpc/kernel/Makefile             |    2 +-
 arch/powerpc/kernel/process.c            |   18 ++++++++--------
 arch/powerpc/kernel/ptrace.c             |   13 ++++++-----
 arch/powerpc/lib/Makefile                |    2 +-
 arch/sh/Kconfig                          |    2 +-
 arch/sh/kernel/Makefile                  |    2 +-
 arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
 arch/x86/Kconfig                         |    3 +-
 arch/x86/include/asm/debugreg.h          |   33 ++++++++++++++++++++++++++++-
 arch/x86/kernel/Makefile                 |    3 +-
 arch/x86/kernel/process.c                |    1 +
 arch/x86/kernel/ptrace.c                 |   17 +++++++++++++++
 include/linux/hw_breakpoint.h            |    6 ++--
 include/linux/perf_event.h               |    4 +-
 include/linux/ptrace.h                   |    6 ++--
 include/linux/sched.h                    |    2 +-
 init/Kconfig                             |   11 ++++++++++
 kernel/events/Makefile                   |    2 +-
 kernel/events/core.c                     |    4 +-
 kernel/ptrace.c                          |    4 +-
 samples/Kconfig                          |    2 +-
 32 files changed, 115 insertions(+), 57 deletions(-)

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

* [PATCH 1/6] hw_breakpoints: Split hardware breakpoints config
  2011-05-24 21:52 ` Frederic Weisbecker
@ 2011-05-24 21:52   ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, linuxppc-dev, Ingo Molnar,
	Peter Zijlstra, Will Deacon, Prasad, Paul Mundt

The hardware breakpoint config is only made of an ability. An
arch that support this feature selects HAVE_HW_BREAKPOINT. If so,
the feature is definetly built-in, the user can't decide to turn
it off. As hw_breakpoints depend on perf, it also makes perf
a mandatory feature. The whole is quite a piece of code and
may not be desired on some embedded systems.

In order to prepare to make this optable by the user, split the
config into the more traditional couple (ability, user choice) by
providing a new HW_BREAKPOINT config. It is default on and depends
on CONFIG_EXPERT because breakpoint ptrace requests are part of the
usual user ABI. The user must know what he's doing before turning
that off.

For now, only the archs that already implemented a conditional
HAVE_HW_BREAKPOINT can turn off HW_BREAKPOINT. x86 and sh have it
always selected because they need more background work to support
this new modularity.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/Kconfig  |    1 +
 arch/x86/Kconfig |    1 +
 init/Kconfig     |   10 ++++++++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 4b89da2..0d4d124 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -44,6 +44,7 @@ config SUPERH32
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_ARCH_KGDB
 	select HAVE_HW_BREAKPOINT
+	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select ARCH_HIBERNATION_POSSIBLE if MMU
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index cc6c53a..8b49bff 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -54,6 +54,7 @@ config X86
 	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
+	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select HAVE_PERF_EVENTS_NMI
diff --git a/init/Kconfig b/init/Kconfig
index d886b1e..76ae53e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -924,6 +924,16 @@ menuconfig EXPERT
           environments which can tolerate a "non-standard" kernel.
           Only use this if you really know what you are doing.
 
+config HW_BREAKPOINT
+	bool "Hardware breakpoints" if EXPERT
+	depends on HAVE_HW_BREAKPOINT
+	default y
+	help
+	  Hardware breakpoints are a feature implemented by most CPUs
+	  to trigger an event when an instruction or data fetch
+	  matches a given pattern. This is typically used by ptrace
+	  and perf events.
+
 config UID16
 	bool "Enable 16-bit UID system calls" if EXPERT
 	depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION)
-- 
1.7.3.2


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

* [PATCH 1/6] hw_breakpoints: Split hardware breakpoints config
@ 2011-05-24 21:52   ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, Frederic Weisbecker, Will Deacon, LKML,
	Paul Mundt, Prasad, Ingo Molnar, linuxppc-dev

The hardware breakpoint config is only made of an ability. An
arch that support this feature selects HAVE_HW_BREAKPOINT. If so,
the feature is definetly built-in, the user can't decide to turn
it off. As hw_breakpoints depend on perf, it also makes perf
a mandatory feature. The whole is quite a piece of code and
may not be desired on some embedded systems.

In order to prepare to make this optable by the user, split the
config into the more traditional couple (ability, user choice) by
providing a new HW_BREAKPOINT config. It is default on and depends
on CONFIG_EXPERT because breakpoint ptrace requests are part of the
usual user ABI. The user must know what he's doing before turning
that off.

For now, only the archs that already implemented a conditional
HAVE_HW_BREAKPOINT can turn off HW_BREAKPOINT. x86 and sh have it
always selected because they need more background work to support
this new modularity.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/Kconfig  |    1 +
 arch/x86/Kconfig |    1 +
 init/Kconfig     |   10 ++++++++++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 4b89da2..0d4d124 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -44,6 +44,7 @@ config SUPERH32
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_ARCH_KGDB
 	select HAVE_HW_BREAKPOINT
+	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select ARCH_HIBERNATION_POSSIBLE if MMU
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index cc6c53a..8b49bff 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -54,6 +54,7 @@ config X86
 	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
+	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select HAVE_PERF_EVENTS_NMI
diff --git a/init/Kconfig b/init/Kconfig
index d886b1e..76ae53e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -924,6 +924,16 @@ menuconfig EXPERT
           environments which can tolerate a "non-standard" kernel.
           Only use this if you really know what you are doing.
 
+config HW_BREAKPOINT
+	bool "Hardware breakpoints" if EXPERT
+	depends on HAVE_HW_BREAKPOINT
+	default y
+	help
+	  Hardware breakpoints are a feature implemented by most CPUs
+	  to trigger an event when an instruction or data fetch
+	  matches a given pattern. This is typically used by ptrace
+	  and perf events.
+
 config UID16
 	bool "Enable 16-bit UID system calls" if EXPERT
 	depends on ARM || BLACKFIN || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && COMPAT) || UML || (X86_64 && IA32_EMULATION)
-- 
1.7.3.2

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

* [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
  2011-05-24 21:52 ` Frederic Weisbecker
@ 2011-05-24 21:52   ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, linuxppc-dev, Ingo Molnar,
	Peter Zijlstra, Prasad, Paul Mundt

Migrate conditional hw_breakpoint code compilation under
the new config to prepare for letting the user chose whether
or not to build this feature

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/arm/include/asm/hw_breakpoint.h     |    4 ++--
 arch/arm/include/asm/processor.h         |    2 +-
 arch/arm/kernel/Makefile                 |    2 +-
 arch/arm/kernel/entry-header.S           |    2 +-
 arch/arm/kernel/ptrace.c                 |    4 ++--
 arch/powerpc/include/asm/cputable.h      |    4 ++--
 arch/powerpc/include/asm/hw_breakpoint.h |    6 +++---
 arch/powerpc/include/asm/processor.h     |    4 ++--
 arch/powerpc/kernel/Makefile             |    2 +-
 arch/powerpc/kernel/process.c            |   18 +++++++++---------
 arch/powerpc/kernel/ptrace.c             |   13 +++++++------
 arch/powerpc/lib/Makefile                |    2 +-
 arch/sh/kernel/Makefile                  |    2 +-
 arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
 include/linux/hw_breakpoint.h            |    6 +++---
 include/linux/perf_event.h               |    4 ++--
 include/linux/ptrace.h                   |    6 +++---
 include/linux/sched.h                    |    2 +-
 kernel/events/Makefile                   |    2 +-
 kernel/events/core.c                     |    4 ++--
 kernel/ptrace.c                          |    4 ++--
 samples/Kconfig                          |    2 +-
 22 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
index f389b27..fc6ba18 100644
--- a/arch/arm/include/asm/hw_breakpoint.h
+++ b/arch/arm/include/asm/hw_breakpoint.h
@@ -5,7 +5,7 @@
 
 struct task_struct;
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 
 struct arch_hw_breakpoint_ctrl {
 		u32 __reserved	: 9,
@@ -128,6 +128,6 @@ int hw_breakpoint_slots(int type);
 #else
 static inline void clear_ptrace_hw_breakpoint(struct task_struct *tsk) {}
 
-#endif	/* CONFIG_HAVE_HW_BREAKPOINT */
+#endif	/* CONFIG_HW_BREAKPOINT */
 #endif	/* __KERNEL__ */
 #endif	/* _ARM_HW_BREAKPOINT_H */
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index b2d9df5..b86d135 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -30,7 +30,7 @@
 #endif
 
 struct debug_info {
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	struct perf_event	*hbp[ARM_MAX_HBP_SLOTS];
 #endif
 };
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 8d95446..e6c4b04 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -47,7 +47,7 @@ obj-$(CONFIG_HAVE_TCM)		+= tcm.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_SWP_EMULATE)	+= swp_emulate.o
 CFLAGS_swp_emulate.o		:= -Wa,-march=armv7-a
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= hw_breakpoint.o
 
 obj-$(CONFIG_CRUNCH)		+= crunch.o crunch-bits.o
 AFLAGS_crunch-bits.o		:= -Wa,-mcpu=ep9312
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 051166c..fbc7cc9 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -171,7 +171,7 @@
 	@ we can access the debug registers safely.
 	@
 	.macro	debug_entry, fsr
-#if defined(CONFIG_HAVE_HW_BREAKPOINT) && defined(CONFIG_PREEMPT)
+#if defined(CONFIG_HW_BREAKPOINT) && defined(CONFIG_PREEMPT)
 	ldr	r4, =0x40f		@ mask out fsr.fs
 	and	r5, r4, \fsr
 	cmp	r5, #2			@ debug exception
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 8182f45..07be604 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -468,7 +468,7 @@ static int ptrace_setvfpregs(struct task_struct *tsk, void __user *data)
 }
 #endif
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 /*
  * Convert a virtual register number into an index for a thread_info
  * breakpoint array. Breakpoints are identified using positive numbers
@@ -765,7 +765,7 @@ long arch_ptrace(struct task_struct *child, long request,
 			break;
 #endif
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 		case PTRACE_GETHBPREGS:
 			if (ptrace_get_breakpoints(child) < 0)
 				return -ESRCH;
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 1833d1a..36b5568 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -538,9 +538,9 @@ static inline int cpu_has_feature(unsigned long feature)
 		& feature);
 }
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 #define HBP_NUM 1
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 #endif /* !__ASSEMBLY__ */
 
diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h
index 1c33ec1..6ecd3b6 100644
--- a/arch/powerpc/include/asm/hw_breakpoint.h
+++ b/arch/powerpc/include/asm/hw_breakpoint.h
@@ -24,7 +24,7 @@
 #define _PPC_BOOK3S_64_HW_BREAKPOINT_H
 
 #ifdef	__KERNEL__
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 
 struct arch_hw_breakpoint {
 	bool		extraneous_interrupt;
@@ -65,10 +65,10 @@ static inline void hw_breakpoint_disable(void)
 }
 extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs);
 
-#else	/* CONFIG_HAVE_HW_BREAKPOINT */
+#else	/* CONFIG_HW_BREAKPOINT */
 static inline void hw_breakpoint_disable(void) { }
 static inline void thread_change_pc(struct task_struct *tsk,
 					struct pt_regs *regs) { }
-#endif	/* CONFIG_HAVE_HW_BREAKPOINT */
+#endif	/* CONFIG_HW_BREAKPOINT */
 #endif	/* __KERNEL__ */
 #endif	/* _PPC_BOOK3S_64_HW_BREAKPOINT_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index de1967a..3fe688d 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -207,14 +207,14 @@ struct thread_struct {
 #ifdef CONFIG_PPC64
 	unsigned long	start_tb;	/* Start purr when proc switched in */
 	unsigned long	accum_tb;	/* Total accumilated purr for process */
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	struct perf_event *ptrace_bps[HBP_NUM];
 	/*
 	 * Helps identify source of single-step exception and subsequent
 	 * hw-breakpoint enablement
 	 */
 	struct perf_event *last_hit_ubp;
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 #endif
 	unsigned long	dabr;		/* Data address breakpoint register */
 #ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 3bb2a3e..5df8585 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -36,7 +36,7 @@ obj-y				:= cputable.o ptrace.o syscalls.o \
 obj-$(CONFIG_PPC64)		+= setup_64.o sys_ppc32.o \
 				   signal_64.o ptrace32.o \
 				   paca.o nvram_64.o firmware.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= hw_breakpoint.o
 obj-$(CONFIG_PPC_BOOK3S_64)	+= cpu_setup_ppc970.o cpu_setup_pa6t.o
 obj64-$(CONFIG_RELOCATABLE)	+= reloc_64.o
 obj-$(CONFIG_PPC_BOOK3E_64)	+= exceptions-64e.o idle_book3e.o
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index f74f355..3faf61a 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -353,7 +353,7 @@ static void switch_booke_debug_regs(struct thread_struct *new_thread)
 			prime_debug_regs(new_thread);
 }
 #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
-#ifndef CONFIG_HAVE_HW_BREAKPOINT
+#ifndef CONFIG_HW_BREAKPOINT
 static void set_debug_reg_defaults(struct thread_struct *thread)
 {
 	if (thread->dabr) {
@@ -361,7 +361,7 @@ static void set_debug_reg_defaults(struct thread_struct *thread)
 		set_dabr(0);
 	}
 }
-#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* !CONFIG_HW_BREAKPOINT */
 #endif	/* CONFIG_PPC_ADV_DEBUG_REGS */
 
 int set_dabr(unsigned long dabr)
@@ -469,10 +469,10 @@ struct task_struct *__switch_to(struct task_struct *prev,
  * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
  * schedule DABR
  */
-#ifndef CONFIG_HAVE_HW_BREAKPOINT
+#ifndef CONFIG_HW_BREAKPOINT
 	if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
 		set_dabr(new->thread.dabr);
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 #endif
 
 
@@ -672,11 +672,11 @@ void flush_thread(void)
 {
 	discard_lazy_cpu_state();
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	flush_ptrace_hw_breakpoint(current);
-#else /* CONFIG_HAVE_HW_BREAKPOINT */
+#else /* CONFIG_HW_BREAKPOINT */
 	set_debug_reg_defaults(&current->thread);
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 }
 
 void
@@ -694,9 +694,9 @@ void prepare_to_copy(struct task_struct *tsk)
 	flush_altivec_to_thread(current);
 	flush_vsx_to_thread(current);
 	flush_spe_to_thread(current);
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	flush_ptrace_hw_breakpoint(tsk);
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 }
 
 /*
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index a6ae1cf..18c687e 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -877,7 +877,7 @@ void user_disable_single_step(struct task_struct *task)
 	clear_tsk_thread_flag(task, TIF_SINGLESTEP);
 }
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 void ptrace_triggered(struct perf_event *bp, int nmi,
 		      struct perf_sample_data *data, struct pt_regs *regs)
 {
@@ -893,17 +893,17 @@ void ptrace_triggered(struct perf_event *bp, int nmi,
 	attr.disabled = true;
 	modify_user_hw_breakpoint(bp, &attr);
 }
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 			       unsigned long data)
 {
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	int ret;
 	struct thread_struct *thread = &(task->thread);
 	struct perf_event *bp;
 	struct perf_event_attr attr;
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 	/* For ppc64 we support one DABR and no IABR's at the moment (ppc64).
 	 *  For embedded processors we support one DAC and no IAC's at the
@@ -932,7 +932,8 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 	/* Ensure breakpoint translation bit is set */
 	if (data && !(data & DABR_TRANSLATION))
 		return -EIO;
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+
+#ifdef CONFIG_HW_BREAKPOINT
 	if (ptrace_get_breakpoints(task) < 0)
 		return -ESRCH;
 
@@ -978,7 +979,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 
 	ptrace_put_breakpoints(task);
 
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 	/* Move contents to the DABR register */
 	task->thread.dabr = data;
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 166a6a0..515d044 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -19,7 +19,7 @@ obj-$(CONFIG_PPC64)	+= copypage_64.o copyuser_64.o \
 			   checksum_wrappers_64.o hweight_64.o
 obj-$(CONFIG_XMON)	+= sstep.o ldstfp.o
 obj-$(CONFIG_KPROBES)	+= sstep.o ldstfp.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= sstep.o ldstfp.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= sstep.o ldstfp.o
 
 ifeq ($(CONFIG_PPC64),y)
 obj-$(CONFIG_SMP)	+= locks.o
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 77f7ae1..9d5075c 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,7 @@ obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
 
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT)		+= hw_breakpoint.o
 obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)	+= localtimer.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index cc122b1..5bec639 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -46,4 +46,4 @@ obj-y					+= $(clock-y)
 obj-$(CONFIG_SMP)			+= $(smp-y)
 obj-$(CONFIG_GENERIC_GPIO)		+= $(pinmux-y)
 obj-$(CONFIG_PERF_EVENTS)		+= perf_event.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= ubc.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= ubc.o
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index d1e55fe..9aad682 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -31,7 +31,7 @@ enum bp_type_idx {
 
 #include <linux/perf_event.h>
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 
 extern int __init init_hw_breakpoint(void);
 
@@ -108,7 +108,7 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
 	return &bp->hw.info;
 }
 
-#else /* !CONFIG_HAVE_HW_BREAKPOINT */
+#else /* !CONFIG_HW_BREAKPOINT */
 
 static inline int __init init_hw_breakpoint(void) { return 0; }
 
@@ -144,7 +144,7 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
 	return NULL;
 }
 
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_HW_BREAKPOINT_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3412684..6a65fbf 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -491,7 +491,7 @@ struct perf_guest_info_callbacks {
 	unsigned long			(*get_guest_ip)(void);
 };
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 #include <asm/hw_breakpoint.h>
 #endif
 
@@ -556,7 +556,7 @@ struct hw_perf_event {
 		struct { /* software */
 			struct hrtimer	hrtimer;
 		};
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 		struct { /* breakpoint */
 			struct arch_hw_breakpoint	info;
 			struct list_head		bp_list;
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 9178d5c..9ff2641 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -190,7 +190,7 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
 		__ptrace_link(child, current->parent);
 	}
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	atomic_set(&child->ptrace_bp_refcnt, 1);
 #endif
 }
@@ -354,12 +354,12 @@ extern int task_current_syscall(struct task_struct *target, long *callno,
 				unsigned long args[6], unsigned int maxargs,
 				unsigned long *sp, unsigned long *pc);
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 extern int ptrace_get_breakpoints(struct task_struct *tsk);
 extern void ptrace_put_breakpoints(struct task_struct *tsk);
 #else
 static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 #endif /* __KERNEL */
 
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 781abd1..b575989 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1537,7 +1537,7 @@ struct task_struct {
 		unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
 	} memcg_batch;
 #endif
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	atomic_t ptrace_bp_refcnt;
 #endif
 };
diff --git a/kernel/events/Makefile b/kernel/events/Makefile
index 1ce23d3..3659100 100644
--- a/kernel/events/Makefile
+++ b/kernel/events/Makefile
@@ -3,4 +3,4 @@ CFLAGS_REMOVE_core.o = -pg
 endif
 
 obj-y := core.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT) += hw_breakpoint.o
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 0fc34a3..9f19c33 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5616,7 +5616,7 @@ static void perf_event_free_filter(struct perf_event *event)
 
 #endif /* CONFIG_EVENT_TRACING */
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 void perf_bp_event(struct perf_event *bp, void *data)
 {
 	struct perf_sample_data sample;
@@ -6207,7 +6207,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
 
 	if (task) {
 		event->attach_state = PERF_ATTACH_TASK;
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 		/*
 		 * hw_breakpoint is a bit difficult here..
 		 */
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index dc7ab65..4c2cff7 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -881,7 +881,7 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
 }
 #endif	/* CONFIG_COMPAT */
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 int ptrace_get_breakpoints(struct task_struct *tsk)
 {
 	if (atomic_inc_not_zero(&tsk->ptrace_bp_refcnt))
@@ -895,4 +895,4 @@ void ptrace_put_breakpoints(struct task_struct *tsk)
 	if (atomic_dec_and_test(&tsk->ptrace_bp_refcnt))
 		flush_ptrace_hw_breakpoint(tsk);
 }
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
diff --git a/samples/Kconfig b/samples/Kconfig
index 41063e7..d1e41e9 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -40,7 +40,7 @@ config SAMPLE_KRETPROBES
 
 config SAMPLE_HW_BREAKPOINT
 	tristate "Build kernel hardware breakpoint examples -- loadable module only"
-	depends on HAVE_HW_BREAKPOINT && m
+	depends on HW_BREAKPOINT && m
 	help
 	  This builds kernel hardware breakpoint example modules.
 
-- 
1.7.3.2


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

* [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
@ 2011-05-24 21:52   ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, Frederic Weisbecker, LKML, Paul Mundt, Prasad,
	Ingo Molnar, linuxppc-dev

Migrate conditional hw_breakpoint code compilation under
the new config to prepare for letting the user chose whether
or not to build this feature

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/arm/include/asm/hw_breakpoint.h     |    4 ++--
 arch/arm/include/asm/processor.h         |    2 +-
 arch/arm/kernel/Makefile                 |    2 +-
 arch/arm/kernel/entry-header.S           |    2 +-
 arch/arm/kernel/ptrace.c                 |    4 ++--
 arch/powerpc/include/asm/cputable.h      |    4 ++--
 arch/powerpc/include/asm/hw_breakpoint.h |    6 +++---
 arch/powerpc/include/asm/processor.h     |    4 ++--
 arch/powerpc/kernel/Makefile             |    2 +-
 arch/powerpc/kernel/process.c            |   18 +++++++++---------
 arch/powerpc/kernel/ptrace.c             |   13 +++++++------
 arch/powerpc/lib/Makefile                |    2 +-
 arch/sh/kernel/Makefile                  |    2 +-
 arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
 include/linux/hw_breakpoint.h            |    6 +++---
 include/linux/perf_event.h               |    4 ++--
 include/linux/ptrace.h                   |    6 +++---
 include/linux/sched.h                    |    2 +-
 kernel/events/Makefile                   |    2 +-
 kernel/events/core.c                     |    4 ++--
 kernel/ptrace.c                          |    4 ++--
 samples/Kconfig                          |    2 +-
 22 files changed, 49 insertions(+), 48 deletions(-)

diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
index f389b27..fc6ba18 100644
--- a/arch/arm/include/asm/hw_breakpoint.h
+++ b/arch/arm/include/asm/hw_breakpoint.h
@@ -5,7 +5,7 @@
 
 struct task_struct;
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 
 struct arch_hw_breakpoint_ctrl {
 		u32 __reserved	: 9,
@@ -128,6 +128,6 @@ int hw_breakpoint_slots(int type);
 #else
 static inline void clear_ptrace_hw_breakpoint(struct task_struct *tsk) {}
 
-#endif	/* CONFIG_HAVE_HW_BREAKPOINT */
+#endif	/* CONFIG_HW_BREAKPOINT */
 #endif	/* __KERNEL__ */
 #endif	/* _ARM_HW_BREAKPOINT_H */
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index b2d9df5..b86d135 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -30,7 +30,7 @@
 #endif
 
 struct debug_info {
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	struct perf_event	*hbp[ARM_MAX_HBP_SLOTS];
 #endif
 };
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 8d95446..e6c4b04 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -47,7 +47,7 @@ obj-$(CONFIG_HAVE_TCM)		+= tcm.o
 obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
 obj-$(CONFIG_SWP_EMULATE)	+= swp_emulate.o
 CFLAGS_swp_emulate.o		:= -Wa,-march=armv7-a
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= hw_breakpoint.o
 
 obj-$(CONFIG_CRUNCH)		+= crunch.o crunch-bits.o
 AFLAGS_crunch-bits.o		:= -Wa,-mcpu=ep9312
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 051166c..fbc7cc9 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -171,7 +171,7 @@
 	@ we can access the debug registers safely.
 	@
 	.macro	debug_entry, fsr
-#if defined(CONFIG_HAVE_HW_BREAKPOINT) && defined(CONFIG_PREEMPT)
+#if defined(CONFIG_HW_BREAKPOINT) && defined(CONFIG_PREEMPT)
 	ldr	r4, =0x40f		@ mask out fsr.fs
 	and	r5, r4, \fsr
 	cmp	r5, #2			@ debug exception
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 8182f45..07be604 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -468,7 +468,7 @@ static int ptrace_setvfpregs(struct task_struct *tsk, void __user *data)
 }
 #endif
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 /*
  * Convert a virtual register number into an index for a thread_info
  * breakpoint array. Breakpoints are identified using positive numbers
@@ -765,7 +765,7 @@ long arch_ptrace(struct task_struct *child, long request,
 			break;
 #endif
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 		case PTRACE_GETHBPREGS:
 			if (ptrace_get_breakpoints(child) < 0)
 				return -ESRCH;
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 1833d1a..36b5568 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -538,9 +538,9 @@ static inline int cpu_has_feature(unsigned long feature)
 		& feature);
 }
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 #define HBP_NUM 1
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 #endif /* !__ASSEMBLY__ */
 
diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h
index 1c33ec1..6ecd3b6 100644
--- a/arch/powerpc/include/asm/hw_breakpoint.h
+++ b/arch/powerpc/include/asm/hw_breakpoint.h
@@ -24,7 +24,7 @@
 #define _PPC_BOOK3S_64_HW_BREAKPOINT_H
 
 #ifdef	__KERNEL__
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 
 struct arch_hw_breakpoint {
 	bool		extraneous_interrupt;
@@ -65,10 +65,10 @@ static inline void hw_breakpoint_disable(void)
 }
 extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs);
 
-#else	/* CONFIG_HAVE_HW_BREAKPOINT */
+#else	/* CONFIG_HW_BREAKPOINT */
 static inline void hw_breakpoint_disable(void) { }
 static inline void thread_change_pc(struct task_struct *tsk,
 					struct pt_regs *regs) { }
-#endif	/* CONFIG_HAVE_HW_BREAKPOINT */
+#endif	/* CONFIG_HW_BREAKPOINT */
 #endif	/* __KERNEL__ */
 #endif	/* _PPC_BOOK3S_64_HW_BREAKPOINT_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index de1967a..3fe688d 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -207,14 +207,14 @@ struct thread_struct {
 #ifdef CONFIG_PPC64
 	unsigned long	start_tb;	/* Start purr when proc switched in */
 	unsigned long	accum_tb;	/* Total accumilated purr for process */
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	struct perf_event *ptrace_bps[HBP_NUM];
 	/*
 	 * Helps identify source of single-step exception and subsequent
 	 * hw-breakpoint enablement
 	 */
 	struct perf_event *last_hit_ubp;
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 #endif
 	unsigned long	dabr;		/* Data address breakpoint register */
 #ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 3bb2a3e..5df8585 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -36,7 +36,7 @@ obj-y				:= cputable.o ptrace.o syscalls.o \
 obj-$(CONFIG_PPC64)		+= setup_64.o sys_ppc32.o \
 				   signal_64.o ptrace32.o \
 				   paca.o nvram_64.o firmware.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= hw_breakpoint.o
 obj-$(CONFIG_PPC_BOOK3S_64)	+= cpu_setup_ppc970.o cpu_setup_pa6t.o
 obj64-$(CONFIG_RELOCATABLE)	+= reloc_64.o
 obj-$(CONFIG_PPC_BOOK3E_64)	+= exceptions-64e.o idle_book3e.o
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index f74f355..3faf61a 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -353,7 +353,7 @@ static void switch_booke_debug_regs(struct thread_struct *new_thread)
 			prime_debug_regs(new_thread);
 }
 #else	/* !CONFIG_PPC_ADV_DEBUG_REGS */
-#ifndef CONFIG_HAVE_HW_BREAKPOINT
+#ifndef CONFIG_HW_BREAKPOINT
 static void set_debug_reg_defaults(struct thread_struct *thread)
 {
 	if (thread->dabr) {
@@ -361,7 +361,7 @@ static void set_debug_reg_defaults(struct thread_struct *thread)
 		set_dabr(0);
 	}
 }
-#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* !CONFIG_HW_BREAKPOINT */
 #endif	/* CONFIG_PPC_ADV_DEBUG_REGS */
 
 int set_dabr(unsigned long dabr)
@@ -469,10 +469,10 @@ struct task_struct *__switch_to(struct task_struct *prev,
  * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
  * schedule DABR
  */
-#ifndef CONFIG_HAVE_HW_BREAKPOINT
+#ifndef CONFIG_HW_BREAKPOINT
 	if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
 		set_dabr(new->thread.dabr);
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 #endif
 
 
@@ -672,11 +672,11 @@ void flush_thread(void)
 {
 	discard_lazy_cpu_state();
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	flush_ptrace_hw_breakpoint(current);
-#else /* CONFIG_HAVE_HW_BREAKPOINT */
+#else /* CONFIG_HW_BREAKPOINT */
 	set_debug_reg_defaults(&current->thread);
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 }
 
 void
@@ -694,9 +694,9 @@ void prepare_to_copy(struct task_struct *tsk)
 	flush_altivec_to_thread(current);
 	flush_vsx_to_thread(current);
 	flush_spe_to_thread(current);
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	flush_ptrace_hw_breakpoint(tsk);
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 }
 
 /*
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index a6ae1cf..18c687e 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -877,7 +877,7 @@ void user_disable_single_step(struct task_struct *task)
 	clear_tsk_thread_flag(task, TIF_SINGLESTEP);
 }
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 void ptrace_triggered(struct perf_event *bp, int nmi,
 		      struct perf_sample_data *data, struct pt_regs *regs)
 {
@@ -893,17 +893,17 @@ void ptrace_triggered(struct perf_event *bp, int nmi,
 	attr.disabled = true;
 	modify_user_hw_breakpoint(bp, &attr);
 }
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 			       unsigned long data)
 {
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	int ret;
 	struct thread_struct *thread = &(task->thread);
 	struct perf_event *bp;
 	struct perf_event_attr attr;
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 	/* For ppc64 we support one DABR and no IABR's at the moment (ppc64).
 	 *  For embedded processors we support one DAC and no IAC's at the
@@ -932,7 +932,8 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 	/* Ensure breakpoint translation bit is set */
 	if (data && !(data & DABR_TRANSLATION))
 		return -EIO;
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+
+#ifdef CONFIG_HW_BREAKPOINT
 	if (ptrace_get_breakpoints(task) < 0)
 		return -ESRCH;
 
@@ -978,7 +979,7 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
 
 	ptrace_put_breakpoints(task);
 
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 	/* Move contents to the DABR register */
 	task->thread.dabr = data;
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 166a6a0..515d044 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -19,7 +19,7 @@ obj-$(CONFIG_PPC64)	+= copypage_64.o copyuser_64.o \
 			   checksum_wrappers_64.o hweight_64.o
 obj-$(CONFIG_XMON)	+= sstep.o ldstfp.o
 obj-$(CONFIG_KPROBES)	+= sstep.o ldstfp.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= sstep.o ldstfp.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= sstep.o ldstfp.o
 
 ifeq ($(CONFIG_PPC64),y)
 obj-$(CONFIG_SMP)	+= locks.o
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 77f7ae1..9d5075c 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,7 @@ obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
 
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT)		+= hw_breakpoint.o
 obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)	+= localtimer.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index cc122b1..5bec639 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -46,4 +46,4 @@ obj-y					+= $(clock-y)
 obj-$(CONFIG_SMP)			+= $(smp-y)
 obj-$(CONFIG_GENERIC_GPIO)		+= $(pinmux-y)
 obj-$(CONFIG_PERF_EVENTS)		+= perf_event.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= ubc.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= ubc.o
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index d1e55fe..9aad682 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -31,7 +31,7 @@ enum bp_type_idx {
 
 #include <linux/perf_event.h>
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 
 extern int __init init_hw_breakpoint(void);
 
@@ -108,7 +108,7 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
 	return &bp->hw.info;
 }
 
-#else /* !CONFIG_HAVE_HW_BREAKPOINT */
+#else /* !CONFIG_HW_BREAKPOINT */
 
 static inline int __init init_hw_breakpoint(void) { return 0; }
 
@@ -144,7 +144,7 @@ static inline struct arch_hw_breakpoint *counter_arch_bp(struct perf_event *bp)
 	return NULL;
 }
 
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_HW_BREAKPOINT_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 3412684..6a65fbf 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -491,7 +491,7 @@ struct perf_guest_info_callbacks {
 	unsigned long			(*get_guest_ip)(void);
 };
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 #include <asm/hw_breakpoint.h>
 #endif
 
@@ -556,7 +556,7 @@ struct hw_perf_event {
 		struct { /* software */
 			struct hrtimer	hrtimer;
 		};
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 		struct { /* breakpoint */
 			struct arch_hw_breakpoint	info;
 			struct list_head		bp_list;
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 9178d5c..9ff2641 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -190,7 +190,7 @@ static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
 		__ptrace_link(child, current->parent);
 	}
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	atomic_set(&child->ptrace_bp_refcnt, 1);
 #endif
 }
@@ -354,12 +354,12 @@ extern int task_current_syscall(struct task_struct *target, long *callno,
 				unsigned long args[6], unsigned int maxargs,
 				unsigned long *sp, unsigned long *pc);
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 extern int ptrace_get_breakpoints(struct task_struct *tsk);
 extern void ptrace_put_breakpoints(struct task_struct *tsk);
 #else
 static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
 
 #endif /* __KERNEL */
 
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 781abd1..b575989 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1537,7 +1537,7 @@ struct task_struct {
 		unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
 	} memcg_batch;
 #endif
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 	atomic_t ptrace_bp_refcnt;
 #endif
 };
diff --git a/kernel/events/Makefile b/kernel/events/Makefile
index 1ce23d3..3659100 100644
--- a/kernel/events/Makefile
+++ b/kernel/events/Makefile
@@ -3,4 +3,4 @@ CFLAGS_REMOVE_core.o = -pg
 endif
 
 obj-y := core.o
-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
+obj-$(CONFIG_HW_BREAKPOINT) += hw_breakpoint.o
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 0fc34a3..9f19c33 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -5616,7 +5616,7 @@ static void perf_event_free_filter(struct perf_event *event)
 
 #endif /* CONFIG_EVENT_TRACING */
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 void perf_bp_event(struct perf_event *bp, void *data)
 {
 	struct perf_sample_data sample;
@@ -6207,7 +6207,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
 
 	if (task) {
 		event->attach_state = PERF_ATTACH_TASK;
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 		/*
 		 * hw_breakpoint is a bit difficult here..
 		 */
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index dc7ab65..4c2cff7 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -881,7 +881,7 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
 }
 #endif	/* CONFIG_COMPAT */
 
-#ifdef CONFIG_HAVE_HW_BREAKPOINT
+#ifdef CONFIG_HW_BREAKPOINT
 int ptrace_get_breakpoints(struct task_struct *tsk)
 {
 	if (atomic_inc_not_zero(&tsk->ptrace_bp_refcnt))
@@ -895,4 +895,4 @@ void ptrace_put_breakpoints(struct task_struct *tsk)
 	if (atomic_dec_and_test(&tsk->ptrace_bp_refcnt))
 		flush_ptrace_hw_breakpoint(tsk);
 }
-#endif /* CONFIG_HAVE_HW_BREAKPOINT */
+#endif /* CONFIG_HW_BREAKPOINT */
diff --git a/samples/Kconfig b/samples/Kconfig
index 41063e7..d1e41e9 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -40,7 +40,7 @@ config SAMPLE_KRETPROBES
 
 config SAMPLE_HW_BREAKPOINT
 	tristate "Build kernel hardware breakpoint examples -- loadable module only"
-	depends on HAVE_HW_BREAKPOINT && m
+	depends on HW_BREAKPOINT && m
 	help
 	  This builds kernel hardware breakpoint example modules.
 
-- 
1.7.3.2

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

* [PATCH 3/6] x86: Allow the user not to build hw_breakpoints
  2011-05-24 21:52 ` Frederic Weisbecker
@ 2011-05-24 21:52   ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, linuxppc-dev, Ingo Molnar,
	Peter Zijlstra, Jason Wessel, H. Peter Anvin, Thomas Gleixner

So that hw_breakpoints and perf can be not built on
specific embedded systems.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/Kconfig                |    3 +--
 arch/x86/include/asm/debugreg.h |   33 +++++++++++++++++++++++++++++++--
 arch/x86/kernel/Makefile        |    3 ++-
 arch/x86/kernel/process.c       |    1 +
 arch/x86/kernel/ptrace.c        |   17 +++++++++++++++++
 5 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8b49bff..fb28dd9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -41,7 +41,7 @@ config X86
 	select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_KVM
-	select HAVE_ARCH_KGDB
+	select HAVE_ARCH_KGDB if HW_BREAKPOINT
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_DMA_COHERENT if X86_32
 	select HAVE_EFFICIENT_UNALIGNED_ACCESS
@@ -54,7 +54,6 @@ config X86
 	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
-	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select HAVE_PERF_EVENTS_NMI
diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h
index 078ad0c..c40d6d4 100644
--- a/arch/x86/include/asm/debugreg.h
+++ b/arch/x86/include/asm/debugreg.h
@@ -78,8 +78,6 @@
  */
 #ifdef __KERNEL__
 
-DECLARE_PER_CPU(unsigned long, cpu_dr7);
-
 static inline void hw_breakpoint_disable(void)
 {
 	/* Zero the control register for HW Breakpoint */
@@ -92,6 +90,10 @@ static inline void hw_breakpoint_disable(void)
 	set_debugreg(0UL, 3);
 }
 
+#ifdef CONFIG_HW_BREAKPOINT
+
+DECLARE_PER_CPU(unsigned long, cpu_dr7);
+
 static inline int hw_breakpoint_active(void)
 {
 	return __this_cpu_read(cpu_dr7) & DR_GLOBAL_ENABLE_MASK;
@@ -100,6 +102,33 @@ static inline int hw_breakpoint_active(void)
 extern void aout_dump_debugregs(struct user *dump);
 
 extern void hw_breakpoint_restore(void);
+#else
+static inline int hw_breakpoint_active(void)
+{
+	return 0;
+}
+
+static inline void hw_breakpoint_restore(void)
+{
+	set_debugreg(0UL, 0);
+	set_debugreg(0UL, 1);
+	set_debugreg(0UL, 2);
+	set_debugreg(0UL, 3);
+	set_debugreg(current->thread.debugreg6, 6);
+	set_debugreg(0UL, 7);
+}
+
+static inline void aout_dump_debugregs(struct user *dump)
+{
+	int i;
+
+	for (i = 0; i < 6; i++)
+		dump->u_debugreg[i] = 0;
+
+	dump->u_debugreg[6] = current->thread.debugreg6;
+	dump->u_debugreg[7] = 0;
+}
+#endif /* CONFIG_HW_BREAKPOINT */
 
 #endif	/* __KERNEL__ */
 
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 7338ef2..270e439 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -42,7 +42,7 @@ obj-$(CONFIG_X86_64)	+= sys_x86_64.o x8664_ksyms_64.o
 obj-$(CONFIG_X86_64)	+= syscall_64.o vsyscall_64.o
 obj-y			+= bootflag.o e820.o
 obj-y			+= pci-dma.o quirks.o topology.o kdebugfs.o
-obj-y			+= alternative.o i8253.o pci-nommu.o hw_breakpoint.o
+obj-y			+= alternative.o i8253.o pci-nommu.o
 obj-y			+= tsc.o io_delay.o rtc.o
 obj-y			+= pci-iommu_table.o
 obj-y			+= resource.o
@@ -51,6 +51,7 @@ obj-y				+= trampoline.o trampoline_$(BITS).o
 obj-y				+= process.o
 obj-y				+= i387.o xsave.o
 obj-y				+= ptrace.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= hw_breakpoint.o
 obj-$(CONFIG_X86_32)		+= tls.o
 obj-$(CONFIG_IA32_EMULATION)	+= tls.o
 obj-y				+= step.o
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index d46cbe4..d1adbd1 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -22,6 +22,7 @@
 #include <asm/uaccess.h>
 #include <asm/i387.h>
 #include <asm/debugreg.h>
+#include <asm/kdebug.h>
 
 struct kmem_cache *task_xstate_cachep;
 EXPORT_SYMBOL_GPL(task_xstate_cachep);
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index f65e5b5..091f110c 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -528,6 +528,7 @@ static int genregs_set(struct task_struct *target,
 	return ret;
 }
 
+#ifdef CONFIG_HW_BREAKPOINT
 static void ptrace_triggered(struct perf_event *bp, int nmi,
 			     struct perf_sample_data *data,
 			     struct pt_regs *regs)
@@ -777,6 +778,22 @@ ret_path:
 	return rc;
 }
 
+#else /* !CONFIG_HW_BREAKPOINT */
+
+static inline unsigned long
+ptrace_get_debugreg(struct task_struct *tsk, int n)
+{
+	return -ENOSYS;
+}
+
+static inline
+int ptrace_set_debugreg(struct task_struct *tsk, int n, unsigned long val)
+{
+	return -ENOSYS;
+}
+
+#endif /* CONFIG_HW_BREAKPOINT */
+
 /*
  * These access the current or another (stopped) task's io permission
  * bitmap for debugging or core dump.
-- 
1.7.3.2


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

* [PATCH 3/6] x86: Allow the user not to build hw_breakpoints
@ 2011-05-24 21:52   ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, Frederic Weisbecker, H. Peter Anvin, LKML,
	Jason Wessel, Ingo Molnar, linuxppc-dev, Thomas Gleixner

So that hw_breakpoints and perf can be not built on
specific embedded systems.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/Kconfig                |    3 +--
 arch/x86/include/asm/debugreg.h |   33 +++++++++++++++++++++++++++++++--
 arch/x86/kernel/Makefile        |    3 ++-
 arch/x86/kernel/process.c       |    1 +
 arch/x86/kernel/ptrace.c        |   17 +++++++++++++++++
 5 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8b49bff..fb28dd9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -41,7 +41,7 @@ config X86
 	select HAVE_FTRACE_NMI_ENTER if DYNAMIC_FTRACE
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_KVM
-	select HAVE_ARCH_KGDB
+	select HAVE_ARCH_KGDB if HW_BREAKPOINT
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_DMA_COHERENT if X86_32
 	select HAVE_EFFICIENT_UNALIGNED_ACCESS
@@ -54,7 +54,6 @@ config X86
 	select HAVE_KERNEL_XZ
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
-	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select HAVE_PERF_EVENTS_NMI
diff --git a/arch/x86/include/asm/debugreg.h b/arch/x86/include/asm/debugreg.h
index 078ad0c..c40d6d4 100644
--- a/arch/x86/include/asm/debugreg.h
+++ b/arch/x86/include/asm/debugreg.h
@@ -78,8 +78,6 @@
  */
 #ifdef __KERNEL__
 
-DECLARE_PER_CPU(unsigned long, cpu_dr7);
-
 static inline void hw_breakpoint_disable(void)
 {
 	/* Zero the control register for HW Breakpoint */
@@ -92,6 +90,10 @@ static inline void hw_breakpoint_disable(void)
 	set_debugreg(0UL, 3);
 }
 
+#ifdef CONFIG_HW_BREAKPOINT
+
+DECLARE_PER_CPU(unsigned long, cpu_dr7);
+
 static inline int hw_breakpoint_active(void)
 {
 	return __this_cpu_read(cpu_dr7) & DR_GLOBAL_ENABLE_MASK;
@@ -100,6 +102,33 @@ static inline int hw_breakpoint_active(void)
 extern void aout_dump_debugregs(struct user *dump);
 
 extern void hw_breakpoint_restore(void);
+#else
+static inline int hw_breakpoint_active(void)
+{
+	return 0;
+}
+
+static inline void hw_breakpoint_restore(void)
+{
+	set_debugreg(0UL, 0);
+	set_debugreg(0UL, 1);
+	set_debugreg(0UL, 2);
+	set_debugreg(0UL, 3);
+	set_debugreg(current->thread.debugreg6, 6);
+	set_debugreg(0UL, 7);
+}
+
+static inline void aout_dump_debugregs(struct user *dump)
+{
+	int i;
+
+	for (i = 0; i < 6; i++)
+		dump->u_debugreg[i] = 0;
+
+	dump->u_debugreg[6] = current->thread.debugreg6;
+	dump->u_debugreg[7] = 0;
+}
+#endif /* CONFIG_HW_BREAKPOINT */
 
 #endif	/* __KERNEL__ */
 
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 7338ef2..270e439 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -42,7 +42,7 @@ obj-$(CONFIG_X86_64)	+= sys_x86_64.o x8664_ksyms_64.o
 obj-$(CONFIG_X86_64)	+= syscall_64.o vsyscall_64.o
 obj-y			+= bootflag.o e820.o
 obj-y			+= pci-dma.o quirks.o topology.o kdebugfs.o
-obj-y			+= alternative.o i8253.o pci-nommu.o hw_breakpoint.o
+obj-y			+= alternative.o i8253.o pci-nommu.o
 obj-y			+= tsc.o io_delay.o rtc.o
 obj-y			+= pci-iommu_table.o
 obj-y			+= resource.o
@@ -51,6 +51,7 @@ obj-y				+= trampoline.o trampoline_$(BITS).o
 obj-y				+= process.o
 obj-y				+= i387.o xsave.o
 obj-y				+= ptrace.o
+obj-$(CONFIG_HW_BREAKPOINT)	+= hw_breakpoint.o
 obj-$(CONFIG_X86_32)		+= tls.o
 obj-$(CONFIG_IA32_EMULATION)	+= tls.o
 obj-y				+= step.o
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index d46cbe4..d1adbd1 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -22,6 +22,7 @@
 #include <asm/uaccess.h>
 #include <asm/i387.h>
 #include <asm/debugreg.h>
+#include <asm/kdebug.h>
 
 struct kmem_cache *task_xstate_cachep;
 EXPORT_SYMBOL_GPL(task_xstate_cachep);
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index f65e5b5..091f110c 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -528,6 +528,7 @@ static int genregs_set(struct task_struct *target,
 	return ret;
 }
 
+#ifdef CONFIG_HW_BREAKPOINT
 static void ptrace_triggered(struct perf_event *bp, int nmi,
 			     struct perf_sample_data *data,
 			     struct pt_regs *regs)
@@ -777,6 +778,22 @@ ret_path:
 	return rc;
 }
 
+#else /* !CONFIG_HW_BREAKPOINT */
+
+static inline unsigned long
+ptrace_get_debugreg(struct task_struct *tsk, int n)
+{
+	return -ENOSYS;
+}
+
+static inline
+int ptrace_set_debugreg(struct task_struct *tsk, int n, unsigned long val)
+{
+	return -ENOSYS;
+}
+
+#endif /* CONFIG_HW_BREAKPOINT */
+
 /*
  * These access the current or another (stopped) task's io permission
  * bitmap for debugging or core dump.
-- 
1.7.3.2

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

* [PATCH 4/6] hw_breakpoints: Breakpoints arch ability don't need perf events
  2011-05-24 21:52 ` Frederic Weisbecker
@ 2011-05-24 21:52   ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, linuxppc-dev, Ingo Molnar,
	Peter Zijlstra, Will Deacon, Prasad, Paul Mundt

The breakpoint support ability in an arch is not related
to the fact perf events is built or not. HAVE_HW_BREAKPOINT
only shows an ability so this dependency makes no sense
anymore. Archs that select HAVE_HW_BREAKPOINT already
ensure that perf event is built.

Remove that dependency.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/Kconfig |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index f78c2be..ce4be89 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -149,7 +149,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
 
 config HAVE_HW_BREAKPOINT
 	bool
-	depends on PERF_EVENTS
 
 config HAVE_MIXED_BREAKPOINTS_REGS
 	bool
-- 
1.7.3.2


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

* [PATCH 4/6] hw_breakpoints: Breakpoints arch ability don't need perf events
@ 2011-05-24 21:52   ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, Frederic Weisbecker, Will Deacon, LKML,
	Paul Mundt, Prasad, Ingo Molnar, linuxppc-dev

The breakpoint support ability in an arch is not related
to the fact perf events is built or not. HAVE_HW_BREAKPOINT
only shows an ability so this dependency makes no sense
anymore. Archs that select HAVE_HW_BREAKPOINT already
ensure that perf event is built.

Remove that dependency.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/Kconfig |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index f78c2be..ce4be89 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -149,7 +149,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
 
 config HAVE_HW_BREAKPOINT
 	bool
-	depends on PERF_EVENTS
 
 config HAVE_MIXED_BREAKPOINTS_REGS
 	bool
-- 
1.7.3.2

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

* [PATCH 5/6] hw_breakpoints: Only force perf events if breakpoints are selected
  2011-05-24 21:52 ` Frederic Weisbecker
@ 2011-05-24 21:52   ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, linuxppc-dev, Ingo Molnar,
	Peter Zijlstra, Will Deacon, Prasad, Paul Mundt

Previously, arch were forced to always build perf events if they
supported hw_breakpoints.

Now that the user can choose not to build hw_breakpoints, let
only force perf events if hw_breakpoints are selected.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/Kconfig  |    1 -
 arch/x86/Kconfig |    1 -
 init/Kconfig     |    1 +
 3 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 0d4d124..d59e6c2 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -46,7 +46,6 @@ config SUPERH32
 	select HAVE_HW_BREAKPOINT
 	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
-	select PERF_EVENTS
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select SPARSE_IRQ
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fb28dd9..5317f42 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -55,7 +55,6 @@ config X86
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
-	select PERF_EVENTS
 	select HAVE_PERF_EVENTS_NMI
 	select ANON_INODES
 	select HAVE_ARCH_KMEMCHECK
diff --git a/init/Kconfig b/init/Kconfig
index 76ae53e..9ae3555 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -927,6 +927,7 @@ menuconfig EXPERT
 config HW_BREAKPOINT
 	bool "Hardware breakpoints" if EXPERT
 	depends on HAVE_HW_BREAKPOINT
+	select PERF_EVENTS
 	default y
 	help
 	  Hardware breakpoints are a feature implemented by most CPUs
-- 
1.7.3.2


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

* [PATCH 5/6] hw_breakpoints: Only force perf events if breakpoints are selected
@ 2011-05-24 21:52   ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, Frederic Weisbecker, Will Deacon, LKML,
	Paul Mundt, Prasad, Ingo Molnar, linuxppc-dev

Previously, arch were forced to always build perf events if they
supported hw_breakpoints.

Now that the user can choose not to build hw_breakpoints, let
only force perf events if hw_breakpoints are selected.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/Kconfig  |    1 -
 arch/x86/Kconfig |    1 -
 init/Kconfig     |    1 +
 3 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 0d4d124..d59e6c2 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -46,7 +46,6 @@ config SUPERH32
 	select HAVE_HW_BREAKPOINT
 	select HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
-	select PERF_EVENTS
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select SPARSE_IRQ
 
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index fb28dd9..5317f42 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -55,7 +55,6 @@ config X86
 	select HAVE_KERNEL_LZO
 	select HAVE_HW_BREAKPOINT
 	select HAVE_MIXED_BREAKPOINTS_REGS
-	select PERF_EVENTS
 	select HAVE_PERF_EVENTS_NMI
 	select ANON_INODES
 	select HAVE_ARCH_KMEMCHECK
diff --git a/init/Kconfig b/init/Kconfig
index 76ae53e..9ae3555 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -927,6 +927,7 @@ menuconfig EXPERT
 config HW_BREAKPOINT
 	bool "Hardware breakpoints" if EXPERT
 	depends on HAVE_HW_BREAKPOINT
+	select PERF_EVENTS
 	default y
 	help
 	  Hardware breakpoints are a feature implemented by most CPUs
-- 
1.7.3.2

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

* [PATCH 6/6] hw_breakpoints: Drop remaining misplaced dependency on perf
  2011-05-24 21:52 ` Frederic Weisbecker
@ 2011-05-24 21:52   ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: LKML, Frederic Weisbecker, linuxppc-dev, Ingo Molnar,
	Peter Zijlstra, Prasad, Paul Mundt

Powerpc and Arm select breakpoint support ability only if
Perf is built. This is not necessary anymore now that we
enable perf once breakpoints support is selected.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/arm/Kconfig     |    2 +-
 arch/powerpc/Kconfig |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 377a7a5..1d3a0b4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -24,7 +24,7 @@ config ARM
 	select HAVE_PERF_EVENTS
 	select PERF_USE_VMALLOC
 	select HAVE_REGS_AND_STACK_ACCESS_API
-	select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
+	select HAVE_HW_BREAKPOINT if (CPU_V6 || CPU_V6K || CPU_V7)
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_GENERIC_HARDIRQS
 	select HAVE_SPARSE_IRQ
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8f4d50b..e944eb8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -134,7 +134,7 @@ config PPC
 	select HAVE_IRQ_WORK
 	select HAVE_PERF_EVENTS
 	select HAVE_REGS_AND_STACK_ACCESS_API
-	select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
+	select HAVE_HW_BREAKPOINT if PPC_BOOK3S_64
 	select HAVE_GENERIC_HARDIRQS
 	select HAVE_SPARSE_IRQ
 	select IRQ_PER_CPU
-- 
1.7.3.2


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

* [PATCH 6/6] hw_breakpoints: Drop remaining misplaced dependency on perf
@ 2011-05-24 21:52   ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-05-24 21:52 UTC (permalink / raw)
  To: LKML
  Cc: Peter Zijlstra, Frederic Weisbecker, LKML, Paul Mundt, Prasad,
	Ingo Molnar, linuxppc-dev

Powerpc and Arm select breakpoint support ability only if
Perf is built. This is not necessary anymore now that we
enable perf once breakpoints support is selected.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Prasad <prasad@linux.vnet.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
---
 arch/arm/Kconfig     |    2 +-
 arch/powerpc/Kconfig |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 377a7a5..1d3a0b4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -24,7 +24,7 @@ config ARM
 	select HAVE_PERF_EVENTS
 	select PERF_USE_VMALLOC
 	select HAVE_REGS_AND_STACK_ACCESS_API
-	select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
+	select HAVE_HW_BREAKPOINT if (CPU_V6 || CPU_V6K || CPU_V7)
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_GENERIC_HARDIRQS
 	select HAVE_SPARSE_IRQ
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 8f4d50b..e944eb8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -134,7 +134,7 @@ config PPC
 	select HAVE_IRQ_WORK
 	select HAVE_PERF_EVENTS
 	select HAVE_REGS_AND_STACK_ACCESS_API
-	select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
+	select HAVE_HW_BREAKPOINT if PPC_BOOK3S_64
 	select HAVE_GENERIC_HARDIRQS
 	select HAVE_SPARSE_IRQ
 	select IRQ_PER_CPU
-- 
1.7.3.2

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

* Re: [PATCH v2] hw_breakpoint: Let the user choose not to build it (and perf too)
  2011-05-24 21:52 ` Frederic Weisbecker
@ 2011-05-25  2:27   ` Paul Mundt
  -1 siblings, 0 replies; 26+ messages in thread
From: Paul Mundt @ 2011-05-25  2:27 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, Ingo Molnar, Will Deacon, Peter Zijlstra, Prasad,
	Jason Wessel, H . Peter Anvin, Thomas Gleixner, linuxppc-dev

On Tue, May 24, 2011 at 11:52:21PM +0200, Frederic Weisbecker wrote:
> Mostly just a rebase against latest upstream
> updates and acks from Will Deacon added In this second version.
> 
> Please tell me if you are ok with this set.
> 
> Thanks.
> 
> ---
> 
> Frederic Weisbecker (6):
>       hw_breakpoints: Split hardware breakpoints config
>       hw_breakpoints: Migrate breakpoint conditional build under new config
>       x86: Allow the user not to build hw_breakpoints
>       hw_breakpoints: Breakpoints arch ability don't need perf events
>       hw_breakpoints: Only force perf events if breakpoints are selected
>       hw_breakpoints: Drop remaining misplaced dependency on perf
> 
The series looks good to me:

Acked-by: Paul Mundt <lethal@linux-sh.org>

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

* Re: [PATCH v2] hw_breakpoint: Let the user choose not to build it (and perf too)
@ 2011-05-25  2:27   ` Paul Mundt
  0 siblings, 0 replies; 26+ messages in thread
From: Paul Mundt @ 2011-05-25  2:27 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Peter Zijlstra, linuxppc-dev, H . Peter Anvin, Will Deacon, LKML,
	Jason Wessel, Ingo Molnar, Prasad, Thomas Gleixner

On Tue, May 24, 2011 at 11:52:21PM +0200, Frederic Weisbecker wrote:
> Mostly just a rebase against latest upstream
> updates and acks from Will Deacon added In this second version.
> 
> Please tell me if you are ok with this set.
> 
> Thanks.
> 
> ---
> 
> Frederic Weisbecker (6):
>       hw_breakpoints: Split hardware breakpoints config
>       hw_breakpoints: Migrate breakpoint conditional build under new config
>       x86: Allow the user not to build hw_breakpoints
>       hw_breakpoints: Breakpoints arch ability don't need perf events
>       hw_breakpoints: Only force perf events if breakpoints are selected
>       hw_breakpoints: Drop remaining misplaced dependency on perf
> 
The series looks good to me:

Acked-by: Paul Mundt <lethal@linux-sh.org>

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

* Re: [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
  2011-05-24 21:52   ` Frederic Weisbecker
@ 2011-07-04 13:27     ` K.Prasad
  -1 siblings, 0 replies; 26+ messages in thread
From: K.Prasad @ 2011-07-04 13:27 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, linuxppc-dev, Ingo Molnar, Peter Zijlstra, Paul Mundt

On Tue, May 24, 2011 at 11:52:23PM +0200, Frederic Weisbecker wrote:
> Migrate conditional hw_breakpoint code compilation under
> the new config to prepare for letting the user chose whether
> or not to build this feature
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Acked-by: Will Deacon <will.deacon@arm.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Prasad <prasad@linux.vnet.ibm.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> ---
>  arch/arm/include/asm/hw_breakpoint.h     |    4 ++--
>  arch/arm/include/asm/processor.h         |    2 +-
>  arch/arm/kernel/Makefile                 |    2 +-
>  arch/arm/kernel/entry-header.S           |    2 +-
>  arch/arm/kernel/ptrace.c                 |    4 ++--
>  arch/powerpc/include/asm/cputable.h      |    4 ++--
>  arch/powerpc/include/asm/hw_breakpoint.h |    6 +++---
>  arch/powerpc/include/asm/processor.h     |    4 ++--
>  arch/powerpc/kernel/Makefile             |    2 +-
>  arch/powerpc/kernel/process.c            |   18 +++++++++---------
>  arch/powerpc/kernel/ptrace.c             |   13 +++++++------
>  arch/powerpc/lib/Makefile                |    2 +-
>  arch/sh/kernel/Makefile                  |    2 +-
>  arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
>  include/linux/hw_breakpoint.h            |    6 +++---
>  include/linux/perf_event.h               |    4 ++--
>  include/linux/ptrace.h                   |    6 +++---
>  include/linux/sched.h                    |    2 +-
>  kernel/events/Makefile                   |    2 +-
>  kernel/events/core.c                     |    4 ++--
>  kernel/ptrace.c                          |    4 ++--
>  samples/Kconfig                          |    2 +-
>  22 files changed, 49 insertions(+), 48 deletions(-)
> 

Making the hardware breakpoint patches modular has always been a goal.
I've looked at the PowerPC parts of the code and they look harmless.

Acked-by: K.Prasad <prasad@linux.vnet.ibm.com>

Thanks,
K.Prasad


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

* Re: [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
@ 2011-07-04 13:27     ` K.Prasad
  0 siblings, 0 replies; 26+ messages in thread
From: K.Prasad @ 2011-07-04 13:27 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Ingo Molnar, Paul Mundt, linuxppc-dev, LKML, Peter Zijlstra

On Tue, May 24, 2011 at 11:52:23PM +0200, Frederic Weisbecker wrote:
> Migrate conditional hw_breakpoint code compilation under
> the new config to prepare for letting the user chose whether
> or not to build this feature
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Acked-by: Will Deacon <will.deacon@arm.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Prasad <prasad@linux.vnet.ibm.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> ---
>  arch/arm/include/asm/hw_breakpoint.h     |    4 ++--
>  arch/arm/include/asm/processor.h         |    2 +-
>  arch/arm/kernel/Makefile                 |    2 +-
>  arch/arm/kernel/entry-header.S           |    2 +-
>  arch/arm/kernel/ptrace.c                 |    4 ++--
>  arch/powerpc/include/asm/cputable.h      |    4 ++--
>  arch/powerpc/include/asm/hw_breakpoint.h |    6 +++---
>  arch/powerpc/include/asm/processor.h     |    4 ++--
>  arch/powerpc/kernel/Makefile             |    2 +-
>  arch/powerpc/kernel/process.c            |   18 +++++++++---------
>  arch/powerpc/kernel/ptrace.c             |   13 +++++++------
>  arch/powerpc/lib/Makefile                |    2 +-
>  arch/sh/kernel/Makefile                  |    2 +-
>  arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
>  include/linux/hw_breakpoint.h            |    6 +++---
>  include/linux/perf_event.h               |    4 ++--
>  include/linux/ptrace.h                   |    6 +++---
>  include/linux/sched.h                    |    2 +-
>  kernel/events/Makefile                   |    2 +-
>  kernel/events/core.c                     |    4 ++--
>  kernel/ptrace.c                          |    4 ++--
>  samples/Kconfig                          |    2 +-
>  22 files changed, 49 insertions(+), 48 deletions(-)
> 

Making the hardware breakpoint patches modular has always been a goal.
I've looked at the PowerPC parts of the code and they look harmless.

Acked-by: K.Prasad <prasad@linux.vnet.ibm.com>

Thanks,
K.Prasad

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

* Re: [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
  2011-07-04 13:27     ` K.Prasad
@ 2011-07-04 13:29       ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-07-04 13:29 UTC (permalink / raw)
  To: K.Prasad; +Cc: LKML, linuxppc-dev, Ingo Molnar, Peter Zijlstra, Paul Mundt

On Mon, Jul 04, 2011 at 06:57:46PM +0530, K.Prasad wrote:
> On Tue, May 24, 2011 at 11:52:23PM +0200, Frederic Weisbecker wrote:
> > Migrate conditional hw_breakpoint code compilation under
> > the new config to prepare for letting the user chose whether
> > or not to build this feature
> > 
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Acked-by: Will Deacon <will.deacon@arm.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Prasad <prasad@linux.vnet.ibm.com>
> > Cc: Paul Mundt <lethal@linux-sh.org>
> > ---
> >  arch/arm/include/asm/hw_breakpoint.h     |    4 ++--
> >  arch/arm/include/asm/processor.h         |    2 +-
> >  arch/arm/kernel/Makefile                 |    2 +-
> >  arch/arm/kernel/entry-header.S           |    2 +-
> >  arch/arm/kernel/ptrace.c                 |    4 ++--
> >  arch/powerpc/include/asm/cputable.h      |    4 ++--
> >  arch/powerpc/include/asm/hw_breakpoint.h |    6 +++---
> >  arch/powerpc/include/asm/processor.h     |    4 ++--
> >  arch/powerpc/kernel/Makefile             |    2 +-
> >  arch/powerpc/kernel/process.c            |   18 +++++++++---------
> >  arch/powerpc/kernel/ptrace.c             |   13 +++++++------
> >  arch/powerpc/lib/Makefile                |    2 +-
> >  arch/sh/kernel/Makefile                  |    2 +-
> >  arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
> >  include/linux/hw_breakpoint.h            |    6 +++---
> >  include/linux/perf_event.h               |    4 ++--
> >  include/linux/ptrace.h                   |    6 +++---
> >  include/linux/sched.h                    |    2 +-
> >  kernel/events/Makefile                   |    2 +-
> >  kernel/events/core.c                     |    4 ++--
> >  kernel/ptrace.c                          |    4 ++--
> >  samples/Kconfig                          |    2 +-
> >  22 files changed, 49 insertions(+), 48 deletions(-)
> > 
> 
> Making the hardware breakpoint patches modular has always been a goal.
> I've looked at the PowerPC parts of the code and they look harmless.
> 
> Acked-by: K.Prasad <prasad@linux.vnet.ibm.com>

Great!

I'll push that soon, thanks guys for your acks!

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

* Re: [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
@ 2011-07-04 13:29       ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-07-04 13:29 UTC (permalink / raw)
  To: K.Prasad; +Cc: Ingo Molnar, Paul Mundt, linuxppc-dev, LKML, Peter Zijlstra

On Mon, Jul 04, 2011 at 06:57:46PM +0530, K.Prasad wrote:
> On Tue, May 24, 2011 at 11:52:23PM +0200, Frederic Weisbecker wrote:
> > Migrate conditional hw_breakpoint code compilation under
> > the new config to prepare for letting the user chose whether
> > or not to build this feature
> > 
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Acked-by: Will Deacon <will.deacon@arm.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Prasad <prasad@linux.vnet.ibm.com>
> > Cc: Paul Mundt <lethal@linux-sh.org>
> > ---
> >  arch/arm/include/asm/hw_breakpoint.h     |    4 ++--
> >  arch/arm/include/asm/processor.h         |    2 +-
> >  arch/arm/kernel/Makefile                 |    2 +-
> >  arch/arm/kernel/entry-header.S           |    2 +-
> >  arch/arm/kernel/ptrace.c                 |    4 ++--
> >  arch/powerpc/include/asm/cputable.h      |    4 ++--
> >  arch/powerpc/include/asm/hw_breakpoint.h |    6 +++---
> >  arch/powerpc/include/asm/processor.h     |    4 ++--
> >  arch/powerpc/kernel/Makefile             |    2 +-
> >  arch/powerpc/kernel/process.c            |   18 +++++++++---------
> >  arch/powerpc/kernel/ptrace.c             |   13 +++++++------
> >  arch/powerpc/lib/Makefile                |    2 +-
> >  arch/sh/kernel/Makefile                  |    2 +-
> >  arch/sh/kernel/cpu/sh4a/Makefile         |    2 +-
> >  include/linux/hw_breakpoint.h            |    6 +++---
> >  include/linux/perf_event.h               |    4 ++--
> >  include/linux/ptrace.h                   |    6 +++---
> >  include/linux/sched.h                    |    2 +-
> >  kernel/events/Makefile                   |    2 +-
> >  kernel/events/core.c                     |    4 ++--
> >  kernel/ptrace.c                          |    4 ++--
> >  samples/Kconfig                          |    2 +-
> >  22 files changed, 49 insertions(+), 48 deletions(-)
> > 
> 
> Making the hardware breakpoint patches modular has always been a goal.
> I've looked at the PowerPC parts of the code and they look harmless.
> 
> Acked-by: K.Prasad <prasad@linux.vnet.ibm.com>

Great!

I'll push that soon, thanks guys for your acks!

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

* Re: [PATCH 4/6] hw_breakpoints: Breakpoints arch ability don't need perf events
  2011-05-24 21:52   ` Frederic Weisbecker
@ 2011-07-04 13:32     ` K.Prasad
  -1 siblings, 0 replies; 26+ messages in thread
From: K.Prasad @ 2011-07-04 13:32 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, linuxppc-dev, Ingo Molnar, Peter Zijlstra, Will Deacon, Paul Mundt

On Tue, May 24, 2011 at 11:52:25PM +0200, Frederic Weisbecker wrote:
> The breakpoint support ability in an arch is not related
> to the fact perf events is built or not. HAVE_HW_BREAKPOINT
> only shows an ability so this dependency makes no sense
> anymore. Archs that select HAVE_HW_BREAKPOINT already
> ensure that perf event is built.
> 
> Remove that dependency.
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Prasad <prasad@linux.vnet.ibm.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> ---
>  arch/Kconfig |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index f78c2be..ce4be89 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -149,7 +149,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
> 
>  config HAVE_HW_BREAKPOINT
>  	bool
> -	depends on PERF_EVENTS
> 
>  config HAVE_MIXED_BREAKPOINTS_REGS
>  	bool
> -- 

Just a thought you might want to consider...

The need to keep the ability (HAVE_HW_BREAKPOINT) and the user-choice to
enable hardware breakpoints (through HW_BREAKPOINT) in separate config
options isn't very clear to me (and is a bit confusing with very similar
names).

Why not make HAVE_HW_BREAKPOINT selectable by the user (which in turn
would turn on PERF_EVENTS) for a given architecture?

Thanks,
K.Prasad


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

* Re: [PATCH 4/6] hw_breakpoints: Breakpoints arch ability don't need perf events
@ 2011-07-04 13:32     ` K.Prasad
  0 siblings, 0 replies; 26+ messages in thread
From: K.Prasad @ 2011-07-04 13:32 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Peter Zijlstra, Will Deacon, LKML, Paul Mundt, Ingo Molnar, linuxppc-dev

On Tue, May 24, 2011 at 11:52:25PM +0200, Frederic Weisbecker wrote:
> The breakpoint support ability in an arch is not related
> to the fact perf events is built or not. HAVE_HW_BREAKPOINT
> only shows an ability so this dependency makes no sense
> anymore. Archs that select HAVE_HW_BREAKPOINT already
> ensure that perf event is built.
> 
> Remove that dependency.
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Prasad <prasad@linux.vnet.ibm.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> ---
>  arch/Kconfig |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index f78c2be..ce4be89 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -149,7 +149,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
> 
>  config HAVE_HW_BREAKPOINT
>  	bool
> -	depends on PERF_EVENTS
> 
>  config HAVE_MIXED_BREAKPOINTS_REGS
>  	bool
> -- 

Just a thought you might want to consider...

The need to keep the ability (HAVE_HW_BREAKPOINT) and the user-choice to
enable hardware breakpoints (through HW_BREAKPOINT) in separate config
options isn't very clear to me (and is a bit confusing with very similar
names).

Why not make HAVE_HW_BREAKPOINT selectable by the user (which in turn
would turn on PERF_EVENTS) for a given architecture?

Thanks,
K.Prasad

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

* Re: [PATCH 4/6] hw_breakpoints: Breakpoints arch ability don't need perf events
  2011-07-04 13:32     ` K.Prasad
@ 2011-07-04 13:37       ` Frederic Weisbecker
  -1 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-07-04 13:37 UTC (permalink / raw)
  To: K.Prasad
  Cc: LKML, linuxppc-dev, Ingo Molnar, Peter Zijlstra, Will Deacon, Paul Mundt

On Mon, Jul 04, 2011 at 07:02:23PM +0530, K.Prasad wrote:
> On Tue, May 24, 2011 at 11:52:25PM +0200, Frederic Weisbecker wrote:
> > The breakpoint support ability in an arch is not related
> > to the fact perf events is built or not. HAVE_HW_BREAKPOINT
> > only shows an ability so this dependency makes no sense
> > anymore. Archs that select HAVE_HW_BREAKPOINT already
> > ensure that perf event is built.
> > 
> > Remove that dependency.
> > 
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Cc: Prasad <prasad@linux.vnet.ibm.com>
> > Cc: Paul Mundt <lethal@linux-sh.org>
> > ---
> >  arch/Kconfig |    1 -
> >  1 files changed, 0 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/Kconfig b/arch/Kconfig
> > index f78c2be..ce4be89 100644
> > --- a/arch/Kconfig
> > +++ b/arch/Kconfig
> > @@ -149,7 +149,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
> > 
> >  config HAVE_HW_BREAKPOINT
> >  	bool
> > -	depends on PERF_EVENTS
> > 
> >  config HAVE_MIXED_BREAKPOINTS_REGS
> >  	bool
> > -- 
> 
> Just a thought you might want to consider...
> 
> The need to keep the ability (HAVE_HW_BREAKPOINT) and the user-choice to
> enable hardware breakpoints (through HW_BREAKPOINT) in separate config
> options isn't very clear to me (and is a bit confusing with very similar
> names).
> 
> Why not make HAVE_HW_BREAKPOINT selectable by the user (which in turn
> would turn on PERF_EVENTS) for a given architecture?

But then how kconfig knows if the allows that? You need to know if the
arch has the ability to support breakpoints.

This is a commin pattern in Linux Kconfig. Things are often seperated between
ability (some constant value provided by the arch) and the user choice that
depends on that ability.
The advantage of doing this is that you can centralize the generic dependencies,
help menu, etc... into a single place.
 
> Thanks,
> K.Prasad
> 

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

* Re: [PATCH 4/6] hw_breakpoints: Breakpoints arch ability don't need perf events
@ 2011-07-04 13:37       ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-07-04 13:37 UTC (permalink / raw)
  To: K.Prasad
  Cc: Peter Zijlstra, Will Deacon, LKML, Paul Mundt, Ingo Molnar, linuxppc-dev

On Mon, Jul 04, 2011 at 07:02:23PM +0530, K.Prasad wrote:
> On Tue, May 24, 2011 at 11:52:25PM +0200, Frederic Weisbecker wrote:
> > The breakpoint support ability in an arch is not related
> > to the fact perf events is built or not. HAVE_HW_BREAKPOINT
> > only shows an ability so this dependency makes no sense
> > anymore. Archs that select HAVE_HW_BREAKPOINT already
> > ensure that perf event is built.
> > 
> > Remove that dependency.
> > 
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > Cc: Will Deacon <will.deacon@arm.com>
> > Cc: Prasad <prasad@linux.vnet.ibm.com>
> > Cc: Paul Mundt <lethal@linux-sh.org>
> > ---
> >  arch/Kconfig |    1 -
> >  1 files changed, 0 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/Kconfig b/arch/Kconfig
> > index f78c2be..ce4be89 100644
> > --- a/arch/Kconfig
> > +++ b/arch/Kconfig
> > @@ -149,7 +149,6 @@ config HAVE_DEFAULT_NO_SPIN_MUTEXES
> > 
> >  config HAVE_HW_BREAKPOINT
> >  	bool
> > -	depends on PERF_EVENTS
> > 
> >  config HAVE_MIXED_BREAKPOINTS_REGS
> >  	bool
> > -- 
> 
> Just a thought you might want to consider...
> 
> The need to keep the ability (HAVE_HW_BREAKPOINT) and the user-choice to
> enable hardware breakpoints (through HW_BREAKPOINT) in separate config
> options isn't very clear to me (and is a bit confusing with very similar
> names).
> 
> Why not make HAVE_HW_BREAKPOINT selectable by the user (which in turn
> would turn on PERF_EVENTS) for a given architecture?

But then how kconfig knows if the allows that? You need to know if the
arch has the ability to support breakpoints.

This is a commin pattern in Linux Kconfig. Things are often seperated between
ability (some constant value provided by the arch) and the user choice that
depends on that ability.
The advantage of doing this is that you can centralize the generic dependencies,
help menu, etc... into a single place.
 
> Thanks,
> K.Prasad
> 

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

* Re: [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
  2011-07-04 13:29       ` Frederic Weisbecker
  (?)
@ 2011-07-04 17:44       ` K.Prasad
  2011-07-05 13:49         ` Frederic Weisbecker
  -1 siblings, 1 reply; 26+ messages in thread
From: K.Prasad @ 2011-07-04 17:44 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Ingo Molnar, Paul Mundt, linuxppc-dev, LKML, Peter Zijlstra

On Mon, Jul 04, 2011 at 03:29:14PM +0200, Frederic Weisbecker wrote:
> On Mon, Jul 04, 2011 at 06:57:46PM +0530, K.Prasad wrote:
> > On Tue, May 24, 2011 at 11:52:23PM +0200, Frederic Weisbecker wrote:
> > > Migrate conditional hw_breakpoint code compilation under
> > > the new config to prepare for letting the user chose whether
> > > or not to build this feature
> > > 
> > 
> > Making the hardware breakpoint patches modular has always been a goal.
> > I've looked at the PowerPC parts of the code and they look harmless.
> > 
> > Acked-by: K.Prasad <prasad@linux.vnet.ibm.com>
> 
> Great!
> 
> I'll push that soon, thanks guys for your acks!

Meanwhile, I was testing hardware breakpoints through perf and found
that monitoring a given address fails when using 'perf record' (returns
-ENOSPC) while 'perf stat' and watchpoint through gdb works fine (see
logs below).

Has this behaviour been reported for other perf counters?

Thanks,
K.Prasad

# tools/perf/perf --version
perf version 3.0.0-rc5
# 
# grep pid_max /proc/kallsyms 
ffffffff81a25010 D pid_max
ffffffff81a25014 D pid_max_min
ffffffff81a25018 D pid_max_max
# 
# uname -a
Linux llm37.in.ibm.com 3.0.0-rc5 #1 SMP Mon Jul 4 22:24:02 IST 2011
x86_64 x86_64 x86_64 GNU/Linux
# 
# tools/perf/perf stat -e mem:0xffffffff81a25010:rw make kernel/futex.o
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
make[1]: `kernel/futex.o' is up to date.

 Performance counter stats for 'make kernel/futex.o':

               188 mem:0xffffffff81a25010:rw                                   

      10.734957333 seconds time elapsed

# tools/perf/perf record -e
mem:0xffffffff81a25010:rw make kernel/futex.o

  Error: sys_perf_event_open() syscall returned with 28 (No space left
on device).  /bin/dmesg may provide additional information.

  Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?


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

* Re: [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config
  2011-07-04 17:44       ` K.Prasad
@ 2011-07-05 13:49         ` Frederic Weisbecker
  0 siblings, 0 replies; 26+ messages in thread
From: Frederic Weisbecker @ 2011-07-05 13:49 UTC (permalink / raw)
  To: K.Prasad; +Cc: Ingo Molnar, Paul Mundt, linuxppc-dev, LKML, Peter Zijlstra

On Mon, Jul 04, 2011 at 11:14:16PM +0530, K.Prasad wrote:
> On Mon, Jul 04, 2011 at 03:29:14PM +0200, Frederic Weisbecker wrote:
> > On Mon, Jul 04, 2011 at 06:57:46PM +0530, K.Prasad wrote:
> > > On Tue, May 24, 2011 at 11:52:23PM +0200, Frederic Weisbecker wrote:
> > > > Migrate conditional hw_breakpoint code compilation under
> > > > the new config to prepare for letting the user chose whether
> > > > or not to build this feature
> > > > 
> > > 
> > > Making the hardware breakpoint patches modular has always been a goal.
> > > I've looked at the PowerPC parts of the code and they look harmless.
> > > 
> > > Acked-by: K.Prasad <prasad@linux.vnet.ibm.com>
> > 
> > Great!
> > 
> > I'll push that soon, thanks guys for your acks!
> 
> Meanwhile, I was testing hardware breakpoints through perf and found
> that monitoring a given address fails when using 'perf record' (returns
> -ENOSPC) while 'perf stat' and watchpoint through gdb works fine (see
> logs below).
> 
> Has this behaviour been reported for other perf counters?

Nope I haven't anything like that. What I reported privately to you a
few ago was actually due to a mistake of mine. Otherwise I haven't seen
other problems.

-ENOSPC is likely related to the breakpoint slot reservation, in kernel/events/hw_breakpoint.c

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

end of thread, other threads:[~2011-07-05 13:49 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 21:52 [PATCH v2] hw_breakpoint: Let the user choose not to build it (and perf too) Frederic Weisbecker
2011-05-24 21:52 ` Frederic Weisbecker
2011-05-24 21:52 ` [PATCH 1/6] hw_breakpoints: Split hardware breakpoints config Frederic Weisbecker
2011-05-24 21:52   ` Frederic Weisbecker
2011-05-24 21:52 ` [PATCH 2/6] hw_breakpoints: Migrate breakpoint conditional build under new config Frederic Weisbecker
2011-05-24 21:52   ` Frederic Weisbecker
2011-07-04 13:27   ` K.Prasad
2011-07-04 13:27     ` K.Prasad
2011-07-04 13:29     ` Frederic Weisbecker
2011-07-04 13:29       ` Frederic Weisbecker
2011-07-04 17:44       ` K.Prasad
2011-07-05 13:49         ` Frederic Weisbecker
2011-05-24 21:52 ` [PATCH 3/6] x86: Allow the user not to build hw_breakpoints Frederic Weisbecker
2011-05-24 21:52   ` Frederic Weisbecker
2011-05-24 21:52 ` [PATCH 4/6] hw_breakpoints: Breakpoints arch ability don't need perf events Frederic Weisbecker
2011-05-24 21:52   ` Frederic Weisbecker
2011-07-04 13:32   ` K.Prasad
2011-07-04 13:32     ` K.Prasad
2011-07-04 13:37     ` Frederic Weisbecker
2011-07-04 13:37       ` Frederic Weisbecker
2011-05-24 21:52 ` [PATCH 5/6] hw_breakpoints: Only force perf events if breakpoints are selected Frederic Weisbecker
2011-05-24 21:52   ` Frederic Weisbecker
2011-05-24 21:52 ` [PATCH 6/6] hw_breakpoints: Drop remaining misplaced dependency on perf Frederic Weisbecker
2011-05-24 21:52   ` Frederic Weisbecker
2011-05-25  2:27 ` [PATCH v2] hw_breakpoint: Let the user choose not to build it (and perf too) Paul Mundt
2011-05-25  2:27   ` Paul Mundt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.