From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Jisheng Zhang <jszhang@kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Paolo Abeni <pabeni@redhat.com>,
kernel@pengutronix.de, Samuel Holland <samuel@sholland.org>,
netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
linux-kernel@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jose Abreu <joabreu@synopsys.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Chen-Yu Tsai <wens@csie.org>,
linux-sunxi@lists.linux.dev,
"David S . Miller" <davem@davemloft.net>,
linux-arm-kernel@lists.infradead.org,
Lucas Stach <l.stach@pengutronix.de>
Subject: Re: [REGRESSION] [PATCH net-next v5 2/2] net: stmmac: use per-queue 64 bit statistics where necessary
Date: Wed, 13 Sep 2023 22:12:12 +0200 [thread overview]
Message-ID: <20230913201212.eiedub5rsztuwaa7@pengutronix.de> (raw)
In-Reply-To: <ZQHIgmcnCNoZwtwu@xhacker>
[-- Attachment #1: Type: text/plain, Size: 2040 bytes --]
Hello,
On Wed, Sep 13, 2023 at 10:34:42PM +0800, Jisheng Zhang wrote:
> On Tue, Sep 12, 2023 at 11:30:14AM +0200, Johannes Berg wrote:
> > On Tue, 2023-09-12 at 11:24 +0200, Uwe Kleine-König wrote:
> > > >
> > > > The newly added "struct u64_stats_sync syncp" uses a seqlock
> > > > internally, which is broken into multiple words on 32bit machines, and
> > > > needs to be initialized properly. You need to call u64_stats_init on
> > > > syncp before first usage.
> > >
> > > This is done. The problematic thing is that in stmmac_open() ->
> > > __stmmac_open() the syncp initialized before is overwritten by
> > >
> > > memcpy(&priv->dma_conf, dma_conf, sizeof(*dma_conf));
>
> Thank Johannes and Uwe for pointing out the issue.
>
> > >
> > > Do I need to point out that this is ugly?
> >
> > I think it also leaks the (lockdep) state since it reinits the syncp
> > (and a lot of other state) doing this. This is also called when the MTU
> > changes.
> >
> > Also, I couldn't convince myself that it's even race-free? Even if it
> > is, it's not really obvious, IMHO.
> >
> > So it seems to me that really this needs to be split into data that
> > actually should be reinitialized, and data that shouldn't, or just not
> > use memcpy() here but copy only the relevant state?
>
> Since we are in rc1, I need to fix the bug with as small changes as
> possible. so another solution could be: replace rx/tx stats structure
> with pointers, then setup pointers in the new allocated dma_conf with
> the old one as current code did for dma_tx_size/dma_rx_size in
> stmmac_setup_dma_desc():
>
> dma_conf->dma_tx_size = priv->dma_conf.dma_tx_size
>
> Is it acceptable?
I wondered if you can just initialize the data directly in *priv, instead
of setting up a local copy, initialize that one + copy it over?!
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2023-09-13 20:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 16:06 [PATCH net-next v5 0/2] net: stmmac: improve driver statistics Jisheng Zhang
2023-07-17 16:06 ` [PATCH net-next v5 1/2] net: stmmac: don't clear network statistics in .ndo_open() Jisheng Zhang
2023-07-17 16:06 ` [PATCH net-next v5 2/2] net: stmmac: use per-queue 64 bit statistics where necessary Jisheng Zhang
2023-09-11 17:11 ` [REGRESSION] " Uwe Kleine-König
2023-09-12 8:01 ` Jisheng Zhang
2023-09-12 9:04 ` Lucas Stach
2023-09-12 9:24 ` Uwe Kleine-König
2023-09-12 9:30 ` Johannes Berg
2023-09-13 14:34 ` Jisheng Zhang
2023-09-13 14:49 ` Johannes Berg
2023-09-13 20:12 ` Uwe Kleine-König [this message]
2023-09-12 8:23 ` Jisheng Zhang
2023-09-12 9:26 ` Uwe Kleine-König
2023-09-21 18:34 ` Guenter Roeck
2023-09-21 19:56 ` Uwe Kleine-König
2023-09-21 20:14 ` Guenter Roeck
2023-07-19 1:01 ` [PATCH net-next v5 0/2] net: stmmac: improve driver statistics Jakub Kicinski
2023-07-20 4:00 ` 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=20230913201212.eiedub5rsztuwaa7@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=alexandre.torgue@foss.st.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jernej.skrabec@gmail.com \
--cc=joabreu@synopsys.com \
--cc=johannes@sipsolutions.net \
--cc=jszhang@kernel.org \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/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).