Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4934311yba; Mon, 13 May 2019 02:18:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQfPwTD/0PYqutPCsQMCMvYMkXZKILeCYjXWdfh91+qQWoHJXUiKejJV9hSJjno3pIC2bJ X-Received: by 2002:a17:902:b108:: with SMTP id q8mr24049404plr.110.1557739138036; Mon, 13 May 2019 02:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557739138; cv=none; d=google.com; s=arc-20160816; b=hNGjVATSXW6s8GOn93A2X8+qUeq67iz4wNdmD6Frp6kj/EamrUsQIroPOoM92kKroh 5rOSnLm/8p+nIymWecp1SNOtcxcS1ZgrSLVwE3XTfbHdx9Z6QWOENIU+FDDuLi315CVx /vBhYJo0soG+8lEM7c7LtdTxBV++mBbSKisosabnhJCzF+KJVF6Fcu7CnjJyoK2RN2UT QM/gdPDoE9QY2ufOxICDzpIr8/C8T7lQHR599C0Iez1mtjSyGQnlI2ps+IRKidtBAnXR WtzBu9BgFXmH6k2KcvehcCgEiAaWI2MpQAtNDgNcC3iKrsRZacexfQxXt9qnTGl/uLyp U/gQ== 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=cLJ1ldOM7IleRggUIq7aKinRSCo8rE9wEnfY75h347Q=; b=y1HsCSU4YuBTKB6U9bBjLt84/bf969AR0GFPj6Tz+GyZRaGjLPpyFVJTedyQOjQVYu C3zPydHOdkEUH/6M7x+Nj8+ieIVLQaUo5z6spwFQ/ov2xlp1UAo1Nv6WpxZkn/GmvIKW K/8nSFnQyJTy8E6rvo+NxcpB/6K5Cdl1sSI13iU3Nrpekgx18mAuU1/sve0JcLvBrPAA c8VHdMdQIFhhlOX6j50qp3KlBcNfewC1tj5vkOd7rw2rnz3+V82vYKDmey2nz49x3IRR CC4uXYNeR/UneDv37ebEKdNl5zp+GgSmvzYdaXwXkRE5HJKLlchktNzbJ6zqmPJT4aHj dDLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ACv6VZoW; 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 r140si14875560pgr.585.2019.05.13.02.18.42; Mon, 13 May 2019 02:18:58 -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=ACv6VZoW; 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 S1728666AbfEMJNh (ORCPT + 99 others); Mon, 13 May 2019 05:13:37 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42194 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728657AbfEMJNe (ORCPT ); Mon, 13 May 2019 05:13:34 -0400 Received: by mail-pg1-f196.google.com with SMTP id 145so6445951pgg.9 for ; Mon, 13 May 2019 02:13:34 -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=cLJ1ldOM7IleRggUIq7aKinRSCo8rE9wEnfY75h347Q=; b=ACv6VZoWCPqFKrhwTkbqNjypin55cwcva3nJN9j4cbou2rAm8cv4A+Q0q5foEgv9/R 35gyirq/JzkgED9/XzY7kFXu30fpoVvj1DgVJD8FVvX6sVVrQvgBYpubW9cFOIww8Bsc Rs8oeHlDp/hff70dYy7vjWftm3b821vYtHy6cGSX8ohNGrlte5n9sz1xcSg9H/psuLXr fwDS3HX7Jtfq6xrx7g2xQ9CYHCfUIJk2hF6jcyoLpWf0Yhq6sOaZRFOuo/pHDC+z1sr3 cAxIQo/d8oFLW7jeYg4IznZiEc/gbvYRwBsgeBIixEtTcPq1Ka9H+CzwLjg2qshYkw/h UaKw== 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=cLJ1ldOM7IleRggUIq7aKinRSCo8rE9wEnfY75h347Q=; b=jWNTkFLAkMS0fSow8hD9labgMLO/iCWeLh6XljP5SZ+ynj+ZEOsNORCBYYcLSv6FLX iyx9+jVV2hUEsDMC7Ir8qqIk7bL47e9jvo7jFTmVQGD7M9ThfWk23s6T76lTz9PvHY7A 9pQs1kxxCR1FI8CrEGHLwOZdUA0c8LmCXTmI0ULwkQXx4OJzHkflVK1KHI66sAN4SXa2 qdoYV52qPm3RQYighU2thNiwaX3wrBytl6dZ8U/qC3frvqT7YsP4hasFY4dv9fQ7bc1i EnvrMcunbukbmnsLR5HF2nCa9xHrb388XPmoraHEkAmpaPFI7i5SCsJDpnebvVVAaENI QxuA== X-Gm-Message-State: APjAAAUKawmsJD1+SiLuED5Y6bOmYZ65k8OMugoF1/S5VI2XjSOJe3r8 /96cMkFtNTm7P9Qsfeg+4a8= X-Received: by 2002:a62:3381:: with SMTP id z123mr32660077pfz.42.1557738813792; Mon, 13 May 2019 02:13:33 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id n18sm35500837pfi.48.2019.05.13.02.13.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 May 2019 02:13:33 -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, boqun.feng@gmail.com, linux-kernel@vger.kernel.org, Yuyang Du Subject: [PATCH 05/17] locking/lockdep: Rename deadlock check functions Date: Mon, 13 May 2019 17:11:51 +0800 Message-Id: <20190513091203.7299-6-duyuyang@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190513091203.7299-1-duyuyang@gmail.com> References: <20190513091203.7299-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 Deadlock checks are performed at two places: - Within current's held lock stack, check for lock recursion deadlock. - Within dependency graph, check for lock inversion deadlock. Rename the two relevant functions for later use. Plus, with read locks, dependency circle in graph is not a sufficient condition for lock inversion deadlocks anymore, so check_noncircular() is not entirely accurate. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 27ca55f..4adaf27 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -1771,8 +1771,8 @@ static inline void set_lock_type2(struct lock_list *lock, int read) * Print an error and return 0 if it does. */ static noinline int -check_noncircular(struct held_lock *src, struct held_lock *target, - struct lock_trace *trace) +check_deadlock_graph(struct held_lock *src, struct held_lock *target, + struct lock_trace *trace) { int ret; struct lock_list *uninitialized_var(target_entry); @@ -2385,7 +2385,8 @@ static inline void inc_chains(void) } /* - * Check whether we are holding such a class already. + * Check whether we are holding such a class already in current + * context's held lock stack. * * (Note that this has to be done separately, because the graph cannot * detect such classes of deadlocks.) @@ -2396,7 +2397,7 @@ static inline void inc_chains(void) * 2: LOCK_TYPE_RECURSIVE on recursive read */ static int -check_deadlock(struct task_struct *curr, struct held_lock *next) +check_deadlock_current(struct task_struct *curr, struct held_lock *next) { struct held_lock *prev; struct held_lock *nest = NULL; @@ -2480,7 +2481,7 @@ static inline void inc_chains(void) /* * Prove that the new -> dependency would not - * create a circular dependency in the graph. (We do this by + * create a deadlock scenario in the graph. (We do this by * a breadth-first search into the graph starting at , * and check whether we can reach .) * @@ -2488,7 +2489,7 @@ static inline void inc_chains(void) * MAX_CIRCULAR_QUEUE_SIZE) which keeps track of a breadth of nodes * in the graph whose neighbours are to be checked. */ - ret = check_noncircular(next, prev, trace); + ret = check_deadlock_graph(next, prev, trace); if (unlikely(ret <= 0)) return 0; @@ -2983,7 +2984,7 @@ static int validate_chain(struct task_struct *curr, * The simple case: does the current hold the same lock * already? */ - int ret = check_deadlock(curr, hlock); + int ret = check_deadlock_current(curr, hlock); if (!ret) return 0; -- 1.8.3.1