Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp903296ybv; Wed, 19 Feb 2020 11:35:49 -0800 (PST) X-Google-Smtp-Source: APXvYqyN+k19iNqubA97wCdquuGmfrbnuGs3CszTHJMU+BbGDm8s4tRyGikejvylE8HL+dLwJ1Re X-Received: by 2002:aca:1903:: with SMTP id l3mr5676911oii.16.1582140949722; Wed, 19 Feb 2020 11:35:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582140949; cv=none; d=google.com; s=arc-20160816; b=BL+cjDjp62wDrXCFUJ1zXXS9spJY8K5SYCfem0iwe3nfoRzB0aBCias2IbVWrFx4C6 KdzMKLy36Ev12ZczUTR229TsAq8NBgiwljaQEMuZzEFfDgnGjTXbDW/yRVcAzUPWAu1f 8amWdxxpY/DJgenCdSh8ZFvQfoeDuvYmZ4X0IbGFjgfPVxW/SGrYlZKe890PIYj/b9zV 1kyLJ3Jt/ezdx3l+rJ8CoLaFqLygmxNKBKhZDstiFdehhniWhArqvzJ9dZ5U/Yt4bFE+ FRCvXvGkc13jbAU3Fi2ty7+hI+hATf0lEysoqJGorsT0vbt7Y0nc/RMKDBumQQH+G/M9 HGOQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=TJB87GoDSDS5eCfiA9gR2g0zVyeNrrkXgkcpdklcL2M=; b=ezwocBmGbS12BpsdLzH/BY1oaxmtM+rVVK7/s0swBn67ngagTs5DjWgZ377bAIBmie SW3JQe+OAEh2DRFHghrKEopM+JePvr78Hn77L5yvrVqL97J6fDguIr2l7kNmVDiZLr7Y tX2v3+V4/VtjAbTe13+kGMM+1NkQ2Y+JgfQh451QPYuKYVLfrx6QXQJMwUlHFQvujo9d js3kX6BJkjt8R1tDD2zv3uSv3t/v5fwziRseQdrfXcv+1tg16hRwdWv7bwTtcdWgdBEH uztX2qOrXK66NUG7cDrRf6MDrVELy1r0XlBhMysM7dvGz5tP1nlKDEDnp7JgsBM81LXo TOIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oc7Q51d4; 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 u206si9655069oia.224.2020.02.19.11.35.37; Wed, 19 Feb 2020 11:35:49 -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=oc7Q51d4; 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 S1726777AbgBSTf1 (ORCPT + 99 others); Wed, 19 Feb 2020 14:35:27 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45818 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726648AbgBSTf1 (ORCPT ); Wed, 19 Feb 2020 14:35:27 -0500 Received: by mail-pf1-f196.google.com with SMTP id 2so553813pfg.12; Wed, 19 Feb 2020 11:35:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=TJB87GoDSDS5eCfiA9gR2g0zVyeNrrkXgkcpdklcL2M=; b=oc7Q51d4YtnLDYX2A8TMQ4xesXFWl/2DkhyK9OtaG4kMy1ZgusJRqiFamcQiJGi0rg MuVDKajG3ccLjKItJx2pa9geyOXV47tNaRRrbhEwosVyy7i8VgOXgH+TwDkkyAhCdJyj UCg97xx1zK8zKMI0zx0FCsuKGtD9sXjcYqbnx5oh9yl18U2K69FDVINvmwRTU6/WIuXS 2d6vCTA5oHxt5TNszR1QauvOoa3TEmMDGqnYs9JybovKNIYzVJ7G9FOPJ7tmznoHZrrh 9j5t4Vr6fScLrX2RqlPAdPpHtUX5xVHEGaWAXHQ8ZB2POu30f+PO45Ca8HVeruDma89U 6iyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TJB87GoDSDS5eCfiA9gR2g0zVyeNrrkXgkcpdklcL2M=; b=Jo/miBR0z0qY33c0lLM8A9M+8Bk6T7VyRKxZpS3w/aizv+oaxMBYXLAGK522JVTQss KKtORdefTFsqytdZgfJY2MeEPCIws08PlmWlcN3SriyOGn1bU79Yy9PJTfN36DYYhLlV xb2JFdtQKKN2Ei6Q3YGdsDuByMDN87zEO6B+Mqa5hvgXrsP9leqOjzQBmCwVP2yIms6d 7VEFXrVkEKypHrAvjxAK3N8hldbee6oKkg1+68if2wbQfudVEgEWrzTbqgD8eEIBDdBz HloRYpoWW2dMogxH/CH+ssgLZal0lXdgTgL8NqQjlbIYUQVvPQyA2z83CZt/7QorZ/i7 qwRg== X-Gm-Message-State: APjAAAW3b5af17MTgjM6cHtq48Z/2EPuPyRAY6fdhZDJ6H0SPGClopiE 2sWS00MDAaxrwvI2k3HqEUNBXAGc X-Received: by 2002:aa7:9f88:: with SMTP id z8mr28015192pfr.220.1582140925152; Wed, 19 Feb 2020 11:35:25 -0800 (PST) Received: from [172.20.2.64] (rrcs-24-43-226-3.west.biz.rr.com. [24.43.226.3]) by smtp.gmail.com with ESMTPSA id l26sm492514pgn.46.2020.02.19.11.35.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Feb 2020 11:35:24 -0800 (PST) Subject: Re: [PATCH] tcp: Pass lockdep expression to RCU lists To: Amol Grover , Eric Dumazet , "David S . Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , netdev@vger.kernel.org References: <20200219100545.27397-1-frextrite@gmail.com> From: Eric Dumazet Message-ID: Date: Wed, 19 Feb 2020 11:35:21 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200219100545.27397-1-frextrite@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/19/20 2:05 AM, Amol Grover wrote: > tcp_cong_list is traversed using list_for_each_entry_rcu > outside an RCU read-side critical section but under the protection > of tcp_cong_list_lock. > This is not true. There are cases where RCU read lock is held, and others where the tcp_cong_list_lock is held. I believe you need to be more precise in the changelog. If there was a bug, net tree would be the target for this patch, with a required Fixes: tag. Otherwise, if net-next tree is the intended target, you have to signal it, as instructed in Documentation/networking/netdev-FAQ.rst Thanks. > Hence, add corresponding lockdep expression to silence false-positive > warnings, and harden RCU lists. > > Signed-off-by: Amol Grover > --- > net/ipv4/tcp_cong.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c > index 3737ec096650..8d4446ed309e 100644 > --- a/net/ipv4/tcp_cong.c > +++ b/net/ipv4/tcp_cong.c > @@ -25,7 +25,8 @@ static struct tcp_congestion_ops *tcp_ca_find(const char *name) > { > struct tcp_congestion_ops *e; > > - list_for_each_entry_rcu(e, &tcp_cong_list, list) { > + list_for_each_entry_rcu(e, &tcp_cong_list, list, > + lockdep_is_held(&tcp_cong_list_lock)) { > if (strcmp(e->name, name) == 0) > return e; > } > @@ -55,7 +56,8 @@ struct tcp_congestion_ops *tcp_ca_find_key(u32 key) > { > struct tcp_congestion_ops *e; > > - list_for_each_entry_rcu(e, &tcp_cong_list, list) { > + list_for_each_entry_rcu(e, &tcp_cong_list, list, > + lockdep_is_held(&tcp_cong_list_lock)) { > if (e->key == key) > return e; > } > @@ -317,7 +319,8 @@ int tcp_set_allowed_congestion_control(char *val) > } > > /* pass 2 clear old values */ > - list_for_each_entry_rcu(ca, &tcp_cong_list, list) > + list_for_each_entry_rcu(ca, &tcp_cong_list, list, > + lockdep_is_held(&tcp_cong_list_lock)) > ca->flags &= ~TCP_CONG_NON_RESTRICTED; > > /* pass 3 mark as allowed */ >