From: Jakub Kicinski <kuba@kernel.org>
To: Heiko Thiery <heiko.thiery@gmail.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
Fugang Duan <fugang.duan@nxp.com>,
Richard Cochran <richardcochran@gmail.com>
Subject: Re: [PATCH 1/1] net: fec: ptp: avoid register access when ipg clock is disabled
Date: Mon, 22 Feb 2021 19:00:51 -0800 [thread overview]
Message-ID: <20210222190051.40fdc3e9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20210220065654.25598-1-heiko.thiery@gmail.com>
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@gmail.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.
> + 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?
> spin_lock_irqsave(&adapter->tmreg_lock, flags);
> ns = timecounter_read(&adapter->tc);
> spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
next prev parent reply other threads:[~2021-02-23 3:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-20 6:56 [PATCH 1/1] net: fec: ptp: avoid register access when ipg clock is disabled Heiko Thiery
2021-02-23 3:00 ` Jakub Kicinski [this message]
2021-02-23 8:00 ` Heiko Thiery
2021-02-23 14:27 ` Richard Cochran
2021-02-23 15:04 ` Heiko Thiery
2021-02-23 16:11 ` Richard Cochran
2021-02-25 13:49 ` Heiko Thiery
2021-02-25 14:05 ` Heiko Thiery
2021-02-25 17:14 ` Richard Cochran
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=20210222190051.40fdc3e9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=fugang.duan@nxp.com \
--cc=heiko.thiery@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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).