[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241112115009.028b8724@fedora.home>
Date: Tue, 12 Nov 2024 11:50:09 +0100
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Jakub Kicinski <kuba@...nel.org>, Alexandre Torgue
<alexandre.torgue@...s.st.com>, Jose Abreu <joabreu@...opsys.com>, Andrew
Lunn <andrew+netdev@...n.ch>, davem@...emloft.net, Eric Dumazet
<edumazet@...gle.com>, Maxime Coquelin <mcoquelin.stm32@...il.com>, Richard
Cochran <richardcochran@...il.com>, Alexis Lothoré
<alexis.lothore@...tlin.com>, Thomas Petazzoni
<thomas.petazzoni@...tlin.com>, netdev@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v3 4/9] net: stmmac: Introduce dwmac1000
ptp_clock_info and operations
Hello Jakub, Paolo,
On Tue, 12 Nov 2024 10:28:21 +0100
Paolo Abeni <pabeni@...hat.com> wrote:
> On 11/12/24 01:12, Jakub Kicinski wrote:
> > On Wed, 6 Nov 2024 10:03:25 +0100 Maxime Chevallier wrote:
> >> + mutex_unlock(&priv->aux_ts_lock);
> >> +
> >> + /* wait for auxts fifo clear to finish */
> >> + ret = readl_poll_timeout(ptpaddr + PTP_TCR, tcr_val,
> >> + !(tcr_val & GMAC_PTP_TCR_ATSFC),
> >> + 10, 10000);
> >
> > Is there a good reason to wait for the flush to complete outside of
> > the mutex?
>
> Indeed looking at other `ptpaddr` access use-case, it looks like the
> mutex protects both read and write accesses.
>
> @Maxime: is the above intentional? looks race-prone
You're right, this is racy... It wasn't intentionnal, it's actually the
same logic as dwmac4 uses so looks like dwmac4 is also incorrect in
that regard.
I'll send a v4 with that change, and a fix for dwmac4 along the way
then.
Thanks for spotting this,
Maxime
Powered by blists - more mailing lists