Skip to contentSkip to conversation

SPARC perf events fixes

GIT PULL Ingo Molnar 1 participant 1 message Oct 8, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Linus,

Please consider pulling the sparc-perf-events-fixes-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git sparc-perf-events-fixes-for-linus

( Note: this is on top of the perf-fixes-for-linus-2 pull request i just
sent. )

This tree contains two fixes for SPARC support that originate from before the merge window but got delayed due to being reworked.

They fix perf events sampling buffers to not corrupt memory on Sparc. We are providing the vmalloc based facility on x86 too - under a non-default debug .config option, to ease testing.

The MM bits were in -mm and Andrew originally queued them for .32 and it got rerouted to this topic branch to keep it together with Dave's fix patch.

I kept them in a separate branch because they are a bit large (mostly mechanic to the !vmalloc case but still large), and because they touch the MM.

Thanks,

Ingo

------------------>
David Miller (1):
mm, perf_event: Make vmalloc_user() align base kernel virtual address to SHMLBA

Peter Zijlstra (1):
perf_event: Provide vmalloc() based mmap() backing

 arch/sparc/Kconfig         |    2 +
 include/linux/perf_event.h |    5 +
 init/Kconfig               |   18 +++
 kernel/perf_event.c        |  248 +++++++++++++++++++++++++++++++++-----------
 mm/vmalloc.c               |   48 +++++----
 tools/perf/design.txt      |    3 +
 6 files changed, 240 insertions(+), 84 deletions(-)
arch/sparc/Kconfig +2 -0
index 97fca46..9b70a2f 100644
@@ -26,6 +26,7 @@ config SPARC
 	select RTC_CLASS
 	select RTC_DRV_M48T59
 	select HAVE_PERF_EVENTS
+	select PERF_USE_VMALLOC
 	select HAVE_DMA_ATTRS
 	select HAVE_DMA_API_DEBUG
 
@@ -48,6 +49,7 @@ config SPARC64
 	select RTC_DRV_SUN4V
 	select RTC_DRV_STARFIRE
 	select HAVE_PERF_EVENTS
+	select PERF_USE_VMALLOC
 
 config ARCH_DEFCONFIG
 	string
include/linux/perf_event.h +5 -0
index 3a9d36d..2e6d95f 100644
@@ -442,6 +442,7 @@ enum perf_callchain_context {
 #include <linux/hrtimer.h>
 #include <linux/fs.h>
 #include <linux/pid_namespace.h>
+#include <linux/workqueue.h>
 #include <asm/atomic.h>
 
 #define PERF_MAX_STACK_DEPTH		255
@@ -513,6 +514,10 @@ struct file;
 
 struct perf_mmap_data {
 	struct rcu_head			rcu_head;
+#ifdef CONFIG_PERF_USE_VMALLOC
+	struct work_struct		work;
+#endif
+	int				data_order;
 	int				nr_pages;	/* nr of data pages  */
 	int				writable;	/* are we writable   */
 	int				nr_locked;	/* nr pages mlocked  */
init/Kconfig +18 -0
index c7bac39..09c5c64 100644
@@ -921,6 +921,11 @@ config HAVE_PERF_EVENTS
 	help
 	  See tools/perf/design.txt for details.
 
+config PERF_USE_VMALLOC
+	bool
+	help
+	  See tools/perf/design.txt for details
+
 menu "Kernel Performance Events And Counters"
 
 config PERF_EVENTS
@@ -976,6 +981,19 @@ config PERF_COUNTERS
 
 	  Say N if unsure.
 
+config DEBUG_PERF_USE_VMALLOC
+	default n
+	bool "Debug: use vmalloc to back perf mmap() buffers"
+	depends on PERF_EVENTS && DEBUG_KERNEL
+	select PERF_USE_VMALLOC
+	help
+	 Use vmalloc memory to back perf mmap() buffers.
+
+	 Mostly useful for debugging the vmalloc code on platforms
+	 that don't require it.
+
+	 Say N if unsure.
+
 endmenu
 
 config VM_EVENT_COUNTERS
kernel/perf_event.c +186 -62

348 lines not on this page · raw message

mm/vmalloc.c +26 -22

165 lines not on this page · raw message

tools/perf/design.txt +3 -0
index f1946d1..fdd42a8 100644
@@ -455,3 +455,6 @@ will need at least this:
 
 If your architecture does have hardware capabilities, you can override the
 weak stub hw_perf_event_init() to register hardware counters.
+
+Architectures that have d-cache aliassing issues, such as Sparc and ARM,
+should select PERF_USE_VMALLOC in order to avoid these for perf mmap().