mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
tracing/core: bring back raw trace_printk for dynamic formats strings
Impact: fix callsites with dynamic format strings Since its new binary implementation, trace_printk() internally uses static containers for the format strings on each callsites. But the value is assigned once at build time, which means that it can't take dynamic formats. So this patch unearthes the raw trace_printk implementation for the callers that will need trace_printk to be able to carry these dynamic format strings. The trace_printk() macro will use the appropriate implementation for each callsite. Most of the time however, the binary implementation will still be used. The other impact of this patch is that mmiotrace_printk() will use the old implementation because it calls the low level trace_vprintk and we can't guess here whether the format passed in it is dynamic or not. Some parts of this patch have been written by Steven Rostedt (most notably the part that chooses the appropriate implementation for each callsites). Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
This commit is contained in:
parent
db526ca329
commit
48ead02030
8 changed files with 214 additions and 40 deletions
|
@ -832,13 +832,13 @@ static struct trace_event trace_user_stack_event = {
|
|||
.binary = trace_special_bin,
|
||||
};
|
||||
|
||||
/* TRACE_PRINT */
|
||||
/* TRACE_BPRINT */
|
||||
static enum print_line_t
|
||||
trace_print_print(struct trace_iterator *iter, int flags)
|
||||
trace_bprint_print(struct trace_iterator *iter, int flags)
|
||||
{
|
||||
struct trace_entry *entry = iter->ent;
|
||||
struct trace_seq *s = &iter->seq;
|
||||
struct print_entry *field;
|
||||
struct bprint_entry *field;
|
||||
|
||||
trace_assign_type(field, entry);
|
||||
|
||||
|
@ -858,9 +858,10 @@ trace_print_print(struct trace_iterator *iter, int flags)
|
|||
}
|
||||
|
||||
|
||||
static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags)
|
||||
static enum print_line_t
|
||||
trace_bprint_raw(struct trace_iterator *iter, int flags)
|
||||
{
|
||||
struct print_entry *field;
|
||||
struct bprint_entry *field;
|
||||
struct trace_seq *s = &iter->seq;
|
||||
|
||||
trace_assign_type(field, iter->ent);
|
||||
|
@ -878,12 +879,55 @@ static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags)
|
|||
}
|
||||
|
||||
|
||||
static struct trace_event trace_bprint_event = {
|
||||
.type = TRACE_BPRINT,
|
||||
.trace = trace_bprint_print,
|
||||
.raw = trace_bprint_raw,
|
||||
};
|
||||
|
||||
/* TRACE_PRINT */
|
||||
static enum print_line_t trace_print_print(struct trace_iterator *iter,
|
||||
int flags)
|
||||
{
|
||||
struct print_entry *field;
|
||||
struct trace_seq *s = &iter->seq;
|
||||
|
||||
trace_assign_type(field, iter->ent);
|
||||
|
||||
if (!seq_print_ip_sym(s, field->ip, flags))
|
||||
goto partial;
|
||||
|
||||
if (!trace_seq_printf(s, ": %s", field->buf))
|
||||
goto partial;
|
||||
|
||||
return TRACE_TYPE_HANDLED;
|
||||
|
||||
partial:
|
||||
return TRACE_TYPE_PARTIAL_LINE;
|
||||
}
|
||||
|
||||
static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags)
|
||||
{
|
||||
struct print_entry *field;
|
||||
|
||||
trace_assign_type(field, iter->ent);
|
||||
|
||||
if (!trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf))
|
||||
goto partial;
|
||||
|
||||
return TRACE_TYPE_HANDLED;
|
||||
|
||||
partial:
|
||||
return TRACE_TYPE_PARTIAL_LINE;
|
||||
}
|
||||
|
||||
static struct trace_event trace_print_event = {
|
||||
.type = TRACE_PRINT,
|
||||
.type = TRACE_PRINT,
|
||||
.trace = trace_print_print,
|
||||
.raw = trace_print_raw,
|
||||
};
|
||||
|
||||
|
||||
static struct trace_event *events[] __initdata = {
|
||||
&trace_fn_event,
|
||||
&trace_ctx_event,
|
||||
|
@ -891,6 +935,7 @@ static struct trace_event *events[] __initdata = {
|
|||
&trace_special_event,
|
||||
&trace_stack_event,
|
||||
&trace_user_stack_event,
|
||||
&trace_bprint_event,
|
||||
&trace_print_event,
|
||||
NULL
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue