Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp994126pxb; Thu, 17 Feb 2022 20:55:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxL5fWxl9vOch9x7GrIScZioHY5UwuBZ3Q+QG8BwvNiU3Trpx3byXE25uAa49s1XuuBjbpn X-Received: by 2002:a17:907:8284:b0:6ce:d478:ac34 with SMTP id mr4-20020a170907828400b006ced478ac34mr5141189ejc.332.1645160146838; Thu, 17 Feb 2022 20:55:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645160146; cv=none; d=google.com; s=arc-20160816; b=w1LKvHkieOTPA0jphYmrTi5vC8t83rDRz04XkkvJhRKfnpof/dyKH8C9jCL7aU3PMw +kS/0Qb0KMBnzyUnpnKIlJcash4Pn1TWhY/p9OngsQhQLjxI+blA3mEZAc/Qx7aHL9Sy NTAvHVSCNctynGBi3Q5d5TY9sduTMWWvPGk8KYNPQfDuMo447qW5cWTt1mHKGyf2H8L1 zwpg+4SOwag8RozoAqrsy1FVgUDukXyV8gsfn4ERByMhYhHEi6dYjMwRUVZ+AlAzJFhq JrqzPStiBSuuDokAxhFOxbZnko1hyQMBpGh8dhJ1QXoH3pJwfAQDZFvl6oufiTNtY6zn aT2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=DC1ksNHXd5dbe4/m0wX/7LbVWGsXT5OPOfSJysCZfqk=; b=DrShj4oIegh8yN+puwkUxRaiYX6pA9GNYSUIJfj5syc64O1i/gw/BHjwnRl9Frq5sD 7tft4V/ZZLZ0QG8l4Bb0SJCzPgryqj/z31djbVqTNKqr/aKOSqOEvAxf1TgqzSKRgvqL V5jhJcRFZ/xtHcyRc10WUEEwVWMzggBbQyOu5ILiUczpju4Prrb3i8vSITc6LyBqsAiL LY+CqfuiuniG+HcDyJKX1OX/YfMR8ZbS4n+WJ+T0eYZNFxOu7b8/mXSwa5q1MNvUyDQr j97hLPCO/dyQMYeJD2ma6ltGKyeN7g8LbQXa/K7/dgy7iuvVTMny8kt6tnlXGSjHA9vu 8UQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bhzOeCh+; 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 z23si5339636edq.250.2022.02.17.20.55.23; Thu, 17 Feb 2022 20:55: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=bhzOeCh+; 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 S229708AbiBREg0 (ORCPT + 99 others); Thu, 17 Feb 2022 23:36:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbiBREgX (ORCPT ); Thu, 17 Feb 2022 23:36:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D44D119859; Thu, 17 Feb 2022 20:36:07 -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 D682661E26; Fri, 18 Feb 2022 04:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7555C340E9; Fri, 18 Feb 2022 04:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645158966; bh=+l51Or4meOwBjDYBCyGfvqc9xDIc92UbsEMYwevC4GU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bhzOeCh+qbxrFrS19HvOwc/3b5/uRJOVdjviXbed4BOboHQCLykNMNnIm11/UEp4g JfsuFeZueOuuzgsZNacwAn/W1Gstm7Y76s3i1EL35oXAvOVDCN7YWGfzD9aGnwFOCF DG423bQqmu99o5m0uZAQ1ZSQ93J/O5Z6LAtamCBaDYHWlWfY6vb3vekbBtvY6/jzWM 1F6AsTOW3+nKFc50Ca8WJ8Ev09pRSR0CBdLaqt71RXftx/snsyVLKDxcq5KBBumKPo nvtk6CjyGzGgNiQem+gpeVaXFSq/rXZMjM3xCiz6mizVn6rCUXwVJipEioOiGsm/o+ A0TKo2ruBhcSg== Date: Thu, 17 Feb 2022 20:36:04 -0800 From: Jakub Kicinski To: Vincent Whitchurch Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Maxime Coquelin , , Lars Persson , Srinivas Kandagatla , , , , Subject: Re: [PATCH] net: stmmac: Enable NAPI before interrupts go live Message-ID: <20220217203604.39e318d0@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20220217145527.2696444-1-vincent.whitchurch@axis.com> References: <20220217145527.2696444-1-vincent.whitchurch@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 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,T_SCC_BODY_TEXT_LINE 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, 17 Feb 2022 15:55:26 +0100 Vincent Whitchurch wrote: > From: Lars Persson > > The stmmac_open function has a race window between enabling the RX > path and its interrupt to the point where napi_enabled is called. > > A chatty network with plenty of broadcast/multicast traffic has the > potential to completely fill the RX ring before the interrupt handler > is installed. In this scenario the single interrupt taken will find > napi disabled and the RX ring will not be processed. No further RX > interrupt will be delivered because the ring is full. > > The RX stall could eventually clear because the TX path will trigger a > DMA interrupt once the tx_coal_frames threshold is reached and then > NAPI becomes scheduled. LGTM, although now the ndo_open and ndo_stop paths are not symmetrical. Is there no way to mask the IRQs so that they don't fire immediately? More common flow (IMO) would be: - request irq - mask irq - populate rings - start dma - enable napi - unmask irq Other than the difference in flow between open/stop there may also be some unpleasantness around restarting tx queues twice with the patch as is.