From patchwork Thu Aug 15 21:11:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuniyuki Iwashima X-Patchwork-Id: 13765170 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp-fw-80009.amazon.com (smtp-fw-80009.amazon.com [99.78.197.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC679BA53 for ; Thu, 15 Aug 2024 21:12:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=99.78.197.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723756341; cv=none; b=gGI5qAsJybmgJrANr7BuSlC+8HA7/mS44ayEMcJtpGcOq5ucFb1QiOyIx/9tDUj++cajp/D7BP0HUHwyuMKpzYBlITF6QkvZfr6aKX8GgqXoqvGXySPi5mK3tPJleoiezjLvE7Xb0DEnR009QLOLO4/ntib5tR8AU98N7W1FpJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723756341; c=relaxed/simple; bh=c9MWDMKZgZxjvzVBJ/uDn8nerL/d7Zhy/MQpgEd748c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dtClA8D+2DsMfbQatV+UyzEjUbvX8EW/gQCSTOBtEGqqKY1ZEhZk1G9V1I8dCjx+hCRFLExIrfKmJfjhjIIpaljBsXvP9V/j6rT6JEkku2Rf6l/DehK4eyL8c8REYDAdCUq6IGpmpCgHMhG0gRnRP/W/NH9YzhXpnsRYfTit7XU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.jp; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=n4Hk2gJr; arc=none smtp.client-ip=99.78.197.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="n4Hk2gJr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1723756339; x=1755292339; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=23OtOaEyUNNwNQ59BhbKBF/mA4TRJpcKBRF2KJDDcJg=; b=n4Hk2gJrILapsH9+BhyFES+Dkrx3lc4+5Bd/vAJL7H/IffTHOAKysws3 A6EXyMaj2gChzA+L1Gu5KeV+kL+qK1D4bKI9WfXNSjUqG35+HYRLzzTx3 0uULzd8wFR/icwxq9Qemfzvp/0xItbcwe0mdm1eD730nn3YNwO+RHiIuD I=; X-IronPort-AV: E=Sophos;i="6.10,150,1719878400"; d="scan'208";a="115682671" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-80009.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2024 21:12:17 +0000 Received: from EX19MTAUWC001.ant.amazon.com [10.0.7.35:59670] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.39.30:2525] with esmtp (Farcaster) id 2c8d1ba7-4ac5-46a4-8179-05703fc05384; Thu, 15 Aug 2024 21:12:17 +0000 (UTC) X-Farcaster-Flow-ID: 2c8d1ba7-4ac5-46a4-8179-05703fc05384 Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWC001.ant.amazon.com (10.250.64.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Thu, 15 Aug 2024 21:12:17 +0000 Received: from 88665a182662.ant.amazon.com (10.106.100.33) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Thu, 15 Aug 2024 21:12:14 +0000 From: Kuniyuki Iwashima To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Roopa Prabhu , Nikolay Aleksandrov CC: Kuniyuki Iwashima , Kuniyuki Iwashima , Subject: [PATCH v1 net-next 1/2] ipv4: Use RCU helper in inet_get_link_af_size() and inet_fill_link_af(). Date: Thu, 15 Aug 2024 14:11:36 -0700 Message-ID: <20240815211137.62280-2-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240815211137.62280-1-kuniyu@amazon.com> References: <20240815211137.62280-1-kuniyu@amazon.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D046UWB004.ant.amazon.com (10.13.139.164) To EX19D004ANA001.ant.amazon.com (10.37.240.138) X-Patchwork-Delegate: kuba@kernel.org Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"), af_ops->{get_link_af_size,fill_link_af}() are called under RCU. Instead of using rcu_dereference_rtnl(), let's make the context clear by using RCU helpers. Signed-off-by: Kuniyuki Iwashima --- net/ipv4/devinet.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 61be85154dd1..a4f9822213bf 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -1950,9 +1950,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr *ifa, struct nlmsghdr *nlh, static size_t inet_get_link_af_size(const struct net_device *dev, u32 ext_filter_mask) { - struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr); - - if (!in_dev) + if (!rcu_access_pointer(dev->ip_ptr)) return 0; return nla_total_size(IPV4_DEVCONF_MAX * 4); /* IFLA_INET_CONF */ @@ -1961,7 +1959,7 @@ static size_t inet_get_link_af_size(const struct net_device *dev, static int inet_fill_link_af(struct sk_buff *skb, const struct net_device *dev, u32 ext_filter_mask) { - struct in_device *in_dev = rcu_dereference_rtnl(dev->ip_ptr); + struct in_device *in_dev = rcu_dereference(dev->ip_ptr); struct nlattr *nla; int i; From patchwork Thu Aug 15 21:11:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuniyuki Iwashima X-Patchwork-Id: 13765171 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCABB13C677 for ; Thu, 15 Aug 2024 21:12:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=52.95.49.90 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723756368; cv=none; b=bOnbmuUwGDPg+6srEOLw4efoEommu29OzDgdqGogilJ9ZaILUCYqvivHnUm6ZrdlvZ+Iv/VgC4pi05EIzwwOlnz6d0ZG/l9NS656O4z2VOst+uvaTsrEz/kmxpORBQKvdquBaymsCDghfVgTu9afs/AjQsbqcUzX/sxNQ2/3M18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723756368; c=relaxed/simple; bh=y6nBb/P8lI74CWqs3c4CHK5bCS/zPfz1qdvaS1iZTuE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rbfNVa6wJ11nabJYVfKCiFKM+QJKCLPgD9T+cUo8BT0j60AqhhsE2sHgrYTH62CtCD1b6ctgU6e7XUQ+n7XNEVx96YateBDl5/A45Pn0xLpOZYebosvKCxtqL2xzIG8ITTk9hNUntcSNiT8517L+BkMGx5wGApxIaltdvunU4c4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.jp; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=l2ONfXhc; arc=none smtp.client-ip=52.95.49.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="l2ONfXhc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1723756367; x=1755292367; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eB5vKI/54pLfPF/zJk0JlG20z25oWeIx0xbvzxX7bHo=; b=l2ONfXhcCUzdgdzr5yLXEnYMG0wEkmM30D7tuyXkNpdrIiSZSbnaY99e vp3R2Djg3JSDAf9q509zuMdkRWgXYIbNmJCGJjZ/zyLpdcxK53MqIuxWU 2mxoPTiA/fNVXw0xyY0pORR3Fc1wWlmikGfE+5K1UAA24SW7jSmAEP+kj Y=; X-IronPort-AV: E=Sophos;i="6.10,150,1719878400"; d="scan'208";a="427171748" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.43.8.6]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Aug 2024 21:12:43 +0000 Received: from EX19MTAUWB002.ant.amazon.com [10.0.7.35:35333] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.3.1:2525] with esmtp (Farcaster) id 7935a9a6-5346-4b9a-968c-f8b049098ad8; Thu, 15 Aug 2024 21:12:42 +0000 (UTC) X-Farcaster-Flow-ID: 7935a9a6-5346-4b9a-968c-f8b049098ad8 Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWB002.ant.amazon.com (10.250.64.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Thu, 15 Aug 2024 21:12:42 +0000 Received: from 88665a182662.ant.amazon.com (10.106.100.33) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Thu, 15 Aug 2024 21:12:39 +0000 From: Kuniyuki Iwashima To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Roopa Prabhu , Nikolay Aleksandrov CC: Kuniyuki Iwashima , Kuniyuki Iwashima , Subject: [PATCH v1 net-next 2/2] net: bridge: Remove rcu_read_lock() in br_get_link_af_size_filtered(). Date: Thu, 15 Aug 2024 14:11:37 -0700 Message-ID: <20240815211137.62280-3-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240815211137.62280-1-kuniyu@amazon.com> References: <20240815211137.62280-1-kuniyu@amazon.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D039UWA003.ant.amazon.com (10.13.139.49) To EX19D004ANA001.ant.amazon.com (10.37.240.138) X-Patchwork-Delegate: kuba@kernel.org Since commit 5fa85a09390c ("net: core: rcu-ify rtnl af_ops"), af_ops->get_link_af_size() is called under RCU. Let's remove unnecessary rcu_read_lock() in br_get_link_af_size_filtered(). Signed-off-by: Kuniyuki Iwashima --- net/bridge/br_netlink.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index f17dbac7d828..c386a8ec370f 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c @@ -101,7 +101,6 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev, size_t vinfo_sz = 0; int num_vlan_infos; - rcu_read_lock(); if (netif_is_bridge_port(dev)) { p = br_port_get_check_rcu(dev); if (p) @@ -111,7 +110,6 @@ static size_t br_get_link_af_size_filtered(const struct net_device *dev, vg = br_vlan_group_rcu(br); } num_vlan_infos = br_get_num_vlan_infos(vg, filter_mask); - rcu_read_unlock(); if (p && (p->flags & BR_VLAN_TUNNEL)) vinfo_sz += br_get_vlan_tunnel_info_size(vg);