Merge "coresight: enable stm logging for trace events, marker and printk"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
4f5296141c
@@ -45,6 +45,7 @@
|
||||
#include <linux/trace.h>
|
||||
#include <linux/sched/clock.h>
|
||||
#include <linux/sched/rt.h>
|
||||
#include <linux/coresight-stm.h>
|
||||
|
||||
#include "trace.h"
|
||||
#include "trace_output.h"
|
||||
@@ -2578,15 +2579,26 @@ int tracepoint_printk_sysctl(struct ctl_table *table, int write,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CORESIGHT_QGKI
|
||||
void trace_event_buffer_commit(struct trace_event_buffer *fbuffer,
|
||||
unsigned long len)
|
||||
{
|
||||
if (static_key_false(&tracepoint_printk_key.key))
|
||||
output_printk(fbuffer);
|
||||
event_trigger_unlock_commit(fbuffer->trace_file, fbuffer->buffer,
|
||||
fbuffer->event, fbuffer->entry,
|
||||
fbuffer->flags, fbuffer->pc, len);
|
||||
}
|
||||
#else
|
||||
void trace_event_buffer_commit(struct trace_event_buffer *fbuffer)
|
||||
{
|
||||
if (static_key_false(&tracepoint_printk_key.key))
|
||||
output_printk(fbuffer);
|
||||
|
||||
event_trigger_unlock_commit(fbuffer->trace_file, fbuffer->buffer,
|
||||
fbuffer->event, fbuffer->entry,
|
||||
fbuffer->flags, fbuffer->pc);
|
||||
}
|
||||
#endif
|
||||
EXPORT_SYMBOL_GPL(trace_event_buffer_commit);
|
||||
|
||||
/*
|
||||
@@ -3194,6 +3206,7 @@ __trace_array_vprintk(struct ring_buffer *buffer,
|
||||
|
||||
memcpy(&entry->buf, tbuffer, len + 1);
|
||||
if (!call_filter_check_discard(call, entry, buffer, event)) {
|
||||
stm_log(OST_ENTITY_TRACE_PRINTK, entry->buf, len + 1);
|
||||
__buffer_unlock_commit(buffer, event);
|
||||
ftrace_trace_stack(&global_trace, buffer, flags, 6, pc, NULL);
|
||||
}
|
||||
@@ -6426,8 +6439,11 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
|
||||
if (entry->buf[cnt - 1] != '\n') {
|
||||
entry->buf[cnt] = '\n';
|
||||
entry->buf[cnt + 1] = '\0';
|
||||
} else
|
||||
stm_log(OST_ENTITY_TRACE_MARKER, entry->buf, cnt + 2);
|
||||
} else {
|
||||
entry->buf[cnt] = '\0';
|
||||
stm_log(OST_ENTITY_TRACE_MARKER, entry->buf, cnt + 1);
|
||||
}
|
||||
|
||||
__buffer_unlock_commit(buffer, event);
|
||||
|
||||
|
||||
@@ -1426,11 +1426,34 @@ __event_trigger_test_discard(struct trace_event_file *file,
|
||||
* @entry: The event itself
|
||||
* @irq_flags: The state of the interrupts at the start of the event
|
||||
* @pc: The state of the preempt count at the start of the event.
|
||||
* @len: The length of the payload data required for stm logging.
|
||||
*
|
||||
* This is a helper function to handle triggers that require data
|
||||
* from the event itself. It also tests the event against filters and
|
||||
* if the event is soft disabled and should be discarded.
|
||||
*/
|
||||
#ifdef CONFIG_CORESIGHT_QGKI
|
||||
static inline void
|
||||
event_trigger_unlock_commit(struct trace_event_file *file,
|
||||
struct ring_buffer *buffer,
|
||||
struct ring_buffer_event *event,
|
||||
void *entry, unsigned long irq_flags, int pc,
|
||||
unsigned long len)
|
||||
{
|
||||
enum event_trigger_type tt = ETT_NONE;
|
||||
|
||||
if (!__event_trigger_test_discard(file, buffer, event, entry, &tt)) {
|
||||
if (len)
|
||||
stm_log(OST_ENTITY_FTRACE_EVENTS, entry, len);
|
||||
|
||||
trace_buffer_unlock_commit(file->tr, buffer, event,
|
||||
irq_flags, pc);
|
||||
}
|
||||
|
||||
if (tt)
|
||||
event_triggers_post_call(file, tt);
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
event_trigger_unlock_commit(struct trace_event_file *file,
|
||||
struct ring_buffer *buffer,
|
||||
@@ -1445,7 +1468,7 @@ event_trigger_unlock_commit(struct trace_event_file *file,
|
||||
if (tt)
|
||||
event_triggers_post_call(file, tt);
|
||||
}
|
||||
|
||||
#endif
|
||||
/**
|
||||
* event_trigger_unlock_commit_regs - handle triggers and finish event commit
|
||||
* @file: The file pointer assoctiated to the event
|
||||
|
||||
@@ -3384,9 +3384,13 @@ function_test_events_call(unsigned long ip, unsigned long parent_ip,
|
||||
entry = ring_buffer_event_data(event);
|
||||
entry->ip = ip;
|
||||
entry->parent_ip = parent_ip;
|
||||
|
||||
#ifdef CONFIG_CORESIGHT_QGKI
|
||||
event_trigger_unlock_commit(&event_trace_file, buffer, event,
|
||||
entry, flags, pc, 0);
|
||||
#else
|
||||
event_trigger_unlock_commit(&event_trace_file, buffer, event,
|
||||
entry, flags, pc);
|
||||
#endif
|
||||
out:
|
||||
atomic_dec(&per_cpu(ftrace_test_event_disable, cpu));
|
||||
preempt_enable_notrace();
|
||||
|
||||
@@ -915,8 +915,11 @@ static notrace void trace_event_raw_event_synth(void *__data,
|
||||
n_u64++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CORESIGHT_QGKI
|
||||
trace_event_buffer_commit(&fbuffer, sizeof(*entry) + fields_size);
|
||||
#else
|
||||
trace_event_buffer_commit(&fbuffer);
|
||||
#endif
|
||||
out:
|
||||
ring_buffer_nest_end(buffer);
|
||||
}
|
||||
|
||||
@@ -350,9 +350,13 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
|
||||
entry->nr = syscall_nr;
|
||||
syscall_get_arguments(current, regs, args);
|
||||
memcpy(entry->args, args, sizeof(unsigned long) * sys_data->nb_args);
|
||||
|
||||
#ifdef CONFIG_CORESIGHT_QGKI
|
||||
event_trigger_unlock_commit(trace_file, buffer, event, entry,
|
||||
irq_flags, pc, 0);
|
||||
#else
|
||||
event_trigger_unlock_commit(trace_file, buffer, event, entry,
|
||||
irq_flags, pc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
|
||||
@@ -397,8 +401,13 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
|
||||
entry->nr = syscall_nr;
|
||||
entry->ret = syscall_get_return_value(current, regs);
|
||||
|
||||
#ifdef CONFIG_CORESIGHT_QGKI
|
||||
event_trigger_unlock_commit(trace_file, buffer, event, entry,
|
||||
irq_flags, pc, 0);
|
||||
#else
|
||||
event_trigger_unlock_commit(trace_file, buffer, event, entry,
|
||||
irq_flags, pc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int reg_event_syscall_enter(struct trace_event_file *file,
|
||||
|
||||
@@ -971,7 +971,11 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
|
||||
|
||||
memcpy(data, ucb->buf, tu->tp.size + dsize);
|
||||
|
||||
#ifdef CONFIG_CORESIGHT_QGKI
|
||||
event_trigger_unlock_commit(trace_file, buffer, event, entry, 0, 0, 0);
|
||||
#else
|
||||
event_trigger_unlock_commit(trace_file, buffer, event, entry, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* uprobe handler */
|
||||
|
||||
Reference in New Issue
Block a user