From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: Denis Kirjanov <dkirjanov@suse.de>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
kernel <kernel@axis.com>, Lars Persson <Lars.Persson@axis.com>,
Srinivas Kandagatla <srinivas.kandagatla@st.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-stm32@st-md-mailman.stormreply.com"
<linux-stm32@st-md-mailman.stormreply.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] net: stmmac: only enable DMA interrupts when ready
Date: Thu, 24 Feb 2022 14:40:57 +0100 [thread overview]
Message-ID: <20220224134057.GA4994@axis.com> (raw)
In-Reply-To: <f62148d7-6f7a-3557-e3ca-3a261b61ac9d@suse.de>
On Thu, Feb 24, 2022 at 01:53:33PM +0100, Denis Kirjanov wrote:
> 2/24/22 14:38, Vincent Whitchurch пишет:
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 6708ca2aa4f7..43978558d6c0 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -2260,6 +2260,23 @@ static void stmmac_stop_tx_dma(struct stmmac_priv *priv, u32 chan)
> > stmmac_stop_tx(priv, priv->ioaddr, chan);
> > }
> >
> > +static void stmmac_enable_all_dma_irq(struct stmmac_priv *priv)
> > +{
> > + u32 rx_channels_count = priv->plat->rx_queues_to_use;
> > + u32 tx_channels_count = priv->plat->tx_queues_to_use;
> > + u32 dma_csr_ch = max(rx_channels_count, tx_channels_count);
> > + u32 chan;
> > +
> > + for (chan = 0; chan < dma_csr_ch; chan++) {
> > + struct stmmac_channel *ch = &priv->channel[chan];
> > + unsigned long flags;
> > +
> > + spin_lock_irqsave(&ch->lock, flags);
> > + stmmac_enable_dma_irq(priv, priv->ioaddr, chan, 1, 1);
> > + spin_unlock_irqrestore(&ch->lock, flags);
> > + }
> > +}
> > +
> > /**
> > * stmmac_start_all_dma - start all RX and TX DMA channels
> > * @priv: driver private structure
> > @@ -2902,8 +2919,10 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
> > stmmac_axi(priv, priv->ioaddr, priv->plat->axi);
> >
> > /* 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);
> Did you miss to take a channel lock?
I didn't add it on purpose. At this point during initialization there
is no-one who can race with the register write in
stmmac_disable_dma_irq(). The call to stmmac_init_chan() (in the
existing code) writes the same register without the lock.
> > + stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 1, 1);
> > + }
> >
next prev parent reply other threads:[~2022-02-24 13:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 11:38 [PATCH v2] net: stmmac: only enable DMA interrupts when ready Vincent Whitchurch
2022-02-24 12:53 ` Denis Kirjanov
2022-02-24 13:40 ` Vincent Whitchurch [this message]
2022-02-25 10:50 ` patchwork-bot+netdevbpf
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=20220224134057.GA4994@axis.com \
--to=vincent.whitchurch@axis.com \
--cc=Lars.Persson@axis.com \
--cc=alexandre.torgue@foss.st.com \
--cc=davem@davemloft.net \
--cc=dkirjanov@suse.de \
--cc=joabreu@synopsys.com \
--cc=kernel@axis.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=peppe.cavallaro@st.com \
--cc=srinivas.kandagatla@st.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).