Re: [PATCH net v4 0/2] net: ravb: fix PTP clock lifetime

luoxuanqiang <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-renesas-soc
Message-ID <[email protected]>
Hi Niklas,

在 2026/8/13 18:41, Niklas Söderlund 写道:

> Hi Xuanqiang,
>
> Thanks for your work.
>
> On 2026-08-11 18:37:31 +0800, Xuanqiang Luo wrote:
>> From: Xuanqiang Luo <[email protected]>
>>
>> This series fixes RAVB PTP clock lifetime handling. It reports a cached PHC
>> index without accessing the clock pointer and drains PTP interrupts before
>> unregistering the clock.
>>
>> Patch 1 caches the PHC index and handles registration failures.
>>
>> Patch 2 detaches the clock with xchg() and drains the PTP IRQs before
>> unregistering it.
> These patches are rather big change adding READ_ONCE() and WRITE_ONCE()
> to avoid a LLM warning? Or have you hit a real issue? How have you
> tested this work?

The READ_ONCE()/WRITE_ONCE() use is as follows.

PATCH 1 follows Vadim's suggestion to cache the PHC index.
ravb_get_ts_info() can race with ravb_ptp_init(), so the accessors
are there for that update.

PATCH 2 only addresses the race reported by Sashiko. The teardown
follows Vadim's suggestion as well, and READ_ONCE()/WRITE_ONCE()
looked appropriate there too.

I do not have RAVB hardware, so I have not reproduced the PATCH 2
issue.

> If you have a test-case could you share it? I have a pending series [1]
> that cleans up the whole RAVB driver ptp management which have grown
> rather organically. It have a small fix for the missing check of
> registering the clock. Would it be possible for you to test your work
> with that series too?
>
> 1.  https://lore.kernel.org/all/20260811160200.2049987-1-niklas.soderlund%[email protected]/

I looked at [1]. It is for net-next. But my goal is still a small fixfor 
net.I would prefer to keep this on net rather than rebase onto [1] for 
net-next. Does that work for you?Patch 8 of [1] moves the PHC index 
lookup into a callback, but that
callback still does not check for a NULL clock. Userspace can run
"ethtool -T" before the interface is opened, so the original hole
is still there.

To keep the conflict small, may I drop PATCH 2 for now and send
only PATCH 1 to net? PATCH 2 is a larger change, and I have no
reproducer, even though it does address Sashiko's report. The race
can wait until it is actually hit. I am not sure this is theright 
approach; this is the first time I have been in thissituation.

Thanks,
Xuanqiang
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.