Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1974239ybl; Thu, 29 Aug 2019 01:32:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaUl8ID1h3Q4VKD/jLen90cblAy0FxUsAAnXf8xTd4dsSqley59WCZfN06vei3rXKphc05 X-Received: by 2002:a62:37c5:: with SMTP id e188mr10071845pfa.207.1567067579137; Thu, 29 Aug 2019 01:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567067579; cv=none; d=google.com; s=arc-20160816; b=HZMzTz7aoqsbDV/ePdoOJKDDBHm8VoDLIkHbNFNbCxG5StrEHIWlqxApJbj8ToTBnV DsWFogxfS0mHV4PAtnf2jOYNOKmEP6RorgbBOYhY1IHqdrGl1oX0x/omvP6BomN7pFbq +QToDtGakwCKL8KAz6i6E1XWXL3ISXrdGzcWEb3g8rCRRJenUGZxv8o/CeGuNCEaiv1l JjhxirNNCmAFHASekLOLvvsSKFPMsr+0borskCNR/tFcKDL4+BwRI1BKGFqH2bEjqlQF g3ynM0Sik2zqtLbQMIOJkzFr8zsTI7JLH4BkKYP4oD0oCsw8b3IimsNWsvITCtopxATo Bjtg== 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=PdlvwnGEzcFCAXeOFNM8mKM5jXwMmc9nBvJCjWEqLJs=; b=HOzy2EJnQYG78cGwBr6ApuAJPCCLj9olf/BwTqYcSeh6+SXDg+dJ26K5eYv3IiEWYi Bhu9ll6WIvFwHdjYDac66Tvp2RsMOt5GQpEFzZ/aP4cJQvf4seh2SnLvdFcRzfbSV2NX jCxu4ZTI/sWchhiqzkqmaKf5D9YQxScwMG0CWriofiB8HiAgTDDuMX0s6iTdXu0s58H9 PurbFQwlBJFvv6JRrounEnwwOKhnoidFfCZIAKU/KqDN7eV9pUuUdde/JqsClDocgxEI aZ+dIbyvw9A+WvimWATHr/Ok3sp19Jw9ne0rjJ1f0fkyrYaSixjkXOB0cdf9vsLDncrz GptQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AP9qaacm; 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 9si1327593pgo.283.2019.08.29.01.32.42; Thu, 29 Aug 2019 01:32:59 -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=AP9qaacm; 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 S1726975AbfH2Ibu (ORCPT + 99 others); Thu, 29 Aug 2019 04:31:50 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43598 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbfH2Ibt (ORCPT ); Thu, 29 Aug 2019 04:31:49 -0400 Received: by mail-pl1-f193.google.com with SMTP id 4so1230351pld.10 for ; Thu, 29 Aug 2019 01:31:49 -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=PdlvwnGEzcFCAXeOFNM8mKM5jXwMmc9nBvJCjWEqLJs=; b=AP9qaacmgc66TcZAS96mcNHpmHkXa2YSjhhR+Zm0HxyoCaYgyltFEztJRiFJzy7qsT sfa8sVQIXUrFxLLbcEnMR4b93etILParDz+y/cCdUoyHPdii4l9u3866Kx4P82Hna8CY nuJaRUiQe9/4krZc61/4tWDfzrBMTawBTATCjRos6aUQcE1YSolst0W6t9CcXJ7PA1i/ k3NsDfQuFj8bF3aVA1dYpWezniD+Eh2jkRcId31ub8FNA3p5mbouz1etlp4hjRnQH8LQ /mk750SOBjo4JCwhcXOGGzWPHV4vlnIr1UNpnlMkrHuUuKhAlPHFIp3bPNWTebHGt3lz qpfA== 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=PdlvwnGEzcFCAXeOFNM8mKM5jXwMmc9nBvJCjWEqLJs=; b=DbGdOKrwjzl+5/s7IsiGThGGjqe3Mms2MJVOwYFF50h2QEO+rs+O6z4CFAQkgczOe/ 73TFhiux7A6ws0pJwbvWD7gQyrfNbktcdTzpdsllxn+KOCdMqUX18RamhYkytPxEpDSD zDNSvAAY19v8ta6UefqGV/ZbZ8FPWYD0zeeJfzcbiThD3/H/RVZ1mkIBo7H5POnMbgZL DQgJ62rcnm5mAUsBcNFwJtgVg/JCexC/Jbm39U46hvamwduiVPqk4EiqTvQWRJ+IIF5s vcc6k0m8jeMdzELXPooDsh6dquDU7PuvUxkNTx7YbpQlbhdM1c+bDrYVWgf0kAlYjGGz 7hgA== X-Gm-Message-State: APjAAAVmkQEF44XpnDFo9JwiiDMovU9yHBYQaq4b8yZhJTXAo82PTOuf XM99G5y9zUC3dpmt6wUOJoo= X-Received: by 2002:a17:902:aa09:: with SMTP id be9mr8367781plb.52.1567067509064; Thu, 29 Aug 2019 01:31:49 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id v22sm1260155pgk.69.2019.08.29.01.31.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 01:31:48 -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 01/30] locking/lockdep: Rename deadlock check functions Date: Thu, 29 Aug 2019 16:31:03 +0800 Message-Id: <20190829083132.22394-2-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 In lockdep, deadlock checkings are carried out at two places: - In current task's held lock stack, check lock recursion deadlock scenarios. - In dependency graph, check lock inversion deadlock scenarios. Rename these two relevant functions for later use. Plus, with recursive-read locks, only a dependency circle in lock graph is not 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 3c3902c..3c89a50 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -1782,8 +1782,8 @@ unsigned long lockdep_count_backward_deps(struct lock_class *class) * 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 **const trace) +check_deadlock_graph(struct held_lock *src, struct held_lock *target, + struct lock_trace **const trace) { int ret; struct lock_list *uninitialized_var(target_entry); @@ -2372,7 +2372,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 the current + * held lock stack. * * (Note that this has to be done separately, because the graph cannot * detect such classes of deadlocks.) @@ -2380,7 +2381,7 @@ static inline void inc_chains(void) * Returns: 0 on deadlock detected, 1 on OK, 2 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; @@ -2465,7 +2466,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 .) * @@ -2473,7 +2474,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; @@ -2952,7 +2953,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