From: Daniel Thompson <daniel@riscstar.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Alex Elder <elder@riscstar.com>,
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
Date: Thu, 30 Jul 2026 14:24:28 +0100 [thread overview]
Message-ID: <amtQjCV6Oi7UI97t@aspen.lan> (raw)
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 <daniel@riscstar.com>
> > > <snip>
> > > @@ -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.
next prev parent reply other threads:[~2026-07-30 13:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 16:17 [PATCH] net: stmmac: Avoid freeing and re-requesting IRQ during XDP set prog Daniel Thompson
2026-07-06 16:37 ` sashiko-bot
2026-07-07 9:48 ` Daniel Thompson
2026-07-07 12:30 ` Andrew Lunn
2026-07-30 13:24 ` Daniel Thompson [this message]
2026-07-30 13:35 ` Andrew Lunn
2026-07-07 10:42 ` Maciej Fijalkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amtQjCV6Oi7UI97t@aspen.lan \
--to=daniel@riscstar.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=elder@riscstar.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.