Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751042AbdIEKb5 (ORCPT ); Tue, 5 Sep 2017 06:31:57 -0400 Received: from LGEAMRELO12.lge.com ([156.147.23.52]:39825 "EHLO lgeamrelo12.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbdIEKb4 (ORCPT ); Tue, 5 Sep 2017 06:31:56 -0400 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Tue, 5 Sep 2017 19:31:44 +0900 From: Byungchul Park To: Peter Zijlstra Cc: Byungchul Park , Ingo Molnar , Tejun Heo , Boqun Feng , david@fromorbit.com, Johannes Berg , oleg@redhat.com, "linux-kernel@vger.kernel.org" , kernel-team@lge.com Subject: Re: [PATCH 4/4] lockdep: Fix workqueue crossrelease annotation Message-ID: <20170905103144.GW3240@X58A-UD3R> References: <20170901123856.p2trpebau57yxftc@hirez.programming.kicks-ass.net> <20170901163852.ckslrgldsalqmg3c@hirez.programming.kicks-ass.net> <20170904013031.GM3240@X58A-UD3R> <20170904114248.kls4jv2ggsv46mli@hirez.programming.kicks-ass.net> <20170905003844.GO3240@X58A-UD3R> <20170905070825.tovfkqvxpwosh5oa@hirez.programming.kicks-ass.net> <20170905071930.h6t2f4guvmswibnv@hirez.programming.kicks-ass.net> <20170905085727.GV3240@X58A-UD3R> <20170905093624.zlwhvg32ahkpnamk@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170905093624.zlwhvg32ahkpnamk@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1913 Lines: 47 On Tue, Sep 05, 2017 at 11:36:24AM +0200, Peter Zijlstra wrote: > On Tue, Sep 05, 2017 at 05:57:27PM +0900, Byungchul Park wrote: > > On Tue, Sep 05, 2017 at 09:19:30AM +0200, Peter Zijlstra wrote: > > > On Tue, Sep 05, 2017 at 09:08:25AM +0200, Peter Zijlstra wrote: > > > > So you worry about max_active==1 ? Or you worry about pool->lock or > > > > about the thread setup? I'm still not sure. > > > > > > So the thing about pool->lock is that its a leaf lock, we take nothing > > > > I think the following sentence is a key, I hope... > > > > Leaf locks can also create dependecies with *crosslocks*. These > > dependencies are not built between holding locks like typical locks. > > They can create dependencies, but they _cannot_ create deadlocks. So > there's no value in those dependencies. Let me show you a possible scenario with a leaf lock: lock(A) lock(A) wait_for_completion(B) unlock(A) ... ... unlock(A) process_one_work() work->func() complete(B) It's a deadlock by a lead lock A and completion B. > > > And the whole setup stuff isn't properly preserved between works in any > > > case, only the first few works would ever see that history, so why > > > bother. > > > > As I said in another reply, what about (1), (3) and (5) in my example? > > So for single-threaded workqueues, I'd like to get recursive-read sorted > and then we can make the lockdep_invariant_state() conditional. > > Using recurisve-read lock for the wq lockdep_map's has the same effect > as your might thing without having to introduce new magic. Recursive-read and the hint I proposed(a.k.a. might) should be used for their different specific applications. Both meaning and constraints of them are totally different. Using a right function semantically is more important than making it just work, as you know. Wrong?