[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEyMn7ZM7_pPor0S=dMGbmnp0hmZMrpquGqq4VNu-ixSPp+0UQ@mail.gmail.com>
Date: Tue, 23 Feb 2021 09:00:32 +0100
From: Heiko Thiery <heiko.thiery@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
Fugang Duan <fugang.duan@....com>,
Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH 1/1] net: fec: ptp: avoid register access when ipg clock
is disabled
HI Jakub,
Am Di., 23. Feb. 2021 um 04:00 Uhr schrieb Jakub Kicinski <kuba@...nel.org>:
>
> On Sat, 20 Feb 2021 07:56:55 +0100 Heiko Thiery wrote:
> > When accessing the timecounter register on an i.MX8MQ the kernel hangs.
> > This is only the case when the interface is down. This can be reproduced
> > by reading with 'phc_ctrl eth0 get'.
> >
> > Like described in the change in 91c0d987a9788dcc5fe26baafd73bf9242b68900
> > the igp clock is disabled when the interface is down and leads to a
> > system hang.
> >
> > So we check if the ptp clock status before reading the timecounter
> > register.
> >
> > Signed-off-by: Heiko Thiery <heiko.thiery@...il.com>
>
> Please widen the CC list, you should CC Richard on PTP patches.
>
> > diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
> > index 2e344aada4c6..c9882083da02 100644
> > --- a/drivers/net/ethernet/freescale/fec_ptp.c
> > +++ b/drivers/net/ethernet/freescale/fec_ptp.c
> > @@ -377,6 +377,9 @@ static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
> > u64 ns;
> > unsigned long flags;
> >
> > + /* Check the ptp clock */
>
> Comment is rather redundant. Drop it or say _when_ ptp_clk_on may not
> be true.
I just used the same comment as the one in the fec_ptp_settime() function.
>
> > + if (!adapter->ptp_clk_on)
> > + return -EINVAL;
>
> Why is the PTP interface registered when it can't be accessed?
>
> Perhaps the driver should unregister the PTP clock when it's brought
> down?
Good question, but I do not know what happens e.g. with linuxptp when
the device that was opened before will be gone.
Maybe Richard can give a hint.
>
> > spin_lock_irqsave(&adapter->tmreg_lock, flags);
> > ns = timecounter_read(&adapter->tc);
> > spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
--
Heiko
Powered by blists - more mailing lists