diff options
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8b6409a62b54..1ca74c0cee6a 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3335,7 +3335,7 @@ static int mark_printk(const char *fmt, ...) | |||
3335 | int ret; | 3335 | int ret; |
3336 | va_list args; | 3336 | va_list args; |
3337 | va_start(args, fmt); | 3337 | va_start(args, fmt); |
3338 | ret = trace_vprintk(0, fmt, args); | 3338 | ret = trace_vprintk(0, -1, fmt, args); |
3339 | va_end(args); | 3339 | va_end(args); |
3340 | return ret; | 3340 | return ret; |
3341 | } | 3341 | } |
@@ -3564,9 +3564,16 @@ static __init int tracer_init_debugfs(void) | |||
3564 | return 0; | 3564 | return 0; |
3565 | } | 3565 | } |
3566 | 3566 | ||
3567 | int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | 3567 | int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args) |
3568 | { | 3568 | { |
3569 | static DEFINE_SPINLOCK(trace_buf_lock); | 3569 | /* |
3570 | * Raw Spinlock because a normal spinlock would be traced here | ||
3571 | * and append an irrelevant couple spin_lock_irqsave/ | ||
3572 | * spin_unlock_irqrestore traced by ftrace around this | ||
3573 | * TRACE_PRINTK trace. | ||
3574 | */ | ||
3575 | static raw_spinlock_t trace_buf_lock = | ||
3576 | (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; | ||
3570 | static char trace_buf[TRACE_BUF_SIZE]; | 3577 | static char trace_buf[TRACE_BUF_SIZE]; |
3571 | 3578 | ||
3572 | struct ring_buffer_event *event; | 3579 | struct ring_buffer_event *event; |
@@ -3587,7 +3594,8 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | |||
3587 | if (unlikely(atomic_read(&data->disabled))) | 3594 | if (unlikely(atomic_read(&data->disabled))) |
3588 | goto out; | 3595 | goto out; |
3589 | 3596 | ||
3590 | spin_lock_irqsave(&trace_buf_lock, flags); | 3597 | local_irq_save(flags); |
3598 | __raw_spin_lock(&trace_buf_lock); | ||
3591 | len = vsnprintf(trace_buf, TRACE_BUF_SIZE, fmt, args); | 3599 | len = vsnprintf(trace_buf, TRACE_BUF_SIZE, fmt, args); |
3592 | 3600 | ||
3593 | len = min(len, TRACE_BUF_SIZE-1); | 3601 | len = min(len, TRACE_BUF_SIZE-1); |
@@ -3601,13 +3609,15 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args) | |||
3601 | tracing_generic_entry_update(&entry->ent, flags, pc); | 3609 | tracing_generic_entry_update(&entry->ent, flags, pc); |
3602 | entry->ent.type = TRACE_PRINT; | 3610 | entry->ent.type = TRACE_PRINT; |
3603 | entry->ip = ip; | 3611 | entry->ip = ip; |
3612 | entry->depth = depth; | ||
3604 | 3613 | ||
3605 | memcpy(&entry->buf, trace_buf, len); | 3614 | memcpy(&entry->buf, trace_buf, len); |
3606 | entry->buf[len] = 0; | 3615 | entry->buf[len] = 0; |
3607 | ring_buffer_unlock_commit(tr->buffer, event, irq_flags); | 3616 | ring_buffer_unlock_commit(tr->buffer, event, irq_flags); |
3608 | 3617 | ||
3609 | out_unlock: | 3618 | out_unlock: |
3610 | spin_unlock_irqrestore(&trace_buf_lock, flags); | 3619 | __raw_spin_unlock(&trace_buf_lock); |
3620 | local_irq_restore(flags); | ||
3611 | 3621 | ||
3612 | out: | 3622 | out: |
3613 | preempt_enable_notrace(); | 3623 | preempt_enable_notrace(); |
@@ -3625,7 +3635,13 @@ int __ftrace_printk(unsigned long ip, const char *fmt, ...) | |||
3625 | return 0; | 3635 | return 0; |
3626 | 3636 | ||
3627 | va_start(ap, fmt); | 3637 | va_start(ap, fmt); |
3628 | ret = trace_vprintk(ip, fmt, ap); | 3638 | |
3639 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
3640 | ret = trace_vprintk(ip, current->curr_ret_stack, fmt, ap); | ||
3641 | #else | ||
3642 | ret = trace_vprintk(ip, -1, fmt, ap); | ||
3643 | #endif | ||
3644 | |||
3629 | va_end(ap); | 3645 | va_end(ap); |
3630 | return ret; | 3646 | return ret; |
3631 | } | 3647 | } |