login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
December
»
29
Re: [PATCH] workqueue: relax lockdep annotation on flush_work()
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Rafael J. Wysocki
Subject:
Re: [PATCH] workqueue: relax lockdep annotation on flush_work()
Date: Wednesday, December 29, 2010 - 7:20 am
On Wednesday, December 29, 2010, Tejun Heo wrote:
quoted text
> Currently, the lockdep annotation in flush_work() requires exclusive > access on the workqueue the target work is queued on and triggers > warning if a work is trying to flush another work on the same > workqueue; however, this is no longer true as workqueues can now > execute multiple works concurrently. > > This patch adds lock_map_acquire_read() and make process_one_work() > hold read access to the workqueue while executing a work and > start_flush_work() check for write access if concurrnecy level is one > and read access if higher. > > This better represents what's going on and removes spurious lockdep > warnings which are triggered by fake dependency chain created through > flush_work().
The spurious lockdep warning I've been observing is not printed any more with the patch applied. Thanks, Rafael
quoted text
> Signed-off-by: Tejun Heo <tj@kernel.org> > Reported-by: "Rafael J. Wysocki" <rjw@sisk.pl> > --- > How should this one be routed? The lockdep part can be split, merged > back into workqueue tree and so on but that seems a bit too much. If > it's okay, I'll route this through the workqueue tree. Going through > the lockdep tree is fine too. > > Thanks. > > include/linux/lockdep.h | 3 +++ > kernel/workqueue.c | 8 ++++++-- > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h > index 71c09b2..9f19430 100644 > --- a/include/linux/lockdep.h > +++ b/include/linux/lockdep.h > @@ -522,12 +522,15 @@ static inline void print_irqtrace_events(struct task_struct *curr) > #ifdef CONFIG_DEBUG_LOCK_ALLOC > # ifdef CONFIG_PROVE_LOCKING > # define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_) > +# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 2, NULL, _THIS_IP_) > # else > # define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_) > +# define lock_map_acquire_read(l) lock_acquire(l, 0, 0, 2, 1, NULL, _THIS_IP_) > # endif > # define lock_map_release(l) lock_release(l, 1, _THIS_IP_) > #else > # define lock_map_acquire(l) do { } while (0) > +# define lock_map_acquire_read(l) do { } while (0) > # define lock_map_release(l) do { } while (0) > #endif > > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index 8ee6ec8..85f8f7b 100644 > --- a/kernel/workqueue.c > +++ b/kernel/workqueue.c > @@ -1840,7 +1840,7 @@ __acquires(&gcwq->lock) > spin_unlock_irq(&gcwq->lock); > > work_clear_pending(work); > - lock_map_acquire(&cwq->wq->lockdep_map); > + lock_map_acquire_read(&cwq->wq->lockdep_map); > lock_map_acquire(&lockdep_map); > trace_workqueue_execute_start(work); > f(work); > @@ -2384,8 +2384,12 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr, > insert_wq_barrier(cwq, barr, work, worker); > spin_unlock_irq(&gcwq->lock); > > - lock_map_acquire(&cwq->wq->lockdep_map); > + if (cwq->wq->saved_max_active > 1) > + lock_map_acquire_read(&cwq->wq->lockdep_map); > + else > + lock_map_acquire(&cwq->wq->lockdep_map); > lock_map_release(&cwq->wq->lockdep_map); > + > return true; > already_gone: > spin_unlock_irq(&gcwq->lock);
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] workqueue: relax lockdep annotation on flush_work()
, Tejun Heo
, (Wed Dec 29, 5:57 am)
Re: [PATCH] workqueue: relax lockdep annotation on flush_w ...
, Rafael J. Wysocki
, (Wed Dec 29, 7:20 am)
Re: [PATCH] workqueue: relax lockdep annotation on flush_w ...
, Peter Zijlstra
, (Mon Jan 3, 2:31 am)
[PATCH UPDATED] workqueue: relax lockdep annotation on flu ...
, Tejun Heo
, (Mon Jan 3, 7:17 am)
Re: [PATCH UPDATED] workqueue: relax lockdep annotation on ...
, Peter Zijlstra
, (Mon Jan 3, 7:54 am)
Re: [PATCH UPDATED] workqueue: relax lockdep annotation on ...
, Tejun Heo
, (Mon Jan 3, 8:00 am)
Re: [PATCH UPDATED] workqueue: relax lockdep annotation on ...
, Peter Zijlstra
, (Mon Jan 3, 8:14 am)
Re: [PATCH UPDATED] workqueue: relax lockdep annotation on ...
, Tejun Heo
, (Mon Jan 3, 8:20 am)
Re: [PATCH UPDATED] workqueue: relax lockdep annotation on ...
, Peter Zijlstra
, (Mon Jan 3, 8:29 am)
Re: [PATCH UPDATED] workqueue: relax lockdep annotation on ...
, Rafael J. Wysocki
, (Mon Jan 3, 2:25 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Paul Turner
[tg_shares_up rewrite v4 11/11] sched: update tg->shares after cpu.shares write
Mr. James W. Laferriere
Re: Linux 2.6.25-rc1 , syntax error near unexpected token `;'
Chuck Ebbert
Re: PCI: Unable to reserve mem region problem
Linus Torvalds
Linux 2.6.34-rc4
Thomas Taranowski
[PATCH] RapidIO: Fix hang on RapidIO doorbell queue full condition
git
:
Ralf Wildenhues
[PATCH] Fix typos in the documentation
Len Brown
Re: fatal: unable to create '.git/index': File exists
Denis Bueno
Git clone error
Sam Vilain
Re: RFC: Flat directory for notes, or fan-out? Both!
Oliver Hoffmann
git init --bare versus git --bare init
git-commits-head
:
Linux Kernel Mailing List
ASoC: fix registration of the SoC card in the Freescale MPC8610 drivers
Linux Kernel Mailing List
drivers/acpi: use kasprintf
Linux Kernel Mailing List
nfsd41: sanity check client drc maxreqs
Linux Kernel Mailing List
bnx2x: Moving includes
Linux Kernel Mailing List
V4L/DVB: gspca - sonixj: Adjust minor values of sensor ov7630. - set the color ga...
openbsd-misc
:
Sevan / Venture37
Re: This is what Linus Torvalds calls openBSD crowd
Netmaffia.hu
Tini Lányok AKCIÓBAN OTTHON
Sam Fourman Jr.
Re: Help with Altell PC6700
Siju George
This is what Linus Torvalds calls openBSD crowd
Darrin Chandler
Re: OT: Python (was Re: vi in /bin)
linux-netdev
:
Kurt Van Dijck
Re: [PATCH net-next-2.6 1/2] can: add driver for Softing card
Eric Dumazet
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try()
Jamie Lokier
Re: POHMELFS high performance network filesystem. Transactions, failover, performa...
Jarek Poplawski
Re: socket api problem: can't bind an ipv6 socket to ::ffff:0.0.0.0
David Miller
Re: [PATCH v2] net: typos in comments in include/linux/igmp.h
Colocation donated by:
Syndicate