From mboxrd@z Thu Jan 1 00:00:00 1970 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 69CC0C433E2 for ; Thu, 17 Sep 2020 07:07:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1069C206E6 for ; Thu, 17 Sep 2020 07:07:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2WGeg9fG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1069C206E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=56WZ07xjDXt+biC/ttyldaZxOcl6oJY/bA7gYa4W264=; b=2WGeg9fGewZiBTDaSoLmfC3ng LVU9rK4DncGR5VsvmWFj/GCT+AA0sE999iaeEWHl+lcAXRbxJVSopY+tk4Xse57Vsz0Iokd9ySf/i 7A6RkOMYZUqnwDDj+HNUsCMOdKOCF/YB/hndxhkW/VwYMUz3mqa/ITkTqp23rATVv7OvFWx6cfxaD KZyuUlx5GyxB3qBdlQq1L1hvzbEtuyBztKyt4Y1osY+aYz4uKVyWGywoNcWxuh1U7FjdYlNncdlN2 ytNMlG0cZf6lCQkmMdyYODLK88R/VBOLrfszP6yzmH2XLH7DX7ZjcLw+jHpXSIFcd/J/v3audAIZ2 ivwqRNP3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kInzr-0002QD-Gr; Thu, 17 Sep 2020 07:06:23 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kInzo-0002Ou-2r for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 07:06:20 +0000 Received: from localhost (unknown [193.47.165.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B6941206E6; Thu, 17 Sep 2020 07:06:17 +0000 (UTC) Date: Thu, 17 Sep 2020 10:06:14 +0300 From: Leon Romanovsky To: Wong Vee Khee Subject: Re: [PATCH net-next] net: stmmac: introduce rtnl_lock|unlock() on configuring real_num_rx|tx_queues Message-ID: <20200917070614.GP486552@unreal> References: <20200917050215.8725-1-vee.khee.wong@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200917050215.8725-1-vee.khee.wong@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200917_030620_184832_E42C5C62 X-CRM114-Status: GOOD ( 20.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Torgue , Voon Wei Feng , netdev@vger.kernel.org, Tan Tee Min , linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Seow Chen Yong , Jose Abreu , Vijaya Balan Sadhishkhanna , Maxime Coquelin , Jakub Kicinski , Ong Boon Leong , Giuseppe Cavallaro , "David S . Miller" , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 17, 2020 at 01:02:15PM +0800, Wong Vee Khee wrote: > From: "Tan, Tee Min" > > For driver open(), rtnl_lock is acquired by network stack but not in the > resume(). Therefore, we introduce lock_acquired boolean to control when > to use rtnl_lock|unlock() within stmmac_hw_setup(). Doesn't really make sense, if function needs to have lock acquired, the caller is supposed to take it and function should have proper lockdep annotation inside and not this conditional lock/unlock. Thanks > > Fixes: 686cff3d7022 ("net: stmmac: Fix incorrect location to set real_num_rx|tx_queues") > Extra line. > Signed-off-by: Tan, Tee Min > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index df2c74bbfcff..22e6a3defa78 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -2607,7 +2607,8 @@ static void stmmac_safety_feat_configuration(struct stmmac_priv *priv) > * 0 on success and an appropriate (-)ve integer as defined in errno.h > * file on failure. > */ > -static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) > +static int stmmac_hw_setup(struct net_device *dev, bool init_ptp, > + bool lock_acquired) > { > struct stmmac_priv *priv = netdev_priv(dev); > u32 rx_cnt = priv->plat->rx_queues_to_use; > @@ -2715,9 +2716,15 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) > } > > /* Configure real RX and TX queues */ > + if (!lock_acquired) > + rtnl_lock(); > + > netif_set_real_num_rx_queues(dev, priv->plat->rx_queues_to_use); > netif_set_real_num_tx_queues(dev, priv->plat->tx_queues_to_use); > > + if (!lock_acquired) > + rtnl_unlock(); > + > /* Start the ball rolling... */ > stmmac_start_all_dma(priv); > > @@ -2804,7 +2811,7 @@ static int stmmac_open(struct net_device *dev) > goto init_error; > } > > - ret = stmmac_hw_setup(dev, true); > + ret = stmmac_hw_setup(dev, true, true); > if (ret < 0) { > netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); > goto init_error; > @@ -5238,7 +5245,7 @@ int stmmac_resume(struct device *dev) > > stmmac_clear_descriptors(priv); > > - stmmac_hw_setup(ndev, false); > + stmmac_hw_setup(ndev, false, false); > stmmac_init_coalesce(priv); > stmmac_set_rx_mode(ndev); > > -- > 2.17.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel