From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: xuanqiang.luo@linux.dev, linux-renesas-soc@vger.kernel.org,
netdev@vger.kernel.org, niklas.soderlund@ragnatech.se,
kuba@kernel.org
Cc: paul@pbarker.dev, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, richardcochran@gmail.com,
masaru.nagai.vx@renesas.com, sergei.shtylyov@cogentembedded.com,
luoxuanqiang@kylinos.cn, stable@vger.kernel.org
Subject: Re: [PATCH net v3 2/2] net: ravb: serialize PTP clock teardown
Date: Thu, 6 Aug 2026 23:34:24 +0100 [thread overview]
Message-ID: <cdc07462-5997-44f5-8659-5e7862f418ac@linux.dev> (raw)
In-Reply-To: <20260806095126.57803-3-xuanqiang.luo@linux.dev>
On 06/08/2026 10:51, xuanqiang.luo@linux.dev wrote:
> From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
>
> ravb_get_ts_info() can run without RTNL while ravb_ptp_stop() unregisters
> the PHC. The PTP interrupt handler can race with the same teardown, so both
> paths may access the clock while it is being freed.
>
> Protect the clock pointer with priv->lock, clear it before unregistering
> the PHC, and unregister the detached clock outside the lock.
I think adding spinlock here is a bit of overkill. For
ravb_get_ts_info() you can simply extend struct ravb_ptp to store clock
index on init and reset it to -1 on ptp stop.
For interrupt race I think ravb_ptp_stop() can be split into disable
interrupt function (like ravb_ptp_disable()) and actual clock free. In
this case ravb_ptp_disable() can be run before synchronize_irq() with
ptp_clock_unregister() afterwards in teardown callbacks, like it's
already done for ring allocations.
next prev parent reply other threads:[~2026-08-06 22:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 9:51 [PATCH net v3 0/2] net: ravb: fix PTP clock lifetime xuanqiang.luo
2026-08-06 9:51 ` [PATCH net v3 1/2] net: ravb: handle unavailable PTP clock xuanqiang.luo
2026-08-06 13:37 ` Vadim Fedorenko
2026-08-06 9:51 ` [PATCH net v3 2/2] net: ravb: serialize PTP clock teardown xuanqiang.luo
2026-08-06 22:34 ` Vadim Fedorenko [this message]
2026-08-07 10:14 ` luoxuanqiang
2026-08-07 14:51 ` Vadim Fedorenko
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=cdc07462-5997-44f5-8659-5e7862f418ac@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=luoxuanqiang@kylinos.cn \
--cc=masaru.nagai.vx@renesas.com \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=pabeni@redhat.com \
--cc=paul@pbarker.dev \
--cc=richardcochran@gmail.com \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=stable@vger.kernel.org \
--cc=xuanqiang.luo@linux.dev \
/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