[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YwzRF1B3R8GuZR1K@hoboy.vegasvil.org>
Date: Mon, 29 Aug 2022 07:45:43 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Csókás Bence <csokas.bence@...lan.hu>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>,
kernel@...gutronix.de, Marc Kleine-Budde <mkl@...gutronix.de>
Subject: Re: [PATCH] net: fec: Use unlocked timecounter reads for saving state
On Mon, Aug 29, 2022 at 01:40:41PM +0200, Csókás Bence wrote:
> `fec_ptp_save_state()` may be called from an atomic context,
> which makes `fec_ptp_gettime()` unable to acquire a mutex.
> Using the lower-level timecounter ops remedies the problem.
>
> Reported-by: Marc Kleine-Budde <mkl@...gutronix.de>
> Fixes: f79959220fa5
> diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
> index 78fb8818d168..fdd22c6ca909 100644
> --- a/drivers/net/ethernet/freescale/fec_ptp.c
> +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> @@ -636,7 +636,7 @@ void fec_ptp_save_state(struct fec_enet_private *fep)
> {
> u32 atime_inc_corr;
>
> - fec_ptp_gettime(&fep->ptp_caps, &fep->ptp_saved_state.ts_phc);
> + fep->ptp_saved_state.ns_phc = timecounter_read(&fep->tc);
The function, fec_ptp_read, does RMW register access and thus needs
protection against concurrent callers.
So you can't simply avoid mutex acquisition to fix the splat.
Thanks,
Richard
Powered by blists - more mailing lists