Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1976265ybl; Thu, 29 Aug 2019 01:35:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQyF5tngwMkvyMHmpO2S9/qhypRo4njFbfNV1RRdSsafOfITMwQkdi6bGxeoNbm8LWeoFI X-Received: by 2002:a62:86cf:: with SMTP id x198mr9894999pfd.195.1567067720518; Thu, 29 Aug 2019 01:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567067720; cv=none; d=google.com; s=arc-20160816; b=ok8AdnmRR7JGekYz3UZgeEJIqUlrgNApUckNM6a4TqnHzvHWS7fT5G6ncA0y498vGH M71Aw2lMO56UMZLmMEwO1Iup3qF7c2ODW7CDTLimpXIXDW17x5hOfJ5s3QY4SvyXW2IZ L0kU7HGegeu1xv4MbUYAs3wtlqg5/D+kLfKudZGcj/8IWbPUDoyCMZvj9LHVqeckTbxz IZ4NebjC3vY4HdI0A8CNS5Rs5pmiIMUBON0PsdrSgVF9AWbfxKSv1QEZugxdyJJPJ4SF etajlI0bKdjAArw2GWR1XFoKb5/ejZlFlbhbkWvtlYwGEv0WoXmR3Ti5K86+VOM2J0kM NQPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qPoseDSzRuNPOpt9zW4ALw1+RrmLBrCqsgwnhxrqn6o=; b=zvd02GAL/HRa0OBmVMp9bq0eh3zs0QmDW0DDsXd/PHrFCCnxRY0rTI69VMDPDYWvJl I7rd0dOl9vbX3HsCJecrdR/XWJpQlnInEYNk2sXVA2u1cb6UMFY+XzRCINskWGHQVDFG weMYwph1E/y5JDV9NBlUASCmvf1GNfeRAA/WjCV2U0uOrAXi7/tYlvAiVIh4NS0QHwmK IEV7/m23o3SwTPLBKIVLkExsYFuHI5FZroLXidZyhRu/iy1Uz4ULVNP07E+LUdxHMQk1 DEckMDnW3sYsahmtFaNJjTQZpfWSG4Q3HP5JIEzf97R3Nz30gMPKhMqn2KyZjx1HzzNd Yf8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aP9ohIGG; 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 b13si1428888pgr.460.2019.08.29.01.35.05; Thu, 29 Aug 2019 01:35:20 -0700 (PDT) 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=aP9ohIGG; 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 S1728074AbfH2Ide (ORCPT + 99 others); Thu, 29 Aug 2019 04:33:34 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33378 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbfH2Idb (ORCPT ); Thu, 29 Aug 2019 04:33:31 -0400 Received: by mail-pf1-f194.google.com with SMTP id g2so1593599pfq.0 for ; Thu, 29 Aug 2019 01:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qPoseDSzRuNPOpt9zW4ALw1+RrmLBrCqsgwnhxrqn6o=; b=aP9ohIGGtJXY/hW0QfbtSz1//dgSS6Jvea1e/W2goYQ6paQp5shd/Bj9uWLrM7zGJR 0GoM2gmGHN0p9oGhFOMOBB7yAVLLQeAgq8WQROJ4cY2QE11QYxmOjYZxBocbWh+rVTgc E/EYNAgjwpVjXnN6c2pC8sbrS7kZyT1v9REUKtL0I89aE+UWmrd0hag7md5ZNWIoHhDK Oduq6FgSR9cTB/2+EaigdOgoq9qbLATh1JIeyw1DcRODjOo/o16E9+FMsoU+C6jpxdFK 7DSW4BGD/g/3n/TUYssHQ45p6fOWLg2T4DjCU0eE845nz81iJzkkSKpIIaTEKd5jxjy1 szFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qPoseDSzRuNPOpt9zW4ALw1+RrmLBrCqsgwnhxrqn6o=; b=rXyiUfcDMhPfvXUD3cX0yiSdxe1Lvm9WVmr6aEubdsX0+HagBhRVmGdRHSx7Syu4iU 00/L+8zUoTg0chNompg9jACr08P3JW7cz7Toxx7Rtw08nyZBQbuVAfmTexxkN+QfDEjr Tu6mky1UzuSKc16ytf7/kMaOrcnQ14Yc9zBBs30aNwBphdT4I7ymKq9gJo9HmNBwLL7s qQkTiQAwrX1iKrgCmXL+1zZefOUS5EiyW0RYnhDc65B91kXqhqldoiLWqWuTSWfiZCVX hBsQ/lAHAZKEH3Yw75rlFaY2ENj/XFzBvHqyOgB2grbM4hAZEBVGSairDgrRfj8iEeJF +3/Q== X-Gm-Message-State: APjAAAXAFRvw/cTOW9YskOX2oONqGyL9qvacbcV8sb70QO5WQRCDzOp3 U17cxFS558teEalzIjxX2zY= X-Received: by 2002:aa7:9a04:: with SMTP id w4mr9968113pfj.126.1567067610616; Thu, 29 Aug 2019 01:33:30 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id v22sm1260155pgk.69.2019.08.29.01.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 01:33:30 -0700 (PDT) From: Yuyang Du To: peterz@infradead.org, will.deacon@arm.com, mingo@kernel.org Cc: bvanassche@acm.org, ming.lei@redhat.com, frederic@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, longman@redhat.com, paulmck@linux.vnet.ibm.com, boqun.feng@gmail.com, Yuyang Du Subject: [PATCH v4 27/30] locking/lockdep: Add lock exclusiveness table Date: Thu, 29 Aug 2019 16:31:29 +0800 Message-Id: <20190829083132.22394-28-duyuyang@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190829083132.22394-1-duyuyang@gmail.com> References: <20190829083132.22394-1-duyuyang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lock exclusiveness table gathers the information about whether two lock acquisitions for the same lock instance can be granted concurrently. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 755b584..5c97dbf 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -962,6 +962,36 @@ static bool class_lock_list_valid(struct lock_class *c, int forward) #ifdef CONFIG_PROVE_LOCKING static u16 chain_hlocks[MAX_LOCKDEP_CHAIN_HLOCKS]; static u16 chain_hlocks_type[MAX_LOCKDEP_CHAIN_HLOCKS]; + +/* + * Lock exclusiveness table. + * + * With lock X.A and X.B (X.A is on top and X.B is on bottom): + * + * T1 TB T1 TB + * -- -- -- -- + * + * X.A or X.A + * X.B X.B + * + * in the table Yes means the two locks are exclusive and No otherwise. + * + * +---------------------+------------+-----------+---------------------+ + * | X.A vs. X.B | Write lock | Read lock | Recursive-read lock | + * +---------------------+------------+-----------+---------------------+ + * | Write lock | Yes | Yes | Yes | + * +---------------------+------------+-----------+---------------------+ + * | Read lock | Yes | Yes | No | + * +---------------------+------------+-----------+---------------------+ + * | Recursive-read lock | Yes | Yes | No | + * +---------------------+------------+-----------+---------------------+ + * + */ +static int lock_excl_table[3][3] = { + {1, 1, 1}, /* Write lock vs. X.B */ + {1, 1, 0}, /* Read lock vs. X.B */ + {1, 1, 0}, /* Recursive-read lock vs. X.B */ +}; #endif static bool check_lock_chain_key(struct lock_chain *chain) -- 1.8.3.1