Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp360395rwb; Thu, 10 Nov 2022 01:43:46 -0800 (PST) X-Google-Smtp-Source: AMsMyM555TU6dsXOp/SidgrRwtlMvU41myTopqziXuLOpVuIeK3yICzNZId61h0EPdblLpjxXhwn X-Received: by 2002:a17:906:9bd2:b0:78d:48ac:9041 with SMTP id de18-20020a1709069bd200b0078d48ac9041mr2557203ejc.361.1668073426033; Thu, 10 Nov 2022 01:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668073426; cv=none; d=google.com; s=arc-20160816; b=fTc3Rtypp54ruZ3cR9uRz5d5ZHORkPzyRzPtqSOHWe7mhIfGJufGHEAbSpgguCzH9T cgsCyRq8rrWbpAPSH0V1MowfD6cHHXBwAXbXpqMTGbswMtVU6ykTGu5bETCegAyu+wMR QkLz/laaJUWi8Qo5paPruYv5Zv2flOyfodM+kQRDQXkmmmCJLGWK39Tu67DVij1/r4bT S6pAAo2/4jShr3dHgD0yGdftUHGpWPGc6wcrCQ/cqgQQ1wvNd6aRzA0Kx3x2zbnxE2gp brRdsyWWnszVgh1qVMfLHRYdu8HofylVt4/xPxzfl6kPyH+/pOTi3RksCjbttyWT9tsI j8bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XYBD5jqy6Bney38D9Yr9BjZxZPfF8JtRVRUSbJVFl7A=; b=dhYEMXRpXWyFqgfzRilI16zwOB7zSfHlF6p3+2+XQfOKdoIwj327I9nEeZl8A2gT7h 7pYh9xb9I02Yn+/+VD7eYvZkGXsUWt0uLyGiW1UB8kBLzEhjBhOz/ko30pRV9Rf2bNUN xAMDps0QGwUB+HqaWWBcwz/Nyp+u186HHDPGkDXbtpEZKE0CMjRstTuIT1+Z8TXtdXuU mXM6JqoTs1+IY5K1fhnKpb6vQNWUCg9haGa9Yx/MQh96jgsH8cwVDQ725+cqk+DRbfSE AsQY+RE4rmwPjltPiiAMLK6ZU8mBjGW6TqUVdbEuNOn0u9Qmm5ITCMc0sNisWiA9lSmx 4mpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nuErvBV+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs15-20020a1709073e8f00b007a858ead52dsi6742220ejc.732.2022.11.10.01.43.22; Thu, 10 Nov 2022 01:43:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nuErvBV+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229785AbiKJJRT (ORCPT + 92 others); Thu, 10 Nov 2022 04:17:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiKJJRQ (ORCPT ); Thu, 10 Nov 2022 04:17:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84C7A69DEC; Thu, 10 Nov 2022 01:17:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0DFEE60ABE; Thu, 10 Nov 2022 09:17:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0ADDC433C1; Thu, 10 Nov 2022 09:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668071834; bh=6TJNnSviLlX563oQpc85BIYcQat1cVbnGv4v0Qc+vJk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nuErvBV+JiX3N5HtvK2D1LR6w1MiTqz7BX5r2A6wKtpNtZxMsDPZj7y69xuhyTrD3 BUuHNxOElpY18O+P3jV6r/vZL6mlUcfRAjl+enMvT2qbPtgbmZkiEtspmxeUt+1w7n q4uZwOiaNepckD00u0BL2SBfyOBikhzIxoi3VjYOaJgOrlyf6ktk7M8di8qVtZzIab OXbOV+mAGv40umA6nNEOja5M8uFKT8hIhlrr6pd8XGadKRJv0LVic4dCy1Q9h/nomD H/P/X+7S3skPgOh5bRAlJxAdvunajMCzS7uhQBOTp9dcUiexSdwcxlhpp/lEFb9DHM kM6oHKUX4Cm5Q== Date: Thu, 10 Nov 2022 11:17:09 +0200 From: Leon Romanovsky To: "Keller, Jacob E" Cc: ivecera , "netdev@vger.kernel.org" , "sassmann@redhat.com" , "Piotrowski, Patryk" , SlawomirX Laba , "Brandeburg, Jesse" , "Nguyen, Anthony L" , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "moderated list:INTEL ETHERNET DRIVERS" , open list Subject: Re: [PATCH net] iavf: Do not restart Tx queues after reset task failure Message-ID: References: <20221108102502.2147389-1-ivecera@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 09, 2022 at 08:11:55PM +0000, Keller, Jacob E wrote: > > > > -----Original Message----- > > From: Leon Romanovsky > > Sent: Wednesday, November 9, 2022 10:21 AM > > To: ivecera > > Cc: netdev@vger.kernel.org; sassmann@redhat.com; Keller, Jacob E > > ; Piotrowski, Patryk ; > > SlawomirX Laba ; Brandeburg, Jesse > > ; Nguyen, Anthony L > > ; David S. Miller ; Eric > > Dumazet ; Jakub Kicinski ; Paolo > > Abeni ; moderated list:INTEL ETHERNET DRIVERS > wired-lan@lists.osuosl.org>; open list > > Subject: Re: [PATCH net] iavf: Do not restart Tx queues after reset task failure > > > > On Tue, Nov 08, 2022 at 11:25:02AM +0100, Ivan Vecera wrote: > > > After commit aa626da947e9 ("iavf: Detach device during reset task") > > > the device is detached during reset task and re-attached at its end. > > > The problem occurs when reset task fails because Tx queues are > > > restarted during device re-attach and this leads later to a crash. > > > > <...> > > > > > + if (netif_running(netdev)) { > > > + /* Close device to ensure that Tx queues will not be started > > > + * during netif_device_attach() at the end of the reset task. > > > + */ > > > + rtnl_lock(); > > > + dev_close(netdev); > > > + rtnl_unlock(); > > > + } > > > > Sorry for my naive question, I see this pattern a lot (including RDMA), > > so curious. Everyone checks netif_running() outside of rtnl_lock, while > > dev_close() changes state bit __LINK_STATE_START. Shouldn't rtnl_lock() > > placed before netif_running()? > > Yes I think you're right. A ton of people check it without the lock but I think thats not strictly safe. Is dev_close safe to call when netif_running is false? Why not just remove the check and always call dev_close then. I honestly don't know. To remove any doubts, this patch is LGTM. Thanks, Reviewed-by: Leon Romanovsky