Merge tag 'trace-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt: "This release has a few updates: - STM can hook into the function tracer - Function filtering now supports more advance glob matching - Ftrace selftests updates and added tests - Softirq tag in traces now show only softirqs - ARM nop added to non traced locations at compile time - New trace_marker_raw file that allows for binary input - Optimizations to the ring buffer - Removal of kmap in trace_marker - Wakeup and irqsoff tracers now adhere to the set_graph_notrace file - Other various fixes and clean ups" * tag 'trace-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (42 commits) selftests: ftrace: Shift down default message verbosity kprobes/trace: Fix kprobe selftest for newer gcc tracing/kprobes: Add a helper method to return number of probe hits tracing/rb: Init the CPU mask on allocation tracing: Use SOFTIRQ_OFFSET for softirq dectection for more accurate results tracing/fgraph: Have wakeup and irqsoff tracers ignore graph functions too fgraph: Handle a case where a tracer ignores set_graph_notrace tracing: Replace kmap with copy_from_user() in trace_marker writing ftrace/x86_32: Set ftrace_stub to weak to prevent gcc from using short jumps to it tracing: Allow benchmark to be enabled at early_initcall() tracing: Have system enable return error if one of the events fail tracing: Do not start benchmark on boot up tracing: Have the reg function allow to fail ring-buffer: Force rb_end_commit() and rb_set_commit_to_write() inline ring-buffer: Froce rb_update_write_stamp() to be inlined ring-buffer: Force inline of hotpath helper functions tracing: Make __buffer_unlock_commit() always_inline tracing: Make tracepoint_printk a static_key ring-buffer: Always inline rb_event_data() ring-buffer: Make rb_reserve_next_event() always inlined ...
This commit is contained in:
@@ -406,7 +406,7 @@ static long stm_generic_set_options(struct stm_data *stm_data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t stm_generic_packet(struct stm_data *stm_data,
|
||||
static ssize_t notrace stm_generic_packet(struct stm_data *stm_data,
|
||||
unsigned int master,
|
||||
unsigned int channel,
|
||||
unsigned int packet,
|
||||
|
@@ -67,10 +67,13 @@ static void sth_iowrite(void __iomem *dest, const unsigned char *payload,
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t sth_stm_packet(struct stm_data *stm_data, unsigned int master,
|
||||
unsigned int channel, unsigned int packet,
|
||||
unsigned int flags, unsigned int size,
|
||||
const unsigned char *payload)
|
||||
static ssize_t notrace sth_stm_packet(struct stm_data *stm_data,
|
||||
unsigned int master,
|
||||
unsigned int channel,
|
||||
unsigned int packet,
|
||||
unsigned int flags,
|
||||
unsigned int size,
|
||||
const unsigned char *payload)
|
||||
{
|
||||
struct sth_device *sth = container_of(stm_data, struct sth_device, stm);
|
||||
struct intel_th_channel __iomem *out =
|
||||
|
@@ -39,4 +39,15 @@ config STM_SOURCE_HEARTBEAT
|
||||
If you want to send heartbeat messages over STM devices,
|
||||
say Y.
|
||||
|
||||
config STM_SOURCE_FTRACE
|
||||
tristate "Copy the output from kernel Ftrace to STM engine"
|
||||
depends on FUNCTION_TRACER
|
||||
help
|
||||
This option can be used to copy the output from kernel Ftrace
|
||||
to STM engine. Enabling this option will introduce a slight
|
||||
timing effect.
|
||||
|
||||
If you want to send kernel Ftrace messages over STM devices,
|
||||
say Y.
|
||||
|
||||
endif
|
||||
|
@@ -6,6 +6,8 @@ obj-$(CONFIG_STM_DUMMY) += dummy_stm.o
|
||||
|
||||
obj-$(CONFIG_STM_SOURCE_CONSOLE) += stm_console.o
|
||||
obj-$(CONFIG_STM_SOURCE_HEARTBEAT) += stm_heartbeat.o
|
||||
obj-$(CONFIG_STM_SOURCE_FTRACE) += stm_ftrace.o
|
||||
|
||||
stm_console-y := console.o
|
||||
stm_heartbeat-y := heartbeat.o
|
||||
stm_ftrace-y := ftrace.o
|
||||
|
@@ -427,7 +427,7 @@ static int stm_file_assign(struct stm_file *stmf, char *id, unsigned int width)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t stm_write(struct stm_data *data, unsigned int master,
|
||||
static ssize_t notrace stm_write(struct stm_data *data, unsigned int master,
|
||||
unsigned int channel, const char *buf, size_t count)
|
||||
{
|
||||
unsigned int flags = STP_PACKET_TIMESTAMPED;
|
||||
@@ -1123,8 +1123,9 @@ void stm_source_unregister_device(struct stm_source_data *data)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(stm_source_unregister_device);
|
||||
|
||||
int stm_source_write(struct stm_source_data *data, unsigned int chan,
|
||||
const char *buf, size_t count)
|
||||
int notrace stm_source_write(struct stm_source_data *data,
|
||||
unsigned int chan,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct stm_source_device *src = data->src;
|
||||
struct stm_device *stm;
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/stm.h>
|
||||
|
||||
static ssize_t
|
||||
static ssize_t notrace
|
||||
dummy_stm_packet(struct stm_data *stm_data, unsigned int master,
|
||||
unsigned int channel, unsigned int packet, unsigned int flags,
|
||||
unsigned int size, const unsigned char *payload)
|
||||
|
87
drivers/hwtracing/stm/ftrace.c
Normal file
87
drivers/hwtracing/stm/ftrace.c
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Simple kernel driver to link kernel Ftrace and an STM device
|
||||
* Copyright (c) 2016, Linaro Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* STM Ftrace will be registered as a trace_export.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/stm.h>
|
||||
#include <linux/trace.h>
|
||||
|
||||
#define STM_FTRACE_NR_CHANNELS 1
|
||||
#define STM_FTRACE_CHAN 0
|
||||
|
||||
static int stm_ftrace_link(struct stm_source_data *data);
|
||||
static void stm_ftrace_unlink(struct stm_source_data *data);
|
||||
|
||||
static struct stm_ftrace {
|
||||
struct stm_source_data data;
|
||||
struct trace_export ftrace;
|
||||
} stm_ftrace = {
|
||||
.data = {
|
||||
.name = "ftrace",
|
||||
.nr_chans = STM_FTRACE_NR_CHANNELS,
|
||||
.link = stm_ftrace_link,
|
||||
.unlink = stm_ftrace_unlink,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* stm_ftrace_write() - write data to STM via 'stm_ftrace' source
|
||||
* @buf: buffer containing the data packet
|
||||
* @len: length of the data packet
|
||||
*/
|
||||
static void notrace
|
||||
stm_ftrace_write(const void *buf, unsigned int len)
|
||||
{
|
||||
stm_source_write(&stm_ftrace.data, STM_FTRACE_CHAN, buf, len);
|
||||
}
|
||||
|
||||
static int stm_ftrace_link(struct stm_source_data *data)
|
||||
{
|
||||
struct stm_ftrace *sf = container_of(data, struct stm_ftrace, data);
|
||||
|
||||
sf->ftrace.write = stm_ftrace_write;
|
||||
|
||||
return register_ftrace_export(&sf->ftrace);
|
||||
}
|
||||
|
||||
static void stm_ftrace_unlink(struct stm_source_data *data)
|
||||
{
|
||||
struct stm_ftrace *sf = container_of(data, struct stm_ftrace, data);
|
||||
|
||||
unregister_ftrace_export(&sf->ftrace);
|
||||
}
|
||||
|
||||
static int __init stm_ftrace_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = stm_source_register_device(NULL, &stm_ftrace.data);
|
||||
if (ret)
|
||||
pr_err("Failed to register stm_source - ftrace.\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit stm_ftrace_exit(void)
|
||||
{
|
||||
stm_source_unregister_device(&stm_ftrace.data);
|
||||
}
|
||||
|
||||
module_init(stm_ftrace_init);
|
||||
module_exit(stm_ftrace_exit);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_DESCRIPTION("stm_ftrace driver");
|
||||
MODULE_AUTHOR("Chunyan Zhang <zhang.chunyan@linaro.org>");
|
Reference in New Issue
Block a user