* [PATCH 1/3] doc: update mmiotrace.txt
@ 2009-01-08 20:32 Pekka Paalanen
2009-01-08 20:35 ` [PATCH 2/3] trace: move the MMIO-tracer to the tracer menu Pekka Paalanen
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Pekka Paalanen @ 2009-01-08 20:32 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Peter Zijlstra, linux-kernel, Steven Rostedt, pq
>From 32fe58c5a4a162e9d6ab4aca91692e0e28167f97 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Sat, 3 Jan 2009 21:09:27 +0200
Subject: [PATCH] doc: update mmiotrace.txt
The tracing framework buffer size file in debugfs has changed.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
Ingo, I'm hoping these three patches would make it into .29.
Thanks.
Documentation/tracers/mmiotrace.txt | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/Documentation/tracers/mmiotrace.txt b/Documentation/tracers/mmiotrace.txt
index cde23b4..5731c67 100644
--- a/Documentation/tracers/mmiotrace.txt
+++ b/Documentation/tracers/mmiotrace.txt
@@ -78,12 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If
events were lost, the trace is incomplete. You should enlarge the buffers and
try again. Buffers are enlarged by first seeing how large the current buffers
are:
-$ cat /debug/tracing/trace_entries
+$ cat /debug/tracing/buffer_size_kb
gives you a number. Approximately double this number and write it back, for
instance:
-$ echo 0 > /debug/tracing/tracing_enabled
-$ echo 128000 > /debug/tracing/trace_entries
-$ echo 1 > /debug/tracing/tracing_enabled
+$ echo 128000 > /debug/tracing/buffer_size_kb
Then start again from the top.
If you are doing a trace for a driver project, e.g. Nouveau, you should also
--
1.6.0.6
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 2/3] trace: move the MMIO-tracer to the tracer menu
2009-01-08 20:32 [PATCH 1/3] doc: update mmiotrace.txt Pekka Paalanen
@ 2009-01-08 20:35 ` Pekka Paalanen
2009-01-08 20:37 ` [PATCH 3/3] mmiotrace: count events lost due to not recording Pekka Paalanen
2009-01-08 20:38 ` [PATCH 1/3] doc: update mmiotrace.txt Steven Rostedt
2 siblings, 0 replies; 10+ messages in thread
From: Pekka Paalanen @ 2009-01-08 20:35 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Pekka Paalanen, Peter Zijlstra, linux-kernel, Steven Rostedt
>From a9fefe5d5775939ae3bb76fad16510cfd89521f8 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Sat, 3 Jan 2009 21:23:51 +0200
Subject: [PATCH] trace: move the MMIO-tracer to the tracer menu
This patch was originally suggested by Peter Zijlstra, but seems it
was forgotten.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
arch/x86/Kconfig.debug | 24 ++----------------------
kernel/trace/Kconfig | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 01649e1..097d79a 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -175,28 +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
- bool "Memory mapped IO tracing"
- depends on DEBUG_KERNEL && PCI
- select TRACING
- 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:
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 1c0b750..9442392 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -323,4 +323,27 @@ config FTRACE_STARTUP_TEST
functioning properly. It will do tests on all the configured
tracers of ftrace.
+config MMIOTRACE
+ bool "Memory mapped IO tracing"
+ depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+ select TRACING
+ 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.6.0.6
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/3] mmiotrace: count events lost due to not recording
2009-01-08 20:32 [PATCH 1/3] doc: update mmiotrace.txt Pekka Paalanen
2009-01-08 20:35 ` [PATCH 2/3] trace: move the MMIO-tracer to the tracer menu Pekka Paalanen
@ 2009-01-08 20:37 ` Pekka Paalanen
2009-01-08 20:38 ` [PATCH 1/3] doc: update mmiotrace.txt Steven Rostedt
2 siblings, 0 replies; 10+ messages in thread
From: Pekka Paalanen @ 2009-01-08 20:37 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Pekka Paalanen, Peter Zijlstra, linux-kernel, Steven Rostedt
>From 8fbe1e5f24a2ffb173b900c0d54c771b1fa13446 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Tue, 6 Jan 2009 13:57:11 +0200
Subject: [PATCH] mmiotrace: count events lost due to not recording
The tracing framework, or the ring buffer facility it uses, has a switch
to stop recording data. When recording is off, the trace events will be
lost. The framework does not count these, so mmiotrace has to count them
itself.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
kernel/trace/trace_mmiotrace.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index fcec59f..621c8c3 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/mmiotrace.h>
#include <linux/pci.h>
+#include <asm/atomic.h>
#include "trace.h"
#include "trace_output.h"
@@ -20,6 +21,7 @@ struct header_iter {
static struct trace_array *mmio_trace_array;
static bool overrun_detected;
static unsigned long prev_overruns;
+static atomic_t dropped_count;
static void mmio_reset_data(struct trace_array *tr)
{
@@ -122,11 +124,11 @@ static void mmio_close(struct trace_iterator *iter)
static unsigned long count_overruns(struct trace_iterator *iter)
{
- unsigned long cnt = 0;
+ unsigned long cnt = atomic_xchg(&dropped_count, 0);
unsigned long over = ring_buffer_overruns(iter->tr->buffer);
if (over > prev_overruns)
- cnt = over - prev_overruns;
+ cnt += over - prev_overruns;
prev_overruns = over;
return cnt;
}
@@ -308,8 +310,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags);
- if (!event)
+ if (!event) {
+ atomic_inc(&dropped_count);
return;
+ }
entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_RW;
@@ -336,8 +340,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags);
- if (!event)
+ if (!event) {
+ atomic_inc(&dropped_count);
return;
+ }
entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_MAP;
--
1.6.0.6
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/3] doc: update mmiotrace.txt
2009-01-08 20:32 [PATCH 1/3] doc: update mmiotrace.txt Pekka Paalanen
2009-01-08 20:35 ` [PATCH 2/3] trace: move the MMIO-tracer to the tracer menu Pekka Paalanen
2009-01-08 20:37 ` [PATCH 3/3] mmiotrace: count events lost due to not recording Pekka Paalanen
@ 2009-01-08 20:38 ` Steven Rostedt
2009-01-08 22:13 ` [PATCH v2 1/3] doc: mmiotrace.txt, buffer size control change Pekka Paalanen
` (2 more replies)
2 siblings, 3 replies; 10+ messages in thread
From: Steven Rostedt @ 2009-01-08 20:38 UTC (permalink / raw)
To: Pekka Paalanen; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel
On Thu, 8 Jan 2009, Pekka Paalanen wrote:
> From 32fe58c5a4a162e9d6ab4aca91692e0e28167f97 Mon Sep 17 00:00:00 2001
> From: Pekka Paalanen <pq@iki.fi>
> Date: Sat, 3 Jan 2009 21:09:27 +0200
> Subject: [PATCH] doc: update mmiotrace.txt
>
> The tracing framework buffer size file in debugfs has changed.
>
> Signed-off-by: Pekka Paalanen <pq@iki.fi>
Pekka,
Can you resubmit these with a better change log on the first two, and an
Impact line on each.
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH v2 1/3] doc: mmiotrace.txt, buffer size control change
2009-01-08 20:38 ` [PATCH 1/3] doc: update mmiotrace.txt Steven Rostedt
@ 2009-01-08 22:13 ` Pekka Paalanen
2009-01-08 22:15 ` [PATCH v2 2/3] trace: mmiotrace to the tracer menu in Kconfig Pekka Paalanen
2009-01-08 22:17 ` [PATCH v2 3/3] mmiotrace: count events lost due to not recording Pekka Paalanen
2 siblings, 0 replies; 10+ messages in thread
From: Pekka Paalanen @ 2009-01-08 22:13 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel, pq
>From 297ddd1d79f7826bdd058b1bfd580dcaf97d3946 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Sat, 3 Jan 2009 21:09:27 +0200
Subject: [PATCH] doc: mmiotrace.txt, buffer size control change
Impact: prevents confusing the user when buffer size is inadequate
The tracing framework offers a resizeable buffer, which mmiotrace uses
to record events. If the buffer is full, the following events will be
lost. Events should not be lost, so the documentation instructs the user
to increase the buffer size. The buffer size is set via a debugfs file.
Mmiotrace documentation was not updated the same time the debugfs file
was changed. The old file was tracing/trace_entries and first contained
the number of entries the buffer had space for, per cpu. Nowadays this
file is replaced with the file tracing/buffer_size_kb, which tells the
amount of memory reserved for the buffer, per cpu, in kilobytes.
Previously, a flag had to be toggled via the debugfs file
tracing/tracing_enabled when the buffer size was changed. This is no
longer necessary.
The mmiotrace documentation is updated to reflect the current state of
the tracing framework.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
Documentation/tracers/mmiotrace.txt | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/Documentation/tracers/mmiotrace.txt b/Documentation/tracers/mmiotrace.txt
index cde23b4..5731c67 100644
--- a/Documentation/tracers/mmiotrace.txt
+++ b/Documentation/tracers/mmiotrace.txt
@@ -78,12 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If
events were lost, the trace is incomplete. You should enlarge the buffers and
try again. Buffers are enlarged by first seeing how large the current buffers
are:
-$ cat /debug/tracing/trace_entries
+$ cat /debug/tracing/buffer_size_kb
gives you a number. Approximately double this number and write it back, for
instance:
-$ echo 0 > /debug/tracing/tracing_enabled
-$ echo 128000 > /debug/tracing/trace_entries
-$ echo 1 > /debug/tracing/tracing_enabled
+$ echo 128000 > /debug/tracing/buffer_size_kb
Then start again from the top.
If you are doing a trace for a driver project, e.g. Nouveau, you should also
--
1.6.0.6
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/3] trace: mmiotrace to the tracer menu in Kconfig
2009-01-08 20:38 ` [PATCH 1/3] doc: update mmiotrace.txt Steven Rostedt
2009-01-08 22:13 ` [PATCH v2 1/3] doc: mmiotrace.txt, buffer size control change Pekka Paalanen
@ 2009-01-08 22:15 ` Pekka Paalanen
2009-01-08 22:17 ` [PATCH v2 3/3] mmiotrace: count events lost due to not recording Pekka Paalanen
2 siblings, 0 replies; 10+ messages in thread
From: Pekka Paalanen @ 2009-01-08 22:15 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel, pq
>From 9ce66da6670fd92e626d5adbcdabe81f2a79f2dc Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Sat, 3 Jan 2009 21:23:51 +0200
Subject: [PATCH] trace: mmiotrace to the tracer menu in Kconfig
Impact: cosmetic change in Kconfig menu layout
This patch was originally suggested by Peter Zijlstra, but seems it
was forgotten.
CONFIG_MMIOTRACE and CONFIG_MMIOTRACE_TEST were selectable
directly under the Kernel hacking / debugging menu in the kernel
configuration system. They were present only for x86 and x86_64.
Other tracers that use the ftrace tracing framework are in their own
sub-menu. This patch moves the mmiotrace configuration options there.
Since the Kconfig file, where the tracer menu is, is not architecture
specific, HAVE_MMIOTRACE_SUPPORT is introduced and provided only by
x86/x86_64. CONFIG_MMIOTRACE now depends on it.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
arch/x86/Kconfig.debug | 24 ++----------------------
kernel/trace/Kconfig | 23 +++++++++++++++++++++++
2 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 01649e1..097d79a 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -175,28 +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
- bool "Memory mapped IO tracing"
- depends on DEBUG_KERNEL && PCI
- select TRACING
- 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:
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 1c0b750..9442392 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -323,4 +323,27 @@ config FTRACE_STARTUP_TEST
functioning properly. It will do tests on all the configured
tracers of ftrace.
+config MMIOTRACE
+ bool "Memory mapped IO tracing"
+ depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+ select TRACING
+ 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.6.0.6
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 3/3] mmiotrace: count events lost due to not recording
2009-01-08 20:38 ` [PATCH 1/3] doc: update mmiotrace.txt Steven Rostedt
2009-01-08 22:13 ` [PATCH v2 1/3] doc: mmiotrace.txt, buffer size control change Pekka Paalanen
2009-01-08 22:15 ` [PATCH v2 2/3] trace: mmiotrace to the tracer menu in Kconfig Pekka Paalanen
@ 2009-01-08 22:17 ` Pekka Paalanen
2 siblings, 0 replies; 10+ messages in thread
From: Pekka Paalanen @ 2009-01-08 22:17 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Ingo Molnar, Peter Zijlstra, linux-kernel, pq
>From 7b1371189e38609f74c68a7b83c0a7a038a9b712 Mon Sep 17 00:00:00 2001
From: Pekka Paalanen <pq@iki.fi>
Date: Tue, 6 Jan 2009 13:57:11 +0200
Subject: [PATCH] mmiotrace: count events lost due to not recording
Impact: enhances lost events counting in mmiotrace
The tracing framework, or the ring buffer facility it uses, has a switch
to stop recording data. When recording is off, the trace events will be
lost. The framework does not count these, so mmiotrace has to count them
itself.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
---
kernel/trace/trace_mmiotrace.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index fcec59f..621c8c3 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/mmiotrace.h>
#include <linux/pci.h>
+#include <asm/atomic.h>
#include "trace.h"
#include "trace_output.h"
@@ -20,6 +21,7 @@ struct header_iter {
static struct trace_array *mmio_trace_array;
static bool overrun_detected;
static unsigned long prev_overruns;
+static atomic_t dropped_count;
static void mmio_reset_data(struct trace_array *tr)
{
@@ -122,11 +124,11 @@ static void mmio_close(struct trace_iterator *iter)
static unsigned long count_overruns(struct trace_iterator *iter)
{
- unsigned long cnt = 0;
+ unsigned long cnt = atomic_xchg(&dropped_count, 0);
unsigned long over = ring_buffer_overruns(iter->tr->buffer);
if (over > prev_overruns)
- cnt = over - prev_overruns;
+ cnt += over - prev_overruns;
prev_overruns = over;
return cnt;
}
@@ -308,8 +310,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags);
- if (!event)
+ if (!event) {
+ atomic_inc(&dropped_count);
return;
+ }
entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_RW;
@@ -336,8 +340,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags);
- if (!event)
+ if (!event) {
+ atomic_inc(&dropped_count);
return;
+ }
entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_MAP;
--
1.6.0.6
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 0/3] ftrace: updates for 2.6.29
@ 2009-01-09 0:27 Steven Rostedt
2009-01-09 0:27 ` [PATCH 3/3] mmiotrace: count events lost due to not recording Steven Rostedt
0 siblings, 1 reply; 10+ messages in thread
From: Steven Rostedt @ 2009-01-09 0:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Pekka Paalanen
Ingo,
The following patches are in:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
branch: tip/devel
Pekka Paalanen (3):
doc: mmiotrace.txt, buffer size control change
trace: mmiotrace to the tracer menu in Kconfig
mmiotrace: count events lost due to not recording
----
Documentation/tracers/mmiotrace.txt | 6 ++----
arch/x86/Kconfig.debug | 24 ++----------------------
kernel/trace/Kconfig | 23 +++++++++++++++++++++++
kernel/trace/trace_mmiotrace.c | 14 ++++++++++----
4 files changed, 37 insertions(+), 30 deletions(-)
--
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 3/3] mmiotrace: count events lost due to not recording
2009-01-09 0:27 [PATCH 0/3] ftrace: updates for 2.6.29 Steven Rostedt
@ 2009-01-09 0:27 ` Steven Rostedt
2009-01-09 1:10 ` Andrew Morton
0 siblings, 1 reply; 10+ messages in thread
From: Steven Rostedt @ 2009-01-09 0:27 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Pekka Paalanen, Steven Rostedt
[-- Attachment #1: 0003-mmiotrace-count-events-lost-due-to-not-recording.patch --]
[-- Type: text/plain, Size: 2320 bytes --]
From: Pekka Paalanen <pq@iki.fi>
Impact: enhances lost events counting in mmiotrace
The tracing framework, or the ring buffer facility it uses, has a switch
to stop recording data. When recording is off, the trace events will be
lost. The framework does not count these, so mmiotrace has to count them
itself.
Signed-off-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/trace_mmiotrace.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c
index fcec59f..621c8c3 100644
--- a/kernel/trace/trace_mmiotrace.c
+++ b/kernel/trace/trace_mmiotrace.c
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/mmiotrace.h>
#include <linux/pci.h>
+#include <asm/atomic.h>
#include "trace.h"
#include "trace_output.h"
@@ -20,6 +21,7 @@ struct header_iter {
static struct trace_array *mmio_trace_array;
static bool overrun_detected;
static unsigned long prev_overruns;
+static atomic_t dropped_count;
static void mmio_reset_data(struct trace_array *tr)
{
@@ -122,11 +124,11 @@ static void mmio_close(struct trace_iterator *iter)
static unsigned long count_overruns(struct trace_iterator *iter)
{
- unsigned long cnt = 0;
+ unsigned long cnt = atomic_xchg(&dropped_count, 0);
unsigned long over = ring_buffer_overruns(iter->tr->buffer);
if (over > prev_overruns)
- cnt = over - prev_overruns;
+ cnt += over - prev_overruns;
prev_overruns = over;
return cnt;
}
@@ -308,8 +310,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags);
- if (!event)
+ if (!event) {
+ atomic_inc(&dropped_count);
return;
+ }
entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_RW;
@@ -336,8 +340,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags);
- if (!event)
+ if (!event) {
+ atomic_inc(&dropped_count);
return;
+ }
entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_MAP;
--
1.5.6.5
--
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 3/3] mmiotrace: count events lost due to not recording
2009-01-09 0:27 ` [PATCH 3/3] mmiotrace: count events lost due to not recording Steven Rostedt
@ 2009-01-09 1:10 ` Andrew Morton
2009-01-09 1:56 ` Steven Rostedt
0 siblings, 1 reply; 10+ messages in thread
From: Andrew Morton @ 2009-01-09 1:10 UTC (permalink / raw)
To: Steven Rostedt; +Cc: linux-kernel, mingo, pq, srostedt
On Thu, 08 Jan 2009 19:27:50 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> +static atomic_t dropped_count;
Formally, this should be
static atomic_t dropped_count = ATOMIC_INIT(0);
but no atomic_t implementations need that, and I'm sure that if one
turns up wchih _does_ need it (say, it has a spinlock inside its
atomic_t) then the kernel would break all over the place.
So perhaps we should formally state that the all-zeroes pattern is an
acceptable way of initialising an atomic_t.
In which case these:
y:/usr/src/linux-2.6.28> grep -r "atomic_t.*=.*ATOMIC_INIT" . | wc -l
110
become cleanup fodder.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] mmiotrace: count events lost due to not recording
2009-01-09 1:10 ` Andrew Morton
@ 2009-01-09 1:56 ` Steven Rostedt
0 siblings, 0 replies; 10+ messages in thread
From: Steven Rostedt @ 2009-01-09 1:56 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, mingo, pq, srostedt
On Thu, 8 Jan 2009, Andrew Morton wrote:
>
> y:/usr/src/linux-2.6.28> grep -r "atomic_t.*=.*ATOMIC_INIT" . | wc -l
> 110
>
> become cleanup fodder.
[linus.git]$ git grep "atomic_t.*=.*ATOMIC_INIT([^0]" |wc -l
13
[linus.git]$ git grep "atomic_t.*=.*ATOMIC_INIT(0" |wc -l
104
[linus.git]$ git grep "atomic_t.*=.*ATOMIC_INIT" |wc -l
117
OK, in current linus.git we have 117 atomic_t using ATOMIC_INIT, where 13
actually need the init (non zero). But 104 need to be cleaned up ;-)
-- Steve
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-01-09 1:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-08 20:32 [PATCH 1/3] doc: update mmiotrace.txt Pekka Paalanen
2009-01-08 20:35 ` [PATCH 2/3] trace: move the MMIO-tracer to the tracer menu Pekka Paalanen
2009-01-08 20:37 ` [PATCH 3/3] mmiotrace: count events lost due to not recording Pekka Paalanen
2009-01-08 20:38 ` [PATCH 1/3] doc: update mmiotrace.txt Steven Rostedt
2009-01-08 22:13 ` [PATCH v2 1/3] doc: mmiotrace.txt, buffer size control change Pekka Paalanen
2009-01-08 22:15 ` [PATCH v2 2/3] trace: mmiotrace to the tracer menu in Kconfig Pekka Paalanen
2009-01-08 22:17 ` [PATCH v2 3/3] mmiotrace: count events lost due to not recording Pekka Paalanen
2009-01-09 0:27 [PATCH 0/3] ftrace: updates for 2.6.29 Steven Rostedt
2009-01-09 0:27 ` [PATCH 3/3] mmiotrace: count events lost due to not recording Steven Rostedt
2009-01-09 1:10 ` Andrew Morton
2009-01-09 1:56 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®