From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDB0C39CCFD for ; Thu, 30 Jul 2026 13:24:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785417878; cv=none; b=PmT+wy1HjJT2an+oSqNnwXE+GESSx4RYFb1IN5daa5n+60xNYUFQhtE4R9KlP9+ocTzy3SifHFxARHHmpJxCzCXPnbjOv+YbvUREoh5vBb/BeO3EVPV+kDRqX/PrIzKe0aoXpcR5KMdG/gZcYpgf7z1ATeEOqzBf4xTLrNuLyA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785417878; c=relaxed/simple; bh=1bmQ3RAxzKe2E3N+fs3vbfkvhQw0L5IsZeWyc9BpdRg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ki6geFaO9xPXhoVq0wqys5m3kzH1CbC5wKu5K9fP82f7PcILPG/gQTmjLYj5AUvA/YaeIxX2CwXqmneSfxuqfc5ASsyzo1z5mAGbX5+WemiiV15lltvnNOmtNRfs5q7jzSOzlTtkL5ZAtipkthMYn8/MmXPHPO6Zk9q6BKr5s5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b=blTFJ+Kw; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20251104.gappssmtp.com header.i=@riscstar-com.20251104.gappssmtp.com header.b="blTFJ+Kw" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4955de8797cso14094085e9.3 for ; Thu, 30 Jul 2026 06:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20251104.gappssmtp.com; s=20251104; t=1785417872; x=1786022672; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=wTNiZqsPvsvAsqdJI3NYqaSJTMEuvNjWMEi2TBFAAqs=; b=blTFJ+KwnlkNkWzRNAxS6s0Y97LiwFlTGmcXqZhN5tnW7ZSNHgSaCmBTeBpo+UzieD x0w3k+O1zEB/Nd36E/sGWVyNoHZqyj7EhLx4+x4+GFZL0ZXG/QBGjHCg1roGOWK20s0f dkrE1T7JpcILsj2NN6cu/71VdbE4irtTTIyQtI80K2BbWTC2uKh4PdoAIznjp1ws4Ntx QFhg16TBZWjpPbFcNTUDnYcYsJ0UzhqX5A68E3C+9e8+RumP0+Xen3oWx2oRkWvS8THf hyY8NHfhO6/zzQuYNzuVYuzjo8NPiVAiysD3dGUouSSpd8P2CNPO3KlOjEZicfXnWesx rKvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785417872; x=1786022672; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wTNiZqsPvsvAsqdJI3NYqaSJTMEuvNjWMEi2TBFAAqs=; b=ewiIhpTNbuYEQnrTStHYn5KfDbHhb81ceEEWhXLL80bgjU289hVkEsyKrjUIVAe98v 1KHAS8w1qXxKhv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Zg3tOMk7DUYvpo+38DraSxR3R95R939H6GU7ob8PCiTuKETo5xRF1/FdkwHlQrX6QX qy2mDJDZSuy9axwCm/0Hg+rUjbVivqYPIiEd6UsVT6rDyw== X-Received: by 2002:a05:600c:8b66:b0:496:c1f3:e8f9 with SMTP id 5b1f17b1804b1-49800ea1378mr34361415e9.20.1785417871594; Thu, 30 Jul 2026 06:24:31 -0700 (PDT) Received: from aspen.lan (aztw-34-b2-v4wan-166919-cust780.vm26.cable.virginm.net. [82.37.195.13]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49801c073a3sm8655585e9.4.2026.07.30.06.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2026 06:24:30 -0700 (PDT) Date: Thu, 30 Jul 2026 14:24:28 +0100 From: Daniel Thompson To: Andrew Lunn Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Stanislav Fomichev , Alex Elder , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH] net: stmmac: Avoid freeing and re-requesting IRQ during XDP set prog Message-ID: References: <20260706-tc956x-stmmac-no_irq_teardown-v1-1-df009d0272bf@riscstar.com> <9f949b97-da81-4bdc-8be5-68f7883d768c@lunn.ch> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9f949b97-da81-4bdc-8be5-68f7883d768c@lunn.ch> On Tue, Jul 07, 2026 at 02:30:44PM +0200, Andrew Lunn wrote: > On Tue, Jul 07, 2026 at 10:48:50AM +0100, Daniel Thompson wrote: > > On Mon, Jul 06, 2026 at 05:17:58PM +0100, Daniel Thompson wrote: > > > Currently stmmac will run a full cycle of IRQ tear down and setup when > > > setting up a new XDP program. This makes tuning TSN systems difficult > > > because whenever a new XDP program is installed then the irq threads will > > > be stopped and restarted which will undo any thread tuning. > > > > > > The problem is avoided by removing stmmac_free_irq()/stmmac_request_irq() > > > from stmmac_xdp_release()/stmmac_xdp_open(). > > > > > > stmmac_free_irq() implicitly synchronizes interrupts and, with that > > > removed, I was unable to prove that later actions in > > > stmmac_xdp_release() are safe when there are concurrent interrupts. To > > > avoid problems let's also move the code to disable DMA interrupts earlier > > > in the sequence and explicitly sync the interrupts handler(s). > > > > > > Signed-off-by: Daniel Thompson > > > > > > @@ -7156,10 +7201,8 @@ int stmmac_xdp_open(struct net_device *dev) > > > stmmac_reset_queues_param(priv); > > > > > > /* DMA CSR Channel configuration */ > > > - for (chan = 0; chan < dma_csr_ch; chan++) { > > > + for (chan = 0; chan < dma_csr_ch; chan++) > > > stmmac_init_chan(priv, priv->ioaddr, priv->plat->dma_cfg, chan); > > > - stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 1, 1); > > > - } > > > > Sashiko picked up that stmmac_init_chan() has the effect of enabling DMA > > irqs, making this code unsafe. > > > > Given stmmac_xdp_open() can only be called on a running interface (and that > > stmmac_xdp_open() explicitly sets sph) then re-initializing with stmmac_init_chan() > > should have no effect and we can drop that as well. > > Something i like to see is symmetry. In theory, stmmac_xdp_open() and > stmmac_xdp_release() should be mirrors of each other. But i don't see > anything like the opposite of stmmac_init_chan() in > stmmac_xdp_release(). So i can well understand that something is > wrong. > > Maybe rather than just fixing this IRQ issue, you can look at both > functions and see about making them symmetric? I've no idea what that > actually entails, it could be a can of worms, which is not so uncommon > with stmmmac. After review I found that moving the disable to stmmac_xdp_release() does and removing the call the stmmac_init_chan() gets things most of the way there. After these changes every action in stmmac_xdp_release() can now be traced by to corresponding restore code in stmmac_xdp_open(). It's not fully symmetric because activity in open does not appear in reverse order compared to release. However it definitely moves things in the right direction because the new stmmac_disable_all_dma_irq() function pairs nicely with stmmac_enable_all_dma_irq(). Daniel.