Received: by 10.223.185.116 with SMTP id b49csp2068938wrg; Thu, 22 Feb 2018 07:42:19 -0800 (PST) X-Google-Smtp-Source: AH8x224rEdhXuUzv5xG12mV+uRKV+CGoY5oJLRHOwYkpVO8z5ESE09tUWg4I1Z0fBh43hmLAqV8u X-Received: by 10.99.122.86 with SMTP id j22mr6004917pgn.351.1519314139585; Thu, 22 Feb 2018 07:42:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519314139; cv=none; d=google.com; s=arc-20160816; b=wYqOLiUk7Gqzo7Ky5dU6ZFIrh2xh7Et/NGupmNnW9pDT3UC+/hlENY/LkucVDzlI5x VjFvTb0eaq5Z9XfOvO9OVo+yNOsRhCxNybm+/3AGu7pRWTQdOjEdCFrqRtNEp2Zp5wLy sixSbQo4MNhhBuL7E+trBgGMv6GPmIhI+mM8FejLLHJShpGSKBV6AYFkIIlQ3/GFY/hK vl4wiMu9DZ6Vd+y1sFv+nGW8TB1aalThkoBoOlQ2jpjJY/BZKgcc8q4TxB3R0XjRDDgm +n/QK+/lUrIsmF2Lf5AabAYEr04vdRo5fS88of0PUEM/Rcm3MQSaY8HS6sHCW5+dY5CR ZYMA== 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=iGy2ifSY3vhXrhj6FNQuKABfRvT2AWTw4SoXvSMjOi8=; b=GoZeT/LrSXkcmSHCUEaNgUqR7w19MzJlRaz54O3VVwRGBOkWLTfuebW7cDTRN/xiQf XUVEEDeFy4fUAmZhuWK+IMfZcEsTSQy2I23ibSkW9kYuNV0xNiQYiBPtPWcKGqXFHsgS TimTvGins9hl2UwTq+W0cblRQ36hu8wq3vrBvwyc/33oInR7VuukDXwMPQ3kRtBuxksk IK93fFTtvwPLo4L1qY744B58mkoQD5OFGZ/vbIjEOS7Uiba9S0732AqTKLDYCUfxsW2b Ktr/yd2JOCrn8/aKxvv/goQ0wTDHDdJfVQozN+uMySxnNYCKCga+JUqBfFfZPEbuPWft E+QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hotcI131; 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 v24si204491pff.274.2018.02.22.07.42.05; Thu, 22 Feb 2018 07:42:19 -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=hotcI131; 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 S933037AbeBVPlb (ORCPT + 99 others); Thu, 22 Feb 2018 10:41:31 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:37874 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932914AbeBVPla (ORCPT ); Thu, 22 Feb 2018 10:41:30 -0500 Received: by mail-ot0-f195.google.com with SMTP id e64so4979132ote.4 for ; Thu, 22 Feb 2018 07:41:30 -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=iGy2ifSY3vhXrhj6FNQuKABfRvT2AWTw4SoXvSMjOi8=; b=hotcI131V6x/YL0bgd4mJtKmQvAMF8/FLTaFlPNP+DS87pnqnoAjx9015JMZk4PGEf z9RDRVFtpsqcKJnO12Ok/leFurzUtyXby2XW2swn1/iFHYEaO3LLOIombro65b+U7MiB eeTL4ntGA2VBDQbP8ZW5/LUG5kOd0c7Yr8o0QNi+QVF1ZjCMBr5Ox59lExdXozQuLW0Z 58bvlYx2J8zF2LEWXYEQvu8sVYWeErSbvgY88W/8efCRpztNFDCRNoQ2bnQ9KiiQhcti WUKyF3c8GG4+H1uHQ6mVZUfJjPE5cnhTJPAWRadGHkZvLKNOJ9pf0JvMtMkwOrw0DguF JTnQ== 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=iGy2ifSY3vhXrhj6FNQuKABfRvT2AWTw4SoXvSMjOi8=; b=P3kAJEv25aoxkYvUZExo51iGTZMdDZLTr/IqmJKLbiWMOBOu/YighASrhGBsLjkYIi yFHvM8FOB2PidldzawI7m1a9w06p4fJ+rexJwPiqAkCDfhWYPTXkQIfBAWm15lfNCpoi bnWBJHTHK7fWqTjTHgnjuMdwZiI8QqqW6+88cDr5gHfx0+yQ9wjUc5f0ydO7NHNAsdLn 4U52ABcovzcJH82kshYZiLltNnfED9wHM9yxTBinptjL1fcTj6US5OTQRD0Wgyw412Af /pP9NlLnxVHDsuS8y4jwdg6fnYMf192BwVkD/c6Y/C2v6LGdCFdI5VpnIuCmPPf7vx40 TE0Q== X-Gm-Message-State: APf1xPAa+7WZckC8C9mGUYxnlV2r2rY+KQKIzvKF9Aprr75FnOgeElAR Gs7z2zMZIZ53VdpZUNrzUwM= X-Received: by 10.157.40.231 with SMTP id s94mr5103720ota.36.1519314089609; Thu, 22 Feb 2018 07:41:29 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id p205sm139488oia.41.2018.02.22.07.41.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 07:41:29 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 745F321498; Thu, 22 Feb 2018 10:41:28 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Thu, 22 Feb 2018 10:41:28 -0500 X-ME-Sender: Received: from localhost (unknown [45.32.128.109]) by mail.messagingengine.com (Postfix) with ESMTPA id B8D2124505; Thu, 22 Feb 2018 10:41:27 -0500 (EST) Date: Thu, 22 Feb 2018 23:44:56 +0800 From: Boqun Feng To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrea Parri Subject: Re: [RFC tip/locking/lockdep v5 06/17] lockdep: Support deadlock detection for recursive read in check_noncircular() Message-ID: <20180222154456.eno5mvqzvdamvqdx@tardis> References: <20180222070904.548-1-boqun.feng@gmail.com> <20180222070904.548-7-boqun.feng@gmail.com> <20180222145434.GS25201@hirez.programming.kicks-ass.net> <20180222151626.GU25235@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jyfylvghwdp4e52z" Content-Disposition: inline In-Reply-To: <20180222151626.GU25235@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 --jyfylvghwdp4e52z Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 22, 2018 at 04:16:26PM +0100, Peter Zijlstra wrote: > On Thu, Feb 22, 2018 at 03:54:34PM +0100, Peter Zijlstra wrote: > > On Thu, Feb 22, 2018 at 03:08:53PM +0800, Boqun Feng wrote: > >=20 > > > +static inline int hlock_conflict(struct lock_list *entry, void *data) > > > +{ > > > + struct held_lock *hlock =3D (struct held_lock *)data; > > > + > > > + return hlock_class(hlock) =3D=3D entry->class && > > > + (hlock->read !=3D 2 || !entry->is_rr); > > > +} > >=20 > > Bah, brain hurts. > >=20 > > So before we add prev -> this, relation, we check if there's a this -> > > prev relation already in the graph -- if so that would be a problem. > >=20 > > The above function has @data =3D=3D @prev (__bfs_forward starts at @thi= s, > > looking for @prev), and the above patch augments the 'class_equal' test > > with @prev not having read=3D=3D2 or @entry not having xr; > >=20 > > This is because.... (insert brain hurt) >=20 > (hlock->read !=3D 2 || !entry->have_xr) :=3D !(hlock->read =3D=3D 2 && en= try->have_xr) >=20 > hlock->read =3D=3D 2 :=3D prev->read =3D=3D 2 > entry->have_xr means the last fwd link has read=3D=3D2. >=20 > Together this gives that: >=20 > @prev (Rx) ---> X ---> @entry (xR) >=20 > does not form a cycle, because: >=20 > @enrty (xR) -> @prev (Rx) >=20 > is not strong and can be ignored. >=20 > Did I get that right? If so, the Changelog needs serious help and code Yep.. I was about to rely you with something similar.. I will add a comment for this function and other "brain-hurting" functions too. Sorry for the headache ;-( Regards, Boqun > does too. --jyfylvghwdp4e52z Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlqO5XIACgkQSXnow7UH +rgUCAf/dIl8it6X5fj1eyAowuIkFbtwhz4wmweN0boeyKv6VLf2IOKjUfdbOhO0 N5LgCJIIbuILZO+aAN0ShMDW4MiTFuVmsPOm1KhE4Brhta7dzoOgh7QfTGYUHcr1 QxGVW9jqQKtRhD0e/W6+DLYwpckgN2YY1XZrBNw+f1SE7o0kmY1TGuic6j7M3vAo HOSkxW9VfvVfLE4moWdx5UFNu1DkP7mgDKrylvJrSZNzDrNSCsq3Ia4AYBt55ar3 T/VPyMn6uS/j/zrZHpZmUPV+ohj2BhmPVR22nYtk8t3huXnG3O7M8bpf7Q0GhcXK qcY2twKcFD8YhMd9Y4svGKl/diX+DQ== =Rx22 -----END PGP SIGNATURE----- --jyfylvghwdp4e52z--