Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3677555ybl; Tue, 21 Jan 2020 05:13:51 -0800 (PST) X-Google-Smtp-Source: APXvYqwkxaVcj33fBk2vhaFFM3Y+fC9sKtY+WrmlKIoS8UhoaBD6m9O8fnEmjrcNQbR9Mf3THlBA X-Received: by 2002:aca:f507:: with SMTP id t7mr2888492oih.156.1579612431380; Tue, 21 Jan 2020 05:13:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579612431; cv=none; d=google.com; s=arc-20160816; b=AE+TefzarvXA/zK6iB2nNZGQ57G4szLnWleZgizklRNBNye9E/cAjdxepPZ3E227oF rHgKfSYoVySQnwVHsPpWU4Vo5rnG8JNW/8JpagQvOf2xChh6aDQPFHnMZZOpmNggoMDQ eoY0ottjYFLYiYxXPR/Xu2xJ8K8dCFpmdwh7VMykFDlEbqBVNyPXw1uKWWvrOLQ8/Yva WLl0J929LvTXdZgSuEg1HFG4iMMH8k5i5eQbTe5KJYlS7Ydz+y9yp0tLIAuI4WeA433p ZobEbOOo7U8C9xDiWtfA9p45LF6p6oPyleELCP4WeuEESfkCPDf4xVEeNVIxEZuP12KK oz2w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=mV1qixM+hRHgqOUWXlliAy9s0rAvz7UfT2PUrmz0Bbg=; b=WSvx48fQiAQ4gL3nxQhuni13weY9JKPEnB6c3j3SBUpgzuET5qx22Mzh9c1JZ187Je HmT/4Z5aY2m1VdnYe0Z+Gp1icz30hyZ2qyWEpIVne9boVoic6MtJY25c/k5FqFU0WwFh 4mq0J2FzAM9G6JH5juLXz7AjCe11BSHXmmk63Sw1rn85wmklTtFej9Af4hFZ3nLbJPf9 ZthP3Bg35TFj9rfrxVrDWLsJiSbmXTQUhRKP/susn0F9UkdIktJewT3395n1t6vQXNcY v6ALXgpKnykfBmNeAuS8UePS7P91Iiel2Hlfr8Rb+u4B05f1oYfTWtIoq4bQybr+2M83 IIOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z8J8xUgv; 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 24si18915277oip.248.2020.01.21.05.13.36; Tue, 21 Jan 2020 05:13:51 -0800 (PST) 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=Z8J8xUgv; 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 S1728733AbgAUNM2 (ORCPT + 99 others); Tue, 21 Jan 2020 08:12:28 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:54590 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbgAUNM1 (ORCPT ); Tue, 21 Jan 2020 08:12:27 -0500 Received: by mail-pj1-f66.google.com with SMTP id kx11so1347618pjb.4 for ; Tue, 21 Jan 2020 05:12:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mV1qixM+hRHgqOUWXlliAy9s0rAvz7UfT2PUrmz0Bbg=; b=Z8J8xUgv8y94kuhtX71q1/CgB8A/sNC1KYd1fA4XQ8dsGsaiP8ZgINBuCPnzRg4jHV CderUAy51B78k5hydIFo8YC5g4HekpmRgr3HyEQaYAgvf6qtS8Aji3Xgdw3dAdkh7Lu9 rbyrLtr0sphBHAJXTzNAIU/PPtgvQu1s9enlYvGdqLY7A+118uke39A8zjn1l+gy0Csu u1H7QAonjdPZPsxVEQjA9Cq5C0irlKLA3lGcMYyt7ZKo4oSVRQtsag//IGj7nJHYLaXg C5a0GPYzOBtZkQzlXuV2WhmR17axvDCbDCM8N3tX/9uSQmdOy+L85hYnf/5L1kItG67Y FSEQ== 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:mime-version :content-transfer-encoding; bh=mV1qixM+hRHgqOUWXlliAy9s0rAvz7UfT2PUrmz0Bbg=; b=S7TZl+bSRqBCDdkD3T8Whu9ZJ4Jodhn766uy5uVlBSA03AdnJh9sgcx0iXozc+3AZZ W6FjJbhUZoxjLMV4RDJ+qlZyXi3iNSCS3A2wlBPEd/b2mRrerJLGF6l1t9b+4YAmH/Ks TxjXTd8SyuFZdGbD+kSldNjhTYT8jXoLZoCEd1U9jAK2ZXiHCZ+rxOegJ+w//oUCxiqM yTOotlQ+7wVPnEyhVNaQoQrssYI4sjfCj1H+pS56z0EIijDMbfCu+jLYm8xyJB4N6Daa 1z1rkaRuYFltcHQ7H8nbSx/MezyUL9O0mtbIou9gfSwyhuBJbN4+ldoNv6p9boSEsquy 6/hA== X-Gm-Message-State: APjAAAWmSSiGPMkLHd/bSONqQs+r6HZpmrOZ2zXxwvW8/CGWCPRIRXFQ fE9jqEBf1THdj9U9QjYwkI8= X-Received: by 2002:a17:90a:1697:: with SMTP id o23mr5418876pja.62.1579612347118; Tue, 21 Jan 2020 05:12:27 -0800 (PST) Received: from localhost.localdomain ([146.196.37.201]) by smtp.googlemail.com with ESMTPSA id i8sm44027333pfa.109.2020.01.21.05.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 05:12:26 -0800 (PST) From: Amol Grover To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , Amol Grover Subject: [PATCH] kernel: time: posix-timers: Pass lockdep expression to RCU lists Date: Tue, 21 Jan 2020 18:41:33 +0530 Message-Id: <20200121131132.15830-1-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 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 head is traversed using hlist_for_each_entry_rcu outside an RCU read-side critical section but under the protection of hash_lock. Hence, add corresponding lockdep expression to silence false-positive lockdep warnings, and harden RCU lists. Add macro for the corresponding lockdep expression. Signed-off-by: Amol Grover --- kernel/time/posix-timers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 0ec5b7a1d769..2ccce00af177 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -50,6 +50,8 @@ static struct kmem_cache *posix_timers_cache; static DEFINE_HASHTABLE(posix_timers_hashtable, 9); static DEFINE_SPINLOCK(hash_lock); +#define hash_lock_held() \ + lockdep_is_held(&hash_lock) static const struct k_clock * const posix_clocks[]; static const struct k_clock *clockid_to_kclock(const clockid_t id); @@ -120,7 +122,7 @@ static struct k_itimer *__posix_timers_find(struct hlist_head *head, { struct k_itimer *timer; - hlist_for_each_entry_rcu(timer, head, t_hash) { + hlist_for_each_entry_rcu(timer, head, t_hash, hash_lock_held()) { if ((timer->it_signal == sig) && (timer->it_id == id)) return timer; } -- 2.24.1