Received: by 10.223.185.116 with SMTP id b49csp2126470wrg; Thu, 22 Feb 2018 08:31:55 -0800 (PST) X-Google-Smtp-Source: AH8x2269ZcPmAoCLdDvLejkB0vujUfabwibL8vMc3d6DBfsP5qEogpS94scaEjC1e7fwMGBKYJ1B X-Received: by 10.98.14.200 with SMTP id 69mr7407523pfo.168.1519317114878; Thu, 22 Feb 2018 08:31:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519317114; cv=none; d=google.com; s=arc-20160816; b=Sw6zu+VjbE3hxmasSRe2s1N5ZqK9DmD6JAA+QDDBtocT5KCE2eFMeNTH1EY9fiEEF9 MMDUI+HDtYr2Q627TeuK3iJuWXs5pgSve6G0p0hv43SuHxaxYbEjOMrj4HrdPq72hK14 5GKjSPcOUNbcqyhSS3Ljh0IsKwLCRGbGbgPFa1g7gCykRAuZjs3YeaqUcrSrFPI/JpJn /PUt8GAO50+9DtHzyDwoqTAmaILA1UoI/X//c+hkbvk+X+1zXVxk3YXQxAOWQNwMCEpn +/Ut5YgGV6gXy9np15PQ73C0ApE0UNyiBSzVqbTqUajIcOcA7Xyz8GA/6qA0xTKqYwIj X4ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=38mLDTCrdUxEEwsQ3hnUM3Yta2NDEBU9LvYVrdWMVFw=; b=KO/90wvf/9fsJc0WYIT9mRcvuSIXjWFQ1K/2jybi06LtyfA4Dub1H5zgT3Zg3EIU6j KX9JyFwTTxtcozWXbHUf/ZrXjQcPL3RwASe2W0HHFplVlXfJ6WjHa288xNPZ1oxbuyrw nyyOzDjh8JEv+hVaNDKkNqRpQcHBB6CRKlyzQpTtee9glnzJiM9+nHra96w2KmJdWuyO 8je7d4dcP8Jc/Ni87Mm76SwaRam5egE6rV0aLKW7sR0xg6nh2UolyVMYgJKoOaS4I3Fv 4EdopiGvf3KYJCue4omY0TpnzFM6YRpfZJSkvXbrSP3mEkPMwHeOqsXKZjaLxrD5MfDz RY5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f6a5jkWJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m10si13968pgq.417.2018.02.22.08.31.40; Thu, 22 Feb 2018 08:31:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f6a5jkWJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933222AbeBVQbC (ORCPT + 99 others); Thu, 22 Feb 2018 11:31:02 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:53512 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932942AbeBVQbB (ORCPT ); Thu, 22 Feb 2018 11:31:01 -0500 Received: by mail-wm0-f50.google.com with SMTP id t74so5052256wme.3 for ; Thu, 22 Feb 2018 08:31:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=38mLDTCrdUxEEwsQ3hnUM3Yta2NDEBU9LvYVrdWMVFw=; b=f6a5jkWJkJdKWt3hCbqFpLxK1/Da01v/xTSiKNAeTXc3wP05dtHEmQ7cRPQ2IuG1GF JtI8BNt6RJ4UbUVzQxLeedYd0hi788W+ixsvPRgDNtBuwFVxDiovC6WJ6q+n6wTVvpwt /Dab5lbaAwHNbWo0N1zeMRn3efTSmKgXRbgHQjE+1hDzL+Rnibcn4p2Z63XI5WV5DpM3 vz0wFSEsnCSOtbI9kWqx/2X9DB4N7YaPADW5zOkqqojwARcXPEphEn04sVWkYktMkfCr PI6TRvwnXdoqEeSumP0MEU3so08ByZ2UhfO6p5vGx1nK0mcp+T0XRdTqm4tyxID71r1E 6t+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=38mLDTCrdUxEEwsQ3hnUM3Yta2NDEBU9LvYVrdWMVFw=; b=N+fGKc7p+FAGqkw+iMiLZxjd/JW+6eCwctzKtcX46o/aJ6aeIG6pnYgODyMB/9TzWP 6VjUNCViqFKqjucHHPGhDk6YZjvM+DHXSFlIsTrS2dZUPFOjf9HaW91pLVB03xouSPZk j/R6xvA3kZCCF7efj5Vg2iJl5qfCT8C4eRtwnzmQltGgJ7D5rdSbcJHgShFdYlLxAdIL vTlqw/ieCFYJk2RFiyXvyIVhUVz7ue1yFWfff6YRYXzbOKSFnADgm97wgp9akqA8yc01 5RgFq6WEJqOJoHxZjHGSQ5mu4izfHsAbCjoIxx9wE+q1jp4igoXo54b6WS9bGZePWTNl fYig== X-Gm-Message-State: APf1xPCNQgoN09wwIHlp3U4sDThRqLkZiu1zaI34JzWjXyRnemF0XQ0y MHWhll9Fw5zUc9nDesShvcM= X-Received: by 10.80.165.84 with SMTP id z20mr10017941edb.300.1519317059857; Thu, 22 Feb 2018 08:30:59 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id s7sm497831edk.61.2018.02.22.08.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 08:30:59 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 8F0BB20D83; Thu, 22 Feb 2018 11:30:57 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 22 Feb 2018 11:30:57 -0500 X-ME-Sender: Received: from localhost (unknown [45.32.128.109]) by mail.messagingengine.com (Postfix) with ESMTPA id 0DBCD247E8; Thu, 22 Feb 2018 11:30:57 -0500 (EST) Date: Fri, 23 Feb 2018 00:34:26 +0800 From: Boqun Feng To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrea Parri Subject: Re: [RFC tip/locking/lockdep v5 05/17] lockdep: Extend __bfs() to work with multiple kinds of dependencies Message-ID: <20180222163426.fcfq6ubq25ipxhfb@tardis> References: <20180222070904.548-1-boqun.feng@gmail.com> <20180222070904.548-6-boqun.feng@gmail.com> <20180222142614.GR25201@hirez.programming.kicks-ass.net> <20180222151210.jwxjchywk4jfecyf@tardis> <20180222160811.GT25201@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="teayzfysboz73akb" Content-Disposition: inline In-Reply-To: <20180222160811.GT25201@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --teayzfysboz73akb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 22, 2018 at 05:08:11PM +0100, Peter Zijlstra wrote: > On Thu, Feb 22, 2018 at 11:12:10PM +0800, Boqun Feng wrote: > > On Thu, Feb 22, 2018 at 03:26:14PM +0100, Peter Zijlstra wrote: > > > On Thu, Feb 22, 2018 at 03:08:52PM +0800, Boqun Feng wrote: > > > > Now we have four kinds of dependencies in the dependency graph, and= not > > > > all the pathes carry strong dependencies, for example: > > > >=20 > > > > Given lock A, B, C, if we have: > > > >=20 > > > > CPU1 CPU2 > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > > > > write_lock(A); read_lock(B); > > > > read_lock(B); write_lock(C); > > > >=20 > > > > then we have dependencies A--(NR)-->B, and B--(RN)-->C, (NR and > > > > RN are to indicate the dependency kind), A actually doesn't have > > > > strong dependency to C(IOW, C doesn't depend on A), to see this, > > > > let's say we have a third CPU3 doing: > > > >=20 > > > > CPU3: > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > write_lock(C); > > > > write_lock(A); > > > >=20 > > > > , this is not a deadlock. However if we change the read_lock() > > > > on CPU2 to a write_lock(), it's a deadlock then. > > > >=20 > > > > So A --(NR)--> B --(RN)--> C is not a strong dependency path but > > > > A --(NR)--> B --(NN)-->C is a strong dependency path. > > >=20 > > > I'm not really satisfied with the above reasoning. I don't disagree, = but > > > if possible it would be nice to have something a little more solid. > > >=20 > >=20 > > What do you mean by "solid"? You mean "A --(NR)--> B --(NN)-->C" is too > > abstract, and want something like the below instead: >=20 > The above description mostly leaves it as an exercise to the reader to > 'proof' ignoring *R -> R* is both safe and complete while that is the > main argument. >=20 OK, so I have some 'proof' in patch #16. I could move that proof in the commit log or merge that patch with this one? Regards, Boqun --teayzfysboz73akb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlqO8Q4ACgkQSXnow7UH +rgVwgf+LRmoCdppTtUO5/xOARdx4mEcWipD9wS6C9aXQNA+w2s20O7IsAj5bFL+ KvdI9c9lQsL4CDbu0kcfa9WkvlGtTLvVxmx9f4hghJBOWTeOckHKpSuKkc4fmhcA uoIePgIzjwRddutY0Fy/VkqRj/6gJiQ7fzL8bCJ+xQfnt1bulzq7jIkvyfKDzU30 g7axpUpZZ5WwaZaXRdUeFr3ZIJitJo7b2p9apN5TB0Ue34hPS0qoOVdeOdFth8rJ +tMsIunU+4OoD/+mQ/2BnWiZEI4tMQqc8VgAsupSTVo/n5APvCqAj+0klTz0Cb9l MMvBpTvU5T5wvpo3Jl7gBRL8wyNNUA== =mUwR -----END PGP SIGNATURE----- --teayzfysboz73akb--