From: Thomas Gleixner <tglx@linutronix.de>
To: junjie cai <junjiec@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [rt] __reacquire_lock_kernel bug?
Date: Thu, 12 Jun 2008 14:06:30 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.1.10.0806121255480.3193@apollo.tec.linutronix.de> (raw)
In-Reply-To: <ca992f110806112331v3d4d73abhaa46167f494e8d9b@mail.gmail.com>
On Thu, 12 Jun 2008, junjie cai wrote:
> Hi, List
>
> We get a BUG_ON during some tests on a 2.6.22.19-rt9,
> the message is pasted at the end of this mail.
There is no BUG_ON in the code path where your stack trace comes from.
Unfortunately you omitted the interesting part of the message, which
is printed _before_ the stack trace:
"BUG: scheduling while atomic: .....
> It seems that preemption happened in __reacquire_kernel_lock()
> that kernel_lock in released twice.
Sorry, I do not understand what you mean.
> int __lockfunc __reacquire_kernel_lock(void)
> {
> local_irq_enable();
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> preempted here
When you use rt you won't be in that code path. -rt uses the
preemptible BKL implementation.
> _raw_spin_lock(&kernel_flag);
> local_irq_disable();
> preempt_disable();
> }
>
> After checking the 2.6.25.4-rt6, I think that same problem exist.
> Isn't that lock_depth should be set to -1 before local_irq_enable() ?
>
> int __lockfunc __reacquire_kernel_lock(void)
> {
> struct task_struct *task = current;
> int saved_lock_depth = task->lock_depth;
>
> local_irq_enable();
> BUG_ON(saved_lock_depth < 0);
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>preempted here
That's ok, when we the task is preempted here. lock_depth needs to be
set to -1 before we call down() and it is restored
afterwards. preempt_schedule_irq() handles the BKL in the right way.
Thanks,
tglx
prev parent reply other threads:[~2008-06-12 12:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <a5530a0e-7f34-4ddf-862e-83771a9c78e3@a32g2000prf.googlegroups.com>
2008-06-12 6:31 ` junjie cai
2008-06-12 12:06 ` Thomas Gleixner [this message]
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=alpine.LFD.1.10.0806121255480.3193@apollo.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=junjiec@gmail.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®