Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1252031rwb; Thu, 10 Nov 2022 13:26:38 -0800 (PST) X-Google-Smtp-Source: AMsMyM7ZdgroQsW01YyqdJJBLwOOK70CHQ7vWX2BIGXk508UHuXygwzwYZ2M/55tXe9IODFxbtsX X-Received: by 2002:a17:903:1315:b0:186:aad0:6b32 with SMTP id iy21-20020a170903131500b00186aad06b32mr2098847plb.77.1668115598151; Thu, 10 Nov 2022 13:26:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668115598; cv=none; d=google.com; s=arc-20160816; b=KA8d8iHrM1LQuvJLb2d/L/xKUWua2+XERDvwJncWn26z1ifHTVyo0ndbsuLJzUJ0m9 6AxZFT/9lkcmpHn9i3Od/w+gQj83Fy8mjXQ31DXvJlLOkVxcLElLFDB1gQA5FVc4eigD vj1jqO3IN7psO13TU/KT2hNFLaYZvK4jmHvs/mLhcEM13EeQ0nMLeXGrmKh98mD8+roe txDYpv1enLGktt3Fuql4YvfX4/MpratWE8SdQdBNIY210iAV//PebPstXQq+OBhDmFD6 82JvTqFyNqVhDWvnN8bIEaZEAF/7hGZWfyUSxGXxl+NTc2PzGrDhRJXgD6e+/mxxWXG4 1FoA== 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=ONZHiceB3FnPyIuwINzEYnVzp4B5hIT0K2xM5AJ/buU=; b=FY7ckrvS1JEgvPhChvlfe55UtbwLy5uBf7W6pNybH8PUs9MgTAaiostSExaYlniFqK CJomet5yRE7WKBU0r5cULopKtkeNydZacEO7X9u3sEGAD7w/MFcYWd/vdEQwuV8xyFvg xmErxGTiMIf4tuhFcs6Jtdn3c+xVFvZ4F+rk3ej/B9OAMJdX9iT2JfiBhbILDUQNP+x5 k4KnIWknwcA1glanWi7baJaUhoXZyc5oExYYK1U5BVwW408qyCunO96F1bcyv20BKELC pgICzqTY8icoWkdWyMg+SXjBRqwUhtW9oQG3MKWxyGaID7WnJt8ZHNaRTCfiRKkHxUrL XYXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6yt9egA; 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 u12-20020a63f64c000000b0046ef006f51dsi263275pgj.425.2022.11.10.13.26.26; Thu, 10 Nov 2022 13:26:38 -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=X6yt9egA; 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 S232088AbiKJVHb (ORCPT + 92 others); Thu, 10 Nov 2022 16:07:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbiKJVH3 (ORCPT ); Thu, 10 Nov 2022 16:07:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0C857B5B; Thu, 10 Nov 2022 13:07:27 -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 9B41461E60; Thu, 10 Nov 2022 21:07:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39865C433D6; Thu, 10 Nov 2022 21:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668114446; bh=SvL0tC1tE3nUW82Ug4o+iFeGBWUfd1ASGwxtRRbRBIY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=X6yt9egAXwk6xG2LbJRgSeQmEklIyWZA5SD6g3i1mbm/msswMh+cNIlufSBE1fnEP IR8NXRPq/4lBDssPB1ryholDBQqqVPgD0B8e/AesPMnTanXCPFU8xi2brMcWnulkzp lw+FsY5Gmj/CisaT3DjixrbxKgA53rk3HLi+Bnb8hGVMMBA+cDeYCr332lSbl41UxO uytQUD8vnYD8xdCha3JHV2fftWkXYlsO4yb7fEwxnhDgaobuF3LNZ5bWVxk1UT59/h M5K2hQ0mwVjh2h7PIqFEdDT4TkfdhjKVcUC8VV4DgQeNqAltlxc+QodOyapY4K2qVL Edpf9kQpRmwqA== Date: Thu, 10 Nov 2022 23:07:21 +0200 From: Leon Romanovsky To: Jakub Kicinski Cc: Ivan Vecera , "Keller, Jacob E" , "netdev@vger.kernel.org" , "sassmann@redhat.com" , "Piotrowski, Patryk" , SlawomirX Laba , "Brandeburg, Jesse" , "Nguyen, Anthony L" , "David S. Miller" , Eric Dumazet , Paolo Abeni , intel-wired-lan@lists.osuosl.org, 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> <20221110155147.1a2c57f6@p1.luc.cera.cz> <20221110122418.32414666@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221110122418.32414666@kernel.org> 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 Thu, Nov 10, 2022 at 12:24:18PM -0800, Jakub Kicinski wrote: > On Thu, 10 Nov 2022 19:07:02 +0200 Leon Romanovsky wrote: > > > > 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. > > > > > > Check for a bit value (like netif_runnning()) is much cheaper than > > > unconditionally taking global lock like RTNL. > > > > This cheap operation is racy and performed in non-performance > > critical path. > > To be clear - the rtnl_lock around the entire if is still racy > in the grand scheme of things, no? What's stopping someone from > bringing the device right back up after you drop the lock? I want to believe what there is some sort of state machine that won't allow simple toggling of dev_close/dev_open. If it doesn't, rtnl_lock users should audit their code for possible toggling right after that lock is dropped. Anyway, this discussion reminds me our devl_lock debate where we had completely opposite views if rtnl_lock model is the right one. https://lore.kernel.org/netdev/20211101073259.33406da3@kicinski-fedora-PC1C0HJN/ Let's not start argue again, we had enough back then. :) Thanks