From: Peter Zijlstra <peterz@infradead.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [GIT PULL] tracing: use raw spinlocks for trace_vprintk
Date: Wed, 11 Mar 2009 07:59:24 +0100 [thread overview]
Message-ID: <1236754764.22914.3680.camel@twins> (raw)
In-Reply-To: <alpine.DEB.2.00.0903102125250.16494@gandalf.stny.rr.com>
On Tue, 2009-03-10 at 21:26 -0400, Steven Rostedt wrote:
> commit 80370cb758e7ca2692cd9fb5e413d970b1f4b2b2
> Author: Steven Rostedt <srostedt@redhat.com>
> Date: Tue Mar 10 17:16:35 2009 -0400
>
> tracing: use raw spinlocks for trace_vprintk
>
> Impact: prevent locking up by lockdep tracer
>
> The lockdep tracer uses trace_vprintk and thus trace_vprintk can not
> call back into lockdep without locking up.
Hmm, I did this when I posted the lockdep tracepoints, so someone then
did a bad copy/paste job when renaming ftrace_printk or something?
See efed792d6738964f399a508ef9e831cd60fa4657
> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 8c6a902..4c97947 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -1176,7 +1176,8 @@ void trace_graph_return(struct ftrace_graph_ret *trace)
> */
> int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
> {
> - static DEFINE_SPINLOCK(trace_buf_lock);
> + static raw_spinlock_t trace_buf_lock =
> + (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
> static u32 trace_buf[TRACE_BUF_SIZE];
>
> struct ring_buffer_event *event;
> @@ -1201,7 +1202,9 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
> if (unlikely(atomic_read(&data->disabled)))
> goto out;
>
> - spin_lock_irqsave(&trace_buf_lock, flags);
> + /* Lockdep uses trace_printk for lock tracing */
> + local_irq_save(flags);
Shouldn't you also use raw_local_irq_save() and friends?
> + __raw_spin_lock(&trace_buf_lock);
> len = vbin_printf(trace_buf, TRACE_BUF_SIZE, fmt, args);
>
> if (len > TRACE_BUF_SIZE || len < 0)
> @@ -1220,7 +1223,8 @@ int trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args)
> ring_buffer_unlock_commit(tr->buffer, event);
>
> out_unlock:
> - spin_unlock_irqrestore(&trace_buf_lock, flags);
> + __raw_spin_unlock(&trace_buf_lock);
> + local_irq_restore(flags);
>
> out:
> ftrace_preempt_enable(resched);
>
next prev parent reply other threads:[~2009-03-11 7:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 1:26 [GIT PULL] tracing: use raw spinlocks for trace_vprintk Steven Rostedt
2009-03-11 6:59 ` Peter Zijlstra [this message]
2009-03-11 7:18 ` Frederic Weisbecker
2009-03-11 14:00 ` Steven Rostedt
2009-03-11 14:01 ` Steven Rostedt
2009-03-11 14:04 ` Frederic Weisbecker
2009-03-11 13:57 ` Steven Rostedt
2009-03-11 18:26 ` Ingo Molnar
2009-03-11 18:32 ` Steven Rostedt
2009-03-11 19:45 ` Peter Zijlstra
2009-03-11 19:47 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1236754764.22914.3680.camel@twins \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox