From patchwork Thu Jan 28 14:44:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 12053853 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F6C1C433E0 for ; Thu, 28 Jan 2021 14:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 013A264DE7 for ; Thu, 28 Jan 2021 14:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232243AbhA1OvU (ORCPT ); Thu, 28 Jan 2021 09:51:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:49952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232244AbhA1OqF (ORCPT ); Thu, 28 Jan 2021 09:46:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7493E64DE9; Thu, 28 Jan 2021 14:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611845072; bh=DsA1S6viX+MkR70qVehutTDiq1qcSOgjTCBHV3VbLJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uLhxjunM6FWszOhTRftQp6LC4nn6uMcFkAWD4Ij+eHE+ulYYWTr4zHHKgfBYf5pRy zgzCIH5gcfP7zdDrDqyicJhhzufX+1/kHTfVQiPGuRIjeVsXIriWGuKAqoqk2S0+zi XAufajV8FUa/Z2751ZqmicGJA4e87rBI7hj2m1VNXBhGQB5ysbp4qAtoU2M8p5/g1v 4VyesWUjv8l/Oe6JALlPJoPnkh3F4WGUz4D/6Da5SN5N9YRhU2/xArF2rVPhUzP/0r cWmZe9gy7KkJUfEkEi5y2CeH5Zy3Se7d8meIlM8iy1syl1rjVZYDjuqugHWxTwmIMy OL3JoMsiDZsnA== From: Antoine Tenart To: davem@davemloft.net, kuba@kernel.org, alexander.duyck@gmail.com Cc: Antoine Tenart , netdev@vger.kernel.org Subject: [PATCH net-next 08/11] net: assert the rtnl lock is held when calling __netif_set_xps_queue Date: Thu, 28 Jan 2021 15:44:02 +0100 Message-Id: <20210128144405.4157244-9-atenart@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210128144405.4157244-1-atenart@kernel.org> References: <20210128144405.4157244-1-atenart@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add ASSERT_RTNL at the top of __netif_set_xps_queue and add a comment about holding the rtnl lock before the function. Suggested-by: Alexander Duyck Signed-off-by: Antoine Tenart --- net/core/dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 2a0a777390c6..c639761ddb5e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2623,7 +2623,7 @@ static void xps_copy_dev_maps(struct xps_dev_maps *dev_maps, } } -/* Must be called under cpus_read_lock */ +/* Must be called under rtnl_lock and cpus_read_lock */ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask, u16 index, bool is_rxqs_map) { @@ -2635,6 +2635,8 @@ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask, struct xps_map *map, *new_map; unsigned int nr_ids; + ASSERT_RTNL(); + if (dev->num_tc) { /* Do not allow XPS on subordinate device directly */ num_tc = dev->num_tc;