From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ming Lei <tom.leiming@gmail.com>
Cc: torvalds@osdl.org, Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: deadlock caused by printk
Date: Fri, 25 Mar 2011 13:21:38 +0100 [thread overview]
Message-ID: <1301055698.2250.198.camel@laptop> (raw)
In-Reply-To: <AANLkTinCk35LSMLyO0nD+Z1ZmZskaCCN5c8kyxLcmXYx@mail.gmail.com>
On Fri, 2011-03-25 at 20:15 +0800, Ming Lei wrote:
> Hi,
>
> These days I was studying "perf code" and try to dump some debug
> info in event_sched_out(): kernel/perf_event.c by printk, but found
> system can hang easily.
>
> After digging into related code for several days, I find the hang is
> caused by spinlock deadlock when acquiring rq->lock in task_rq_lock(),
> which is called in the path below:
>
> try_to_wake_up<-wake_up_process<-up<-console_unlock<-printk.
>
> I wonder if there are some usage conventions about printk, which says
> explicitly that printk can not by used in some places of kernel. Or does the
> above show that it is a bug of kernel?
>
> If the above is really a limitation of printk, have we other dump functions
> which may be used safely in some places of kernel source code where
> printk is not allowed.
Don't use printk from NMI context, that's never going to work well.
One thing you could to is use trace_printk() and use ftrace to debug
perf.
next prev parent reply other threads:[~2011-03-25 12:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 12:15 deadlock caused by printk Ming Lei
2011-03-25 12:21 ` Peter Zijlstra [this message]
2011-03-25 12:26 ` Peter Zijlstra
2011-03-25 14:30 ` Ming Lei
2011-03-25 14:50 ` Peter Zijlstra
2011-03-25 18:41 ` Steven Rostedt
2011-03-25 18:40 ` Steven Rostedt
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=1301055698.2250.198.camel@laptop \
--to=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tom.leiming@gmail.com \
--cc=torvalds@osdl.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