From: Johannes Berg <johannes@sipsolutions.net>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Lucas Stach" <l.stach@pengutronix.de>,
"Jisheng Zhang" <jszhang@kernel.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Eric Dumazet <edumazet@google.com>,
Samuel Holland <samuel@sholland.org>,
netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
linux-kernel@vger.kernel.org, Chen-Yu Tsai <wens@csie.org>,
Jose Abreu <joabreu@synopsys.com>,
kernel@pengutronix.de,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-sunxi@lists.linux.dev,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [REGRESSION] [PATCH net-next v5 2/2] net: stmmac: use per-queue 64 bit statistics where necessary
Date: Tue, 12 Sep 2023 11:30:14 +0200 [thread overview]
Message-ID: <2fcc9fb0e40ceff8ea4ae55cca3ce0aff75a20ca.camel@sipsolutions.net> (raw)
In-Reply-To: <20230912092411.pprnpvrbxwz77x6a@pengutronix.de>
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));
>
> 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?
But anyway, I have no skin in this game - just reviewing this because I
was trying to help out Uwe.
johannes
next prev parent reply other threads:[~2023-09-12 9:30 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 [this message]
2023-09-13 14:34 ` Jisheng Zhang
2023-09-13 14:49 ` Johannes Berg
2023-09-13 20:12 ` Uwe Kleine-König
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=2fcc9fb0e40ceff8ea4ae55cca3ce0aff75a20ca.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=alexandre.torgue@foss.st.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jernej.skrabec@gmail.com \
--cc=joabreu@synopsys.com \
--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=u.kleine-koenig@pengutronix.de \
--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).