Received: by 10.223.185.116 with SMTP id b49csp1586808wrg; Fri, 23 Feb 2018 23:28:30 -0800 (PST) X-Google-Smtp-Source: AH8x226nlOlW0/A3EFys1Eu4o433MKjFe6FkwmRELvOjdjVi4PKw97e4WnQvdb0aYjVmN4LUxjKN X-Received: by 10.98.210.70 with SMTP id c67mr4195638pfg.164.1519457310540; Fri, 23 Feb 2018 23:28:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519457310; cv=none; d=google.com; s=arc-20160816; b=P2ZAWIvywRWpRrqsEEOfiuy/PypnFUjmWlFYK3PvDqUZjRXsAVG42QmQG7FNhevXtK hYIXAATvSmyIO2GnD8XvWGG7U0fG79iZamrioR0UDn1CzLOQfphAAds8dv6vCCi8lA34 kqNi0cnSUP/q/0KOdcSrDy4OHX4LaaPitIGeAi8AP7MqDJO7rmewYA4cSh5Qq4Y71RuB cqmqF1sqxjxJCJRqlG9BHvBDocSoKtginhA3ofGVEyQ3SMeo33BWOC6C7nbmg/5nx9n7 EV9dwnJy0K5H7ua37PZ4tD3wnwJWJSZoqNmuVrwM4uf6FClFDwaknn+ImMEKvRGRHJk7 //QA== 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=8RklcttJR52oOtkiDiaIcxG30RyEg+uAI3D3FEjmNtQ=; b=KpOffWJ7T+6VsIRuucrK7vVERdW7l0HuQNVsqjTDGwZISjPu4cdTeV3CYOaDwEe1oo fJ2jtTCj8zVY+O6GzRWlokxrhnxktLcF0HBbQnXKKs89L8fAG11oqUIEVXVRVwpW5sFQ 6QTac3D5Gm0DOwCjFcHAPKFAv5MRYkKZ2mqclwG0aGPANXZj/Pb/PShW1jnnxUoKj38l l5Cd++AdXNvaFGTP86BdIBKGZ9uAeb9dBiJM415nGTW/X1V2c3bhq1AGU+9IPcpadAlu VdARbECRjbS+oU0JLPTkGDoed97/ihCL5z1F4iI/z6IrhSWNJ064ciHNLLdo2GO8Vg+f Qa2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aKkZcGgo; 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 e6si2595319pgt.198.2018.02.23.23.28.15; Fri, 23 Feb 2018 23:28:30 -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=aKkZcGgo; 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 S1750998AbeBXH1g (ORCPT + 99 others); Sat, 24 Feb 2018 02:27:36 -0500 Received: from mail-qt0-f176.google.com ([209.85.216.176]:33426 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737AbeBXH1e (ORCPT ); Sat, 24 Feb 2018 02:27:34 -0500 Received: by mail-qt0-f176.google.com with SMTP id a23so961625qtn.0 for ; Fri, 23 Feb 2018 23:27:34 -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=8RklcttJR52oOtkiDiaIcxG30RyEg+uAI3D3FEjmNtQ=; b=aKkZcGgoTUICqh2ix8KnWD+EG6iw/1On8HwJQbkfkGv5yfpBQgNDuojOJZpOYTm2Vy 3D3rH7KTV2LIFE/ZfTcyKJJcK6WYLf3PZdX6zj8iWeX8N4taljbabeZE6trhLdT+jZxs rADzHSaUAWjv/SHTeEA6WKOBGigCYpyeC6DRrDH/Ns3n98MChzS/drYImg03JqJvRsVE HOg81VkDpEX8IEdqDK5HLv/ijDR7M0rTvbbo+fd/Neps2TrGGxx1M43h7/dLWJZmGp5W OPcb2Ahc7YNOBv0jI2VikZPl4hhRaFy1J+W8EynQhR9vKb2Ost760omYlQ9whW1n704U bobQ== 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=8RklcttJR52oOtkiDiaIcxG30RyEg+uAI3D3FEjmNtQ=; b=brFYOGTC4Hqfh+TSqPSd+WTtv4N7aYKe+/5YZOChj5ZqHzwDNXv6cyvZ3phdl1Ryi1 AJhkZyP1MbeqdiwJiSnbhqjUh6Ty8SuMBG4ODRIYTiIKKzk5LTYwfkqgEc9bTaBWOq+a Clg8bAWOX27YybplgUKA0flIz11SDuoNxjSKWlncoah9zEiR0/xwj+8yNiZ6S/HHmVgs S7LbB36TYIPdaYLxHAZCfW4B1GNDuPRNIeYZohJMWZtWqUaUXqjllv2AXg1BcZPJ9urF CcHUDgjnwFISRLBBgqqyzvZIsHv7i0geCVIbJcfnv9Zu+AmkKDUrWNvZLn91VmtmsQGy B0nQ== X-Gm-Message-State: APf1xPCtTCXL96fl6ts8QBpN2OczgWPZZu1bcNlw/SEza1PAM4jY6HWS hd5FwKBQfotQW0GhW8hrznDvaBX+ X-Received: by 10.200.11.13 with SMTP id e13mr7103856qti.340.1519457254241; Fri, 23 Feb 2018 23:27:34 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id u71sm2590204qki.51.2018.02.23.23.27.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 23:27:33 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id CEAC720B19; Sat, 24 Feb 2018 02:27:32 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Sat, 24 Feb 2018 02:27:32 -0500 X-ME-Sender: Received: from localhost (unknown [45.32.128.109]) by mail.messagingengine.com (Postfix) with ESMTPA id 458D67E3FA; Sat, 24 Feb 2018 02:27:32 -0500 (EST) Date: Sat, 24 Feb 2018 15:31:01 +0800 From: Boqun Feng To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrea Parri Subject: Re: [RFC tip/locking/lockdep v5 04/17] lockdep: Introduce lock_list::dep Message-ID: <20180224073101.2eylqelqzmszm4ee@tardis> References: <20180222070904.548-1-boqun.feng@gmail.com> <20180222070904.548-5-boqun.feng@gmail.com> <20180223115520.GV25181@hirez.programming.kicks-ass.net> <20180223123732.acxbavnf2ktd4lzl@tardis> <20180224053250.ketrlbq4gtx573qo@tardis> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="syyq6fb6s2xyxvvg" Content-Disposition: inline In-Reply-To: <20180224053250.ketrlbq4gtx573qo@tardis> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --syyq6fb6s2xyxvvg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Feb 24, 2018 at 01:32:50PM +0800, Boqun Feng wrote: [...] >=20 > I also reorder bit number for each kind of dependency, so that we have a > simple __calc_dep_bit(), see the following: >=20 > /* > * DEP_*_BIT in lock_list::dep > * > * For dependency @prev -> @next: > * > * RR: both @prev and @next are recursive read locks, i.e. ->read =3D= =3D 2. > * RN: @prev is recursive and @next is non-recursive. > * NR: @prev is a not recursive and @next is recursive. > * NN: both @prev and @next are non-recursive. > *=20 > * Note that we define the value of DEP_*_BITs so that: > * bit0 is prev->read !=3D 2 > * bit1 is next->read !=3D 2 > */ > #define DEP_RR_BIT 0 > #define DEP_RN_BIT 1 > #define DEP_NR_BIT 2 Oops, to make the following __cal_dep_bit() works, we should have: #define DEP_NR_BIT 1 #define DEP_RN_BIT 2 instead. Regards, Boqun > #define DEP_NN_BIT 3 >=20 > #define DEP_RR_MASK (1U << (DEP_RR_BIT)) > #define DEP_RN_MASK (1U << (DEP_RN_BIT)) > #define DEP_NR_MASK (1U << (DEP_NR_BIT)) > #define DEP_NN_MASK (1U << (DEP_NN_BIT)) >=20 > static inline unsigned int > __calc_dep_bit(struct held_lock *prev, struct held_lock *next) > { > return (prev->read !=3D 2) + ((next->read !=3D 2) << 1) > } >=20 > static inline u8 calc_dep(struct held_lock *prev, struct held_lock *next) > { > return 1U << __calc_dep_bit(prev, next); > } >=20 --syyq6fb6s2xyxvvg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlqRFK8ACgkQSXnow7UH +rjx6AgAmqvbxr2uys+7crIa5r1C+Sr5v+LjaefOjQc2s5N7joFdsFaKQTDKpnbM kcN6Wv0gBJNKO5YTYvFlTTVQhIIQzIiYfAv9F+t00VxwI3opOwxbxDziMEtQkC+m eHkSZ1z/t2K6C6mWDO9LbUuubk6nieFdHuHqbrxzE0HDp1RInOwIXlC2z9iOf4k+ GD5EfJZmfslxrdsm/ZsFJmAsjgcMsYdliXscRW6N9kXItkC0arXNmNOP4DXUhWTZ c6RQfhyrvuNpc0fF/0oGLC6gTkXbTOgxhNy/bhdwhilUzk1A06cy+Pqe23gONpki ffdAPJJSTEhnhATE6jquqMHR3bcwFw== =FPN2 -----END PGP SIGNATURE----- --syyq6fb6s2xyxvvg--