Received: by 10.223.185.116 with SMTP id b49csp409483wrg; Fri, 23 Feb 2018 00:19:53 -0800 (PST) X-Google-Smtp-Source: AH8x225t0QU82KZAAQ6YdNZ+iSiNjBJqZddbKM5rdpVWk2KaTREGdXagqoTYJH9m+FB1EtHqaEO0 X-Received: by 2002:a17:902:b185:: with SMTP id s5-v6mr951423plr.109.1519373993503; Fri, 23 Feb 2018 00:19:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519373993; cv=none; d=google.com; s=arc-20160816; b=YM2mTjJdDV7sSPPtC0X6bvfPw+VesfcuyvEgg7n7Tsmc4/7jmg6rO39t8rmEwkqKe8 eR8RJgILAkwegp29n1wyQcFce1TSebECRZ5wuXmxAtNZnEfSV3vWGgWKNxHKwxB5xdAI J0OypcRCPTAIJF1TB9YPi5waQam4heUDWswXfsaSyZX8Ot0Umx3JRz3MErMWLK9BXnSL m/Apud4gL/aqGyA2nJsJTbMd7i9IaJOPRdfKE+8okNX6YDln1+lDKKR1UEgGf3ycDtSU 5dB2Roi6/mTs9jNjWSjEn7Mvtnymy6baMIXtiv4/rWqz95LA4wxoJMveCrlaHtKL8hv8 lWew== 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=pixHcJ3U+jvCp96obB6K8PQhuuDZAT6+xUYWa0WQUTY=; b=FWvQHIwiZ5TkDRoJ5LyHTRGKlY7rdo0yolgRPtANFOYVRutBpn6N4TC/dE7ycstrtz 0AKku5OR4Hifz/cI/P9Lo2Yz9uY+ncVZb7sgaif7X0y+7faw89RHj9I4eMtxmtycbFTm YxINuGsMxpgW/3a120BOuL5nXKpG7mjZzSWAjtf+Wv4P5k2xhs3NIZWJYHJTxdt6AO2X DLGX9W72zwdEhPQtX28WdxeecsLjVZtx9+aytSTYPEGRzghiwnOMUQ5UohQwqHB1BdW5 HvolgiKPbI3ZK0Kt1cKoEYjU8lM/3Kx3O3MelLEk1+i/G25PItjnQjDk1QFYa6rsQvbS 0c5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F+uPsl0d; 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 p29-v6si1485621pli.731.2018.02.23.00.19.39; Fri, 23 Feb 2018 00:19:53 -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=F+uPsl0d; 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 S1751422AbeBWISO (ORCPT + 99 others); Fri, 23 Feb 2018 03:18:14 -0500 Received: from mail-oi0-f53.google.com ([209.85.218.53]:40824 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751276AbeBWISN (ORCPT ); Fri, 23 Feb 2018 03:18:13 -0500 Received: by mail-oi0-f53.google.com with SMTP id c12so5536784oic.7 for ; Fri, 23 Feb 2018 00:18:12 -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=pixHcJ3U+jvCp96obB6K8PQhuuDZAT6+xUYWa0WQUTY=; b=F+uPsl0dKnO0vg772vO8PRz+3v8bx4cMlJy97pc53ZKJaitEyS6i91hu63dsqa0NGU 0lcNEBPypScMLJNEv+Xak2XVhIv5E53GnCJ3FvQifdvKQMkgTtUwB+sJEV9tRfS0V5Eo g0NC8MPObu/M62lH06luv5m5y1eWz2L07/phbvaawJNl0bhezfz0a0N+ia7jF5NZZg8U U/rT83eJAfIUatL6IvL9POR8CqPtWmCPbmiN6Ae7LE4NMinpHZiBNJl9OLMHOYxxcU99 nlbs1ANdSue9yZDxwOY9D6AugOuSIvOVkzpbnl8mYer1bYfpH+Fqz1dbOAzfWxjerLGm KBeQ== 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=pixHcJ3U+jvCp96obB6K8PQhuuDZAT6+xUYWa0WQUTY=; b=SV3sdspVo4unRxEr5eIyt0lcGRHNu1Yj7O17qpCMTB3e6goMSqoiS1lkwUzUAf3qxe TRHhI+pFQTsQuJANQ6lnyGnRHVNBBpVQZMGG5KI1pEzPU75+vh6VkICzuTlcf9g+u1KN r5tN1NidpxjvRIQZem/SVG4dRMB9GPqi1npt4Qcceqw4AtxFP2rNnei4iHM6tQfprIrw Tdr/pPWRPxSVdrGk2EGL35nHk+i6T8Gkk4C/rOZ7w2ClvnLYrYA/yDEqrGc4jeR+RGBI JM48XP/EyfYRtH5jZcdlg/PSXdBi1WnmZC6JeWWNRHO/nAAifeVHgSMi9L09xwJU2Rmh 0BJw== X-Gm-Message-State: APf1xPC6VEjPP+O9eOmJ8Tq3xpAW+FIktXpKhVffV7jNhhmfGUYi+mWj nbrPGoPgXRCg5eCuUuPFOc0= X-Received: by 10.202.179.65 with SMTP id c62mr458461oif.8.1519373892494; Fri, 23 Feb 2018 00:18:12 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id m29sm1058063otj.44.2018.02.23.00.18.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 00:18:11 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 5B00920D90; Fri, 23 Feb 2018 03:18:10 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Fri, 23 Feb 2018 03:18:10 -0500 X-ME-Sender: Received: from localhost (unknown [45.32.128.109]) by mail.messagingengine.com (Postfix) with ESMTPA id D53DC7E0ED; Fri, 23 Feb 2018 03:18:09 -0500 (EST) Date: Fri, 23 Feb 2018 16:21:34 +0800 From: Boqun Feng To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrea Parri Subject: Re: [RFC tip/locking/lockdep v5 08/17] lockdep: Fix recursive read lock related safe->unsafe detection Message-ID: <20180223082134.ykkbzqj2h7glxrqn@tardis> References: <20180222070904.548-1-boqun.feng@gmail.com> <20180222070904.548-9-boqun.feng@gmail.com> <20180222174654.GW25201@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dtotlwrbdxf3mtth" Content-Disposition: inline In-Reply-To: <20180222174654.GW25201@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 --dtotlwrbdxf3mtth Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 22, 2018 at 06:46:54PM +0100, Peter Zijlstra wrote: > On Thu, Feb 22, 2018 at 03:08:55PM +0800, Boqun Feng wrote: > > There are four cases for recursive read lock realted deadlocks: > >=20 > > (--(X..Y)--> means a strong dependency path starts with a --(X*)--> > > dependency and ends with a --(*Y)-- dependency.) > >=20 > > 1. An irq-safe lock L1 has a dependency --(*..*)--> to an > > irq-unsafe lock L2. > >=20 > > 2. An irq-read-safe lock L1 has a dependency --(N..*)--> to an > > irq-unsafe lock L2. > >=20 > > 3. An irq-safe lock L1 has a dependency --(*..N)--> to an > > irq-read-unsafe lock L2. > >=20 > > 4. An irq-read-safe lock L1 has a dependency --(N..N)--> to an > > irq-read-unsafe lock L2. > >=20 > > The current check_usage() only checks 1) and 2), so this patch adds > > checks for 3) and 4) and makes sure when find_usage_{back,for}wards find > > an irq-read-{,un}safe lock, the traverse path should ends at a > > dependency --(*N)-->. Note when we search backwards, --(*N)--> indicates > > a real dependency --(N*)-->. >=20 > This adds 4 __bfs() searches for every new link. >=20 > Can't we make the existing traversals smarter? Haven't really thought this one through, I will try. But as you said, we only need to do more searchs for _new_ links, so I think it's the slow path, would the performance matter that much? Regards, Boqun --dtotlwrbdxf3mtth Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlqPzwoACgkQSXnow7UH +rh6QAgArkGyNAaOMLnM9izFG+5uV8emZODNFcxjoYqZx0Qfw/0WGHPEdRxLU0U5 Tf8PhdKFirVAPwiybguC07L8h6VvjjoeF5/2Jx+ZC3wquAM5fJz+5+b4keWf4tCT WX7kIhJgZO9pvNOIcCnd1zEcL0Sdsd47et6zRAjCL8fO1Lmqaqned+egwpl+HTTt t/2V/0+iMj+XMu8dQEGiYYQiMkCyeTnyXL0xK4bGMRoRTR68kilCI7BrHpbipulJ kNUimxUAmxsHjSDlu1tHeW1+wI7NbcrlDzi9mcXOM6P3YCXKyVYK7nq55dJZT2N/ lY+veJyqUxOQH4pEpxsZhmWTbQNR9g== =7FJK -----END PGP SIGNATURE----- --dtotlwrbdxf3mtth--