Return-path: Received: from mx2.mail.elte.hu ([157.181.151.9]:40537 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756338AbXGDMWL (ORCPT ); Wed, 4 Jul 2007 08:22:11 -0400 Date: Wed, 4 Jul 2007 14:21:59 +0200 From: Ingo Molnar To: Johannes Berg Cc: Oleg Nesterov , Ingo Molnar , Arjan van de Ven , Linux Kernel list , linux-wireless , Peter Zijlstra , Thomas Sattler Subject: Re: [RFC/PATCH] debug workqueue deadlocks with lockdep Message-ID: <20070704122159.GA21813@elte.hu> References: <1182969638.4769.56.camel@johannes.berg> <1183048429.4089.1.camel@johannes.berg> <1183052001.4089.2.camel@johannes.berg> <1183190728.7932.43.camel@earth4> <20070630114658.GA344@tv-sign.ru> <1183381393.4089.117.camel@johannes.berg> <20070703173112.GA108@tv-sign.ru> <1183549772.3812.10.camel@johannes.berg> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1183549772.3812.10.camel@johannes.berg> Sender: linux-wireless-owner@vger.kernel.org List-ID: * Johannes Berg wrote: > > > @@ -257,7 +260,9 @@ static void run_workqueue(struct cpu_wor > > > > > > BUG_ON(get_wq_data(work) != cwq); > > > work_clear_pending(work); > > > + lock_acquire(&cwq->wq->lockdep_map, 0, 0, 0, 2, _THIS_IP_); > > > f(work); > > > + lock_release(&cwq->wq->lockdep_map, 0, _THIS_IP_); > > ^^^ > > Isn't it better to call lock_release() with nested == 1 ? > > Not sure, Ingo? well, in this case the lock/unlock should nest perfectly (i.e. it should always be balanced perfectly), so indeed calling with nested==1 leads to stricter checking. non-nested unlocks occur when people do stuff like: spin_lock(&lock1); spin_lock(&lock2); spin_unlock(&lock1); spin_unlock(&lock2); the first unlock is not 'nested perfectly'. Now for the workqueue dep_map this shouldnt be a legal combination, right? Ingo