Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1974637ybl; Thu, 29 Aug 2019 01:33:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwn7Hkquoe2RNrFag9VbY0hmzRhkffpdtJBQztqlGOV6/5CFDRmRmr83PL2BT0p1OS75OaM X-Received: by 2002:a17:902:b48c:: with SMTP id y12mr8526943plr.202.1567067600877; Thu, 29 Aug 2019 01:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567067600; cv=none; d=google.com; s=arc-20160816; b=zT6kpsmF3mzf0mW+aeB/EWtPjt0LcPlJyV2X/9Bt12SMnoEYn6cougY4uFwMwEexCa R3FTuGvTL0lwVBxvgdGWhsObIQzadAA3zsEn98jAFjZsVuWPoNBM/0OONwrDTV922Alk tdShJ5MChN0543B9v82/M6tQ9NzKDNPhqyHB7hOzDpEVpjf+IsZ93Rw8JDZacU5Gns7n zQfRhDLISH30jzyH7PLXB0uPMhNxKVGIlZVSA/8mk2538KoIo3KoWd5z8kB0s8Rgi2cl 4DybsnTQe61GPZ8hywKxkCBCrQ2hSxHwab6s0LaD3Qlb02sznfQARV/1e3JWFeZfY4T+ GqTA== 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=iStq7ogyYRbk+qwLA4GKKU5BvJtxVB3HPWsw2YA81jg=; b=1KDb8x7FcKlRuNTujdQ9fq6abn49p3BHKSes8sMRbtBmlR+YEd4qFPFGZfnOAezXhM kj/vxxUqHfhG0A1+Ln8h5CHq8zpnHabQPehBbHenDNiUpf0Fhd3Pm52hT0UGqzKrHgg5 Cixk4LtXaH4dYXXPgOuqLWM7HfhyRe3oKLpOhAYQ1s5EVroWS6c2sL0c34SFW6q0ac1e HB94rNuboyirKEMKc53cNClruaHACiOKI5kxzJeDmKTnrLDvL8zyvJdhclZ0/NYQstCA cdp7HgMprbT7kdQfl0x2mVFaSpd2xLCvNRgQBxKEGCpoEQlvDaWDomqqp1ZfUZIisdTb rWJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Te6dIM32; 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 r145si1378766pgr.553.2019.08.29.01.33.04; Thu, 29 Aug 2019 01:33: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=Te6dIM32; 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 S1727115AbfH2IcC (ORCPT + 99 others); Thu, 29 Aug 2019 04:32:02 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:39433 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfH2IcB (ORCPT ); Thu, 29 Aug 2019 04:32:01 -0400 Received: by mail-pg1-f195.google.com with SMTP id u17so1209690pgi.6 for ; Thu, 29 Aug 2019 01:32: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=iStq7ogyYRbk+qwLA4GKKU5BvJtxVB3HPWsw2YA81jg=; b=Te6dIM32RQo4ztkQNJrTH+5YJ3Ce298hBuKO/1YVJ1HYbj04/e4M0aXHr5LDAsYUip BD1LorIdtPQ4AXlwvdioun/CebYaofvBLJbLNh6aTDqORjCdm7VD/5D95t9573b9jBU2 VQz4tbVPR8LA+gzTQzfoOwB555rqdjb8h8J4abaArCVnLH/ThctJUTv0JPDC5I7tmncR OpD6tKeqvoPlfcCjJ8hdOoqJ6HFF+MpQHIBIKlalg409EyhEFGpr+KDrtxQnmR3VQ5yu vU+1RoSHNuzKu9y62uju406Qj3mUQBA0RlReAFLlGk94MZmvJPwi+9YqUfS/8uWK4w0F f70w== 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=iStq7ogyYRbk+qwLA4GKKU5BvJtxVB3HPWsw2YA81jg=; b=pW1TSj8oe8rVtgt0FuLayKXEC9+vbziCciSPLPqHZOuv0AtN05/GVXnPb+DukG1y6u RHvj2A/jCYRIDX+1VO/ZxjsOGwq13X5hLWpQYkjtYlPxW8QbG0CLqAW1aIAIJBMPh3Wp Ozr8sWvlS5fBeTjka8KDRwcFFYty3VqTPAPx6TOVfJLLSqQYD1qcm217JSl/NfJsMwwV FvE1Qj30GZi3l1nfc2GPZR4J46sPcgufDW8UEK+1arAQLLVcVA21Q+EF9/m6xbjCbtlF 4jTSgx0IlNIt/Pt8ylOp7bxAnjciviIx8xwO0lEbz6RQtTVfxfkI00kMEcbiiCD3f2mF 6j2Q== X-Gm-Message-State: APjAAAVNpoAtosCRWk5F5PsWTh9G1nICMd+Mw0Km2KRptmHBH+pYq31y yoOIF8N7izvfdeYZO7yYpIM= X-Received: by 2002:aa7:9a5a:: with SMTP id x26mr9557090pfj.47.1567067521369; Thu, 29 Aug 2019 01:32:01 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id v22sm1260155pgk.69.2019.08.29.01.31.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 01:32:00 -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 04/30] locking/lockdep: Pass lock chain from validate_chain() to check_prev_add() Date: Thu, 29 Aug 2019 16:31:06 +0800 Message-Id: <20190829083132.22394-5-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 The pointer of lock chains is passed all the way from validate_chain() to check_prev_add(). This is aimed for the later effort to associate lock chains to lock dependencies. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 51918d2..a0e62e5 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -2441,7 +2441,7 @@ 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 **const trace) + struct lock_trace **const trace, struct lock_chain *chain) { struct lock_list *entry; int ret; @@ -2549,7 +2549,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 = NULL; int depth = curr->lockdep_depth; @@ -2580,7 +2581,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; @@ -2920,6 +2921,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 @@ -2931,7 +2933,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: * @@ -2966,7 +2968,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