Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3069917ybd; Fri, 28 Jun 2019 02:17:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6mSks/hcI0qi8MB4buBJepb9V2mucTfPmmE3dGNrQ9vWvS+3t9WKjKZnDTseuX1/wWKG1 X-Received: by 2002:a63:3ec7:: with SMTP id l190mr8572223pga.334.1561713476373; Fri, 28 Jun 2019 02:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561713476; cv=none; d=google.com; s=arc-20160816; b=vRxFxzFv7LAQjUpjbNDws2I+WsbdBg3hVP8PFPZKZRiSyEs4BmHgs9/RYq/8ZHIIll Jz3p1tLKwRKyLsHIsDE8BBOKZR1BC79VauxVhpYA6l733MKiLLX4rgSathvucAMMA7Gn xiauc+UE7Y/QdyvXFKkGa44aCDyhLOOjH0p0maayWghGrhKG17dOPfKAgEN3zz2qXcwo 7ZBPdfoouixavJ16ep2rUS6e+1ZZ4YfGjm2nv4SqUZu9qNPfQw95XHOt925z7RAvDNdo CWEfjnyEOTIMYhn+GpYc9D8yXT4VOP3+woAnvTEILbHMFRb2SDcCeLkPgpJvch7gqx9Q R6/A== 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=KzQscIlOqbSR5X8vlQQcdhDhIvVQjC/TlNpKJdDihTo=; b=rrEhmvmA8Q8gUF0o2lAnYOTyzKQ/F3zxk6dDu15vY1zWau9jOTdkkWOzrD+qCcitJp lw4KGyPdQxbOVWDNC/y++oGlaUjSe45o6/VwCg2DvwRgR+VQOe2BXra4M+ZdIUitv1Ht Cd/zxxo2jWhTBPeY6lNR99WI2OF0EMW3pRI8kCz6oIEr/Hf+NK5iZOdoZrtiyN2EMxlh QHqdDFrr0WrYdDeFL7TGHM6agwJNU6J41Cm5uJKeCXauowO0+vSPMduyhviKOgtpy3LH jajOXSbpCN9p3PTGwC0X6gOYcicryPN2XzO7ALAB85FEvCq+yYb07B3pU7JBvA8wDUCm Ca9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="VA1/GZGC"; 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 o11si1738475pjb.30.2019.06.28.02.17.39; Fri, 28 Jun 2019 02:17:56 -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="VA1/GZGC"; 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 S1726786AbfF1JQC (ORCPT + 99 others); Fri, 28 Jun 2019 05:16:02 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36288 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726508AbfF1JQC (ORCPT ); Fri, 28 Jun 2019 05:16:02 -0400 Received: by mail-pl1-f196.google.com with SMTP id k8so2912310plt.3 for ; Fri, 28 Jun 2019 02:16:01 -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=KzQscIlOqbSR5X8vlQQcdhDhIvVQjC/TlNpKJdDihTo=; b=VA1/GZGC2lFQKUb6UwkuaLhqscyMT/ICb6iqxIBr0inuYzIPGNJdW8KK88iMY1heeZ ewV6BvMQApVRI2XWOTZerVVVPMQ0eKjjJ0gGsTo7opqCVc/CqYymKPi6ZG7xBqF85f9R UCU5vc6jPJben0VEV0How97m0DT4oLAXIyBdbZPrh57euBamWGZkyKHPwO79qiuvvemj roOkO8metksahsnXJgYDWpBIECN1KZwhs+NOKz9ToSKGcni02PHQIoqRomQAWU0ejWTn 0XAOSy4OGQiGSQoYbvpUFXvZpJyJyDr7eeyh0YGkMJV6I3HyFKduZLXHcQ91MKgChRwr ra8g== 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=KzQscIlOqbSR5X8vlQQcdhDhIvVQjC/TlNpKJdDihTo=; b=r8qmZ2/HFOr8bAgm3G6YCHPcszBYYUqRocs0fIf9WUZHyLZqorMu/8GCF7TTXm8aFb SHFsCLtupKjo2kXaCSqAkJgSelzXXxWOOEFFI43IdBtcDRcqpA8u10dfxzNfaOek8qLR HD1y5VXDgVWJ14YlD4cIzDV2BKGvWb1Iq+pj6lWY2EdikcrGsVVCxb2lFNKnNSpzzB7x xoS33DUjzmUMqLE2bcM9dy2irR9qMSMX/3AySyIGz08GoIZSvWTsJOIIEoP3KCvAEmjP GcARC0lN/0EIRxMlMYm61i+PtOyipk/vHHSAk/DqzT1rWGri9gRNeipeYGTJ+n+vbpkl I6HA== X-Gm-Message-State: APjAAAVCr0pfQrVRnhWJL4nL5z63MzCaYElfKzyA8FombRoBUsIIo9cn lax4xOA/aQhq8oJJFw4325k= X-Received: by 2002:a17:902:b70f:: with SMTP id d15mr9826919pls.318.1561713361638; Fri, 28 Jun 2019 02:16:01 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id x65sm1754521pfd.139.2019.06.28.02.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jun 2019 02:16:01 -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 v3 04/30] locking/lockdep: Pass lock chain from validate_chain() to check_prev_add() Date: Fri, 28 Jun 2019 17:15:02 +0800 Message-Id: <20190628091528.17059-5-duyuyang@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190628091528.17059-1-duyuyang@gmail.com> References: <20190628091528.17059-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 The pointer of lock chains is passed all the way from validate_chain() to check_prev_add(). This is aimed for a later effort to associate lock chains to lock dependencies. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index d545b6c..f171c6e 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -2370,7 +2370,8 @@ static inline void inc_chains(void) */ static int check_prev_add(struct task_struct *curr, struct held_lock *prev, - struct held_lock *next, int distance, struct lock_trace *trace) + struct held_lock *next, int distance, struct lock_trace *trace, + struct lock_chain *chain) { struct lock_list *entry; int ret; @@ -2475,7 +2476,8 @@ static inline void inc_chains(void) * the end of this context's lock-chain - whichever comes first. */ static int -check_prevs_add(struct task_struct *curr, struct held_lock *next) +check_prevs_add(struct task_struct *curr, struct held_lock *next, + struct lock_chain *chain) { struct lock_trace trace = { .nr_entries = 0 }; int depth = curr->lockdep_depth; @@ -2506,7 +2508,7 @@ static inline void inc_chains(void) */ if (hlock->read != 2 && hlock->check) { int ret = check_prev_add(curr, hlock, next, distance, - &trace); + &trace, chain); if (!ret) return 0; @@ -2846,6 +2848,7 @@ static int validate_chain(struct task_struct *curr, struct held_lock *hlock, int chain_head, u64 chain_key) { + struct lock_chain *chain; /* * Trylock needs to maintain the stack of held locks, but it * does not add new dependencies, because trylock can be done @@ -2857,7 +2860,7 @@ static int validate_chain(struct task_struct *curr, * graph_lock for us) */ if (!hlock->trylock && hlock->check && - lookup_chain_cache_add(curr, hlock, chain_key)) { + (chain = lookup_chain_cache_add(curr, hlock, chain_key))) { /* * Check whether last held lock: * @@ -2892,7 +2895,7 @@ static int validate_chain(struct task_struct *curr, * of the chain, and if it's not a secondary read-lock: */ if (!chain_head && ret != 2) { - if (!check_prevs_add(curr, hlock)) + if (!check_prevs_add(curr, hlock, chain)) return 0; } -- 1.8.3.1