Commit f8effd1a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'tracing-fixes-for-linus' of...

Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  doc: mmiotrace.txt, buffer size control change
  trace: mmiotrace to the tracer menu in Kconfig
  mmiotrace: count events lost due to not recording
parents 35010334 f9aa28ad
...@@ -78,12 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If ...@@ -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 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 try again. Buffers are enlarged by first seeing how large the current buffers
are: 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 gives you a number. Approximately double this number and write it back, for
instance: instance:
$ echo 0 > /debug/tracing/tracing_enabled $ echo 128000 > /debug/tracing/buffer_size_kb
$ echo 128000 > /debug/tracing/trace_entries
$ echo 1 > /debug/tracing/tracing_enabled
Then start again from the top. Then start again from the top.
If you are doing a trace for a driver project, e.g. Nouveau, you should also If you are doing a trace for a driver project, e.g. Nouveau, you should also
......
...@@ -174,28 +174,8 @@ config IOMMU_LEAK ...@@ -174,28 +174,8 @@ config IOMMU_LEAK
Add a simple leak tracer to the IOMMU code. This is useful when you Add a simple leak tracer to the IOMMU code. This is useful when you
are debugging a buggy device driver that leaks IOMMU mappings. are debugging a buggy device driver that leaks IOMMU mappings.
config MMIOTRACE config HAVE_MMIOTRACE_SUPPORT
bool "Memory mapped IO tracing" def_bool y
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.
# #
# IO delay types: # IO delay types:
......
...@@ -302,4 +302,27 @@ config FTRACE_STARTUP_TEST ...@@ -302,4 +302,27 @@ config FTRACE_STARTUP_TEST
functioning properly. It will do tests on all the configured functioning properly. It will do tests on all the configured
tracers of ftrace. 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 endmenu
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mmiotrace.h> #include <linux/mmiotrace.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/atomic.h>
#include "trace.h" #include "trace.h"
...@@ -19,6 +20,7 @@ struct header_iter { ...@@ -19,6 +20,7 @@ struct header_iter {
static struct trace_array *mmio_trace_array; static struct trace_array *mmio_trace_array;
static bool overrun_detected; static bool overrun_detected;
static unsigned long prev_overruns; static unsigned long prev_overruns;
static atomic_t dropped_count;
static void mmio_reset_data(struct trace_array *tr) static void mmio_reset_data(struct trace_array *tr)
{ {
...@@ -121,11 +123,11 @@ static void mmio_close(struct trace_iterator *iter) ...@@ -121,11 +123,11 @@ static void mmio_close(struct trace_iterator *iter)
static unsigned long count_overruns(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); unsigned long over = ring_buffer_overruns(iter->tr->buffer);
if (over > prev_overruns) if (over > prev_overruns)
cnt = over - prev_overruns; cnt += over - prev_overruns;
prev_overruns = over; prev_overruns = over;
return cnt; return cnt;
} }
...@@ -310,8 +312,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, ...@@ -310,8 +312,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags); &irq_flags);
if (!event) if (!event) {
atomic_inc(&dropped_count);
return; return;
}
entry = ring_buffer_event_data(event); entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count()); tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_RW; entry->ent.type = TRACE_MMIO_RW;
...@@ -338,8 +342,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr, ...@@ -338,8 +342,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
&irq_flags); &irq_flags);
if (!event) if (!event) {
atomic_inc(&dropped_count);
return; return;
}
entry = ring_buffer_event_data(event); entry = ring_buffer_event_data(event);
tracing_generic_entry_update(&entry->ent, 0, preempt_count()); tracing_generic_entry_update(&entry->ent, 0, preempt_count());
entry->ent.type = TRACE_MMIO_MAP; entry->ent.type = TRACE_MMIO_MAP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment