Skip to contentSkip to conversation

trace: add the MMIO-tracer to the tracer menu

PATCH Applied Peter Zijlstra 4 participants 6 messages Oct 24, 2008 – Oct 27, 2008

Subsystems (3)
lore
Share & tools
lore

Peter Zijlstra

author maintainer
#0 lore raw

PATCH 1/1 trace: add the MMIO-tracer to the tracer menu

Subject: trace: add the MMIO-tracer to the tracer menu
From: Peter Zijlstra <[email protected]>
Date: Fri Oct 24 12:46:04 CEST 2008

Add the MMIO-tracer to the tracer menu.

---
 arch/x86/Kconfig.debug |   28 ++--------------------------
 kernel/trace/Kconfig   |   28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 26 deletions(-)
arch/x86/Kconfig.debug +2 -26
Index: linux-2.6/arch/x86/Kconfig.debug
===================================================================
@@ -175,32 +175,8 @@ config IOMMU_LEAK
 	  Add a simple leak tracer to the IOMMU code. This is useful when you
 	  are debugging a buggy device driver that leaks IOMMU mappings.
 
-config MMIOTRACE_HOOKS
-	bool
-
-config MMIOTRACE
-	bool "Memory mapped IO tracing"
-	depends on DEBUG_KERNEL && PCI
-	select TRACING
-	select MMIOTRACE_HOOKS
-	help
-	  Mmiotrace traces Memory Mapped I/O access and is meant for
-	  debugging and reverse engineering. It is called from the ioremap
-	  implementation and works via page faults. Tracing is disabled by
-	  default and can be enabled at run-time.
-
-	  See Documentation/tracers/mmiotrace.txt.
-	  If you are not helping to develop drivers, say N.
-
-config MMIOTRACE_TEST
-	tristate "Test module for mmiotrace"
-	depends on MMIOTRACE && m
-	help
-	  This is a dumb module for testing mmiotrace. It is very dangerous
-	  as it will write garbage to IO memory starting at a given address.
-	  However, it should be safe to use on e.g. unused portion of VRAM.
-
-	  Say N, unless you absolutely know what you are doing.
+config HAVE_MMIOTRACE_SUPPORT
+	def_bool y
 
 #
 # IO delay types:
kernel/trace/Kconfig +28 -0
Index: linux-2.6/kernel/trace/Kconfig
===================================================================
@@ -194,4 +194,32 @@ config FTRACE_STARTUP_TEST
 	  functioning properly. It will do tests on all the configured
 	  tracers of ftrace.
 
+config MMIOTRACE_HOOKS
+	bool
+
+config MMIOTRACE
+	bool "Memory mapped IO tracing"
+	depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+	select TRACING
+	select MMIOTRACE_HOOKS
+	help
+	  Mmiotrace traces Memory Mapped I/O access and is meant for
+	  debugging and reverse engineering. It is called from the ioremap
+	  implementation and works via page faults. Tracing is disabled by
+	  default and can be enabled at run-time.
+
+	  See Documentation/tracers/mmiotrace.txt.
+	  If you are not helping to develop drivers, say N.
+
+config MMIOTRACE_TEST
+	tristate "Test module for mmiotrace"
+	depends on MMIOTRACE && m
+	help
+	  This is a dumb module for testing mmiotrace. It is very dangerous
+	  as it will write garbage to IO memory starting at a given address.
+	  However, it should be safe to use on e.g. unused portion of VRAM.
+
+	  Say N, unless you absolutely know what you are doing.
+
+
 endmenu
#1 lore raw
Quoted 58 lines · Peter Zijlstra

Subject: trace: add the MMIO-tracer to the tracer menu
From: Peter Zijlstra <[email protected]>
Date: Fri Oct 24 12:46:04 CEST 2008

Add the MMIO-tracer to the tracer menu.

---
 arch/x86/Kconfig.debug |   28 ++--------------------------
 kernel/trace/Kconfig   |   28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 26 deletions(-)

Index: linux-2.6/arch/x86/Kconfig.debug
===================================================================

arch/x86/Kconfig.debug +2 -26
@@ -175,32 +175,8 @@ config IOMMU_LEAK
 	  Add a simple leak tracer to the IOMMU code. This is useful when you
 	  are debugging a buggy device driver that leaks IOMMU mappings.
 
-config MMIOTRACE_HOOKS
-	bool
-
-config MMIOTRACE
-	bool "Memory mapped IO tracing"
-	depends on DEBUG_KERNEL && PCI
-	select TRACING
-	select MMIOTRACE_HOOKS
-	help
-	  Mmiotrace traces Memory Mapped I/O access and is meant for
-	  debugging and reverse engineering. It is called from the ioremap
-	  implementation and works via page faults. Tracing is disabled by
-	  default and can be enabled at run-time.
-
-	  See Documentation/tracers/mmiotrace.txt.
-	  If you are not helping to develop drivers, say N.
-
-config MMIOTRACE_TEST
-	tristate "Test module for mmiotrace"
-	depends on MMIOTRACE && m
-	help
-	  This is a dumb module for testing mmiotrace. It is very dangerous
-	  as it will write garbage to IO memory starting at a given address.
-	  However, it should be safe to use on e.g. unused portion of VRAM.
-
-	  Say N, unless you absolutely know what you are doing.
+config HAVE_MMIOTRACE_SUPPORT
+	def_bool y
 
 #
 # IO delay types:

Index: linux-2.6/kernel/trace/Kconfig
===================================================================

kernel/trace/Kconfig +0 -0
@@ -194,4 +194,32 @@ config FTRACE_STARTUP_TEST
 	  functioning properly. It will do tests on all the configured

kernel/trace/Kconfig config FTRACE_STARTUP_TEST · line 204

Quoted 10 lines
kernel/trace/Kconfig +8 -0
 	  tracers of ftrace.
 
+config MMIOTRACE_HOOKS
+	bool
+
+config MMIOTRACE
+	bool "Memory mapped IO tracing"
+	depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+	select TRACING
+	select MMIOTRACE_HOOKS

change makes sense, but isnt MMIOTRACE_HOOKS basically overlapping HAVE_MMIOTRACE_SUPPORT? So i think we could get rid of MMIOTRACE_HOOKS altogether and just use HAVE_MMIOTRACE_SUPPORT.

Pekka?

Ingo

maintainer
#2 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 10 lines

#
# IO delay types:
Index: linux-2.6/kernel/trace/Kconfig
===================================================================

kernel/trace/Kconfig +0 -0
@@ -194,4 +194,32 @@ config FTRACE_STARTUP_TEST
 	  functioning properly. It will do tests on all the configured
 	  tracers of ftrace.
 
Quoted 12 lines

kernel/trace/Kconfig config FTRACE_STARTUP_TEST · line 204

Quoted 8 lines
kernel/trace/Kconfig +8 -0
+config MMIOTRACE_HOOKS
+	bool
+
+config MMIOTRACE
+	bool "Memory mapped IO tracing"
+	depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+	select TRACING
+	select MMIOTRACE_HOOKS

change makes sense, but isnt MMIOTRACE_HOOKS basically overlapping HAVE_MMIOTRACE_SUPPORT? So i think we could get rid of MMIOTRACE_HOOKS altogether and just use HAVE_MMIOTRACE_SUPPORT.

And doing this will remove the need about my question on depends on X86.

-- Steve

#3 lore raw
Quoted 25 lines · On Fri, 24 Oct 2008 07:56:05 -0400 (EDT) Steven Rostedt <[email protected]>…
Quoted 10 lines · Ingo Molnar
Quoted 10 lines

#
# IO delay types:
Index: linux-2.6/kernel/trace/Kconfig
===================================================================

kernel/trace/Kconfig +0 -0
@@ -194,4 +194,32 @@ config FTRACE_STARTUP_TEST
 	  functioning properly. It will do tests on all the configured
 	  tracers of ftrace.
 
Quoted 12 lines

kernel/trace/Kconfig config FTRACE_STARTUP_TEST · line 204

Quoted 8 lines
kernel/trace/Kconfig +8 -0
+config MMIOTRACE_HOOKS
+	bool
+
+config MMIOTRACE
+	bool "Memory mapped IO tracing"
+	depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+	select TRACING
+	select MMIOTRACE_HOOKS

change makes sense, but isnt MMIOTRACE_HOOKS basically overlapping HAVE_MMIOTRACE_SUPPORT? So i think we could get rid of MMIOTRACE_HOOKS altogether and just use HAVE_MMIOTRACE_SUPPORT.

Quoted 1 line

And doing this will remove the need about my question on depends on X86.

Yes, we can remove MMIOTRACE_HOOKS and replace it with just MMIOTRACE. MMIOTRACE_HOOKS is a remnant from the time when I thought that something else could also use the kmmio facilities.

Here's a compile-tested patch against current Ingo's tip/master.

Quoted 1 line

From d4b97cd777c3382b784a9504281feccc9f2c4036 Mon Sep 17 00:00:00 2001

From: Pekka Paalanen <[email protected]>
Date: Fri, 24 Oct 2008 18:59:56 +0300
Subject: [PATCH] mmiotrace: Remove unneeded CONFIG_MMIOTRACE_HOOKS.

---
 arch/x86/Kconfig.debug |    4 ----
 arch/x86/mm/Makefile   |    3 +--
 arch/x86/mm/fault.c    |    2 +-
 3 files changed, 2 insertions(+), 7 deletions(-)
arch/x86/Kconfig.debug +0 -4
index fc58b86..01649e1 100644
@@ -175,14 +175,10 @@ config IOMMU_LEAK
 	  Add a simple leak tracer to the IOMMU code. This is useful when you
 	  are debugging a buggy device driver that leaks IOMMU mappings.
 
-config MMIOTRACE_HOOKS
-	bool
-
 config MMIOTRACE
 	bool "Memory mapped IO tracing"
 	depends on DEBUG_KERNEL && PCI
 	select TRACING
-	select MMIOTRACE_HOOKS
 	help
 	  Mmiotrace traces Memory Mapped I/O access and is meant for
 	  debugging and reverse engineering. It is called from the ioremap
arch/x86/mm/Makefile +1 -2
index f4edb6e..617537f 100644
@@ -10,9 +10,8 @@ obj-$(CONFIG_HIGHMEM)		+= highmem_32.o
 
 obj-$(CONFIG_KMEMCHECK)		+= kmemcheck/
 
-obj-$(CONFIG_MMIOTRACE_HOOKS)	+= kmmio.o
 obj-$(CONFIG_MMIOTRACE)		+= mmiotrace.o
-mmiotrace-y			:= pf_in.o mmio-mod.o
+mmiotrace-y			:= kmmio.o pf_in.o mmio-mod.o
 obj-$(CONFIG_MMIOTRACE_TEST)	+= testmmiotrace.o
 
 obj-$(CONFIG_NUMA)		+= numa_$(BITS).o
arch/x86/mm/fault.c +1 -1
index ed9ee30..63e9f7c 100644
@@ -55,7 +55,7 @@
 
 static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr)
 {
-#ifdef CONFIG_MMIOTRACE_HOOKS
+#ifdef CONFIG_MMIOTRACE
 	if (unlikely(is_kmmio_active()))
 		if (kmmio_handler(regs, addr) == 1)
 			return -1;
Signature · 1 line
1.5.6.4
Applied
#4 lore raw
Quoted 14 lines · Pekka Paalanen
Quoted 2 lines

And doing this will remove the need about my question on depends on X86.

Yes, we can remove MMIOTRACE_HOOKS and replace it with just MMIOTRACE. MMIOTRACE_HOOKS is a remnant from the time when I thought that something else could also use the kmmio facilities.

Here's a compile-tested patch against current Ingo's tip/master.

From d4b97cd777c3382b784a9504281feccc9f2c4036 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <[email protected]>
Date: Fri, 24 Oct 2008 18:59:56 +0300
Subject: [PATCH] mmiotrace: Remove unneeded CONFIG_MMIOTRACE_HOOKS.

Quoted 6 lines
---
 arch/x86/Kconfig.debug |    4 ----
 arch/x86/mm/Makefile   |    3 +--
 arch/x86/mm/fault.c    |    2 +-
 3 files changed, 2 insertions(+), 7 deletions(-)

applied, thanks Pekka!

Ingo

maintainer
#5 lore raw
In reply to Peter Zijlstra
Quoted 57 lines · Peter Zijlstra

Subject: trace: add the MMIO-tracer to the tracer menu
From: Peter Zijlstra <[email protected]>
Date: Fri Oct 24 12:46:04 CEST 2008

Add the MMIO-tracer to the tracer menu.

---
 arch/x86/Kconfig.debug |   28 ++--------------------------
 kernel/trace/Kconfig   |   28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 26 deletions(-)

Index: linux-2.6/arch/x86/Kconfig.debug
===================================================================

arch/x86/Kconfig.debug +2 -26
@@ -175,32 +175,8 @@ config IOMMU_LEAK
 	  Add a simple leak tracer to the IOMMU code. This is useful when you
 	  are debugging a buggy device driver that leaks IOMMU mappings.
 
-config MMIOTRACE_HOOKS
-	bool
-
-config MMIOTRACE
-	bool "Memory mapped IO tracing"
-	depends on DEBUG_KERNEL && PCI
-	select TRACING
-	select MMIOTRACE_HOOKS
-	help
-	  Mmiotrace traces Memory Mapped I/O access and is meant for
-	  debugging and reverse engineering. It is called from the ioremap
-	  implementation and works via page faults. Tracing is disabled by
-	  default and can be enabled at run-time.
-
-	  See Documentation/tracers/mmiotrace.txt.
-	  If you are not helping to develop drivers, say N.
-
-config MMIOTRACE_TEST
-	tristate "Test module for mmiotrace"
-	depends on MMIOTRACE && m
-	help
-	  This is a dumb module for testing mmiotrace. It is very dangerous
-	  as it will write garbage to IO memory starting at a given address.
-	  However, it should be safe to use on e.g. unused portion of VRAM.
-
-	  Say N, unless you absolutely know what you are doing.
+config HAVE_MMIOTRACE_SUPPORT
+	def_bool y
 
 #
 # IO delay types:

Index: linux-2.6/kernel/trace/Kconfig
===================================================================

kernel/trace/Kconfig config FTRACE_STARTUP_TEST · line 203

Quoted 10 lines
kernel/trace/Kconfig +7 -0
@@ -194,4 +194,32 @@ config FTRACE_STARTUP_TEST
 	  functioning properly. It will do tests on all the configured
 	  tracers of ftrace.
 
+config MMIOTRACE_HOOKS
+	bool
+
+config MMIOTRACE
+	bool "Memory mapped IO tracing"
+	depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+	select TRACING

Since this was taken from the x86 Kconfig, do we need to add a "depends X86" ?

-- Steve

Quoted 25 lines
kernel/trace/Kconfig +21 -0
+	select MMIOTRACE_HOOKS
+	help
+	  Mmiotrace traces Memory Mapped I/O access and is meant for
+	  debugging and reverse engineering. It is called from the ioremap
+	  implementation and works via page faults. Tracing is disabled by
+	  default and can be enabled at run-time.
+
+	  See Documentation/tracers/mmiotrace.txt.
+	  If you are not helping to develop drivers, say N.
+
+config MMIOTRACE_TEST
+	tristate "Test module for mmiotrace"
+	depends on MMIOTRACE && m
+	help
+	  This is a dumb module for testing mmiotrace. It is very dangerous
+	  as it will write garbage to IO memory starting at a given address.
+	  However, it should be safe to use on e.g. unused portion of VRAM.
+
+	  Say N, unless you absolutely know what you are doing.
+
+
 endmenu