From: Tejun Heo <tj@kernel.org>
To: Lei Wen <adrian.wenl@gmail.com>
Cc: linux-kernel@vger.kernel.org, leiwen@marvell.com
Subject: Re: workqueue panic in 3.4 kernel
Date: Wed, 6 Mar 2013 11:14:08 -0800 [thread overview]
Message-ID: <20130306191408.GN1227@htj.dyndns.org> (raw)
In-Reply-To: <CALZhoSRyjRYVcKpq9cECHWgKkci6V+O_zn2CkiwqnFo57tZDfQ@mail.gmail.com>
Hello, Lei.
On Wed, Mar 06, 2013 at 10:39:15PM +0800, Lei Wen wrote:
> We find a race condition as below:
> CPU0 CPU1
> timer interrupt happen
> __run_timers
> __run_timers::spin_lock_irq(&base->lock)
> __run_timers::spin_unlock_irq(&base->lock)
>
> __cancel_work_timer
>
> __cancel_work_timer::del_timer
>
> __cancel_work_timer::wait_on_work
>
> __cancel_work_timer::clear_work_data
> __run_timers::call_timer_fn(timer, fn, data);
> delayed_work_timer_fn::get_work_cwq
> __run_timers::spin_lock_irq(&base->lock)
>
> It is possible for __cancel_work_timer to be run over cpu1 __BEFORE__
> cpu0 is ready to
> run the timer callback, which is delayed_work_timer_fn in our case.
If del_timer() happens after the timer starts running, del_timer()
would return NULL and try_to_grab_pending() will be called which will
return >=0 iff if successfully steals the PENDING bit (ie. it's the
sole owner of the work item). If del_timer() happens before the timer
starts running, the timer function would never run.
clear_work_data() happens iff the work item is confirmed to be idle.
At this point, I'm pretty skeptical this is a bug in workqueue itself
and strongly suggest looking at the crashing workqueue user.
Thanks.
--
tejun
next prev parent reply other threads:[~2013-03-06 19:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 7:31 Lei Wen
2013-03-05 16:32 ` Tejun Heo
2013-03-06 14:39 ` Lei Wen
2013-03-06 19:14 ` Tejun Heo [this message]
2013-03-07 1:15 ` Lei Wen
2013-03-07 15:22 ` Lei Wen
2013-03-07 15:49 ` Tejun Heo
2013-03-07 16:07 ` Thomas Gleixner
[not found] ` <CALZhoSQBH3RxSoaVDCYoCyRVRndht-Rk0rh_w5Dbp6+5T_auSw@mail.gmail.com>
2013-03-12 5:12 ` Tejun Heo
2013-03-12 5:18 ` Lei Wen
2013-03-12 5:24 ` Tejun Heo
2013-03-12 5:34 ` Lei Wen
2013-03-12 5:40 ` Tejun Heo
2013-03-12 6:01 ` Lei Wen
2013-03-12 6:13 ` Tejun Heo
2013-03-12 6:41 ` Lei Wen
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=20130306191408.GN1227@htj.dyndns.org \
--to=tj@kernel.org \
--cc=adrian.wenl@gmail.com \
--cc=leiwen@marvell.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®