Linux Renesas SOC kernel development
 help / color / mirror / Atom feed
From: luoxuanqiang <xuanqiang.luo@linux.dev>
To: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org,
	kuba@kernel.org, vadim.fedorenko@linux.dev, paul@pbarker.dev,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, richardcochran@gmail.com,
	masaru.nagai.vx@renesas.com, luoxuanqiang@kylinos.cn
Subject: Re: [PATCH net v4 0/2] net: ravb: fix PTP clock lifetime
Date: Fri, 14 Aug 2026 16:37:10 +0800	[thread overview]
Message-ID: <b43dc1ef-3b44-463f-b99f-148a9da2d578@linux.dev> (raw)
In-Reply-To: <20260813104114.GG2757863@ragnatech.se>

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 <luoxuanqiang@kylinos.cn>
>>
>> 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%2Brenesas@ragnatech.se/

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


  reply	other threads:[~2026-08-14  8:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 10:37 [PATCH net v4 0/2] net: ravb: fix PTP clock lifetime Xuanqiang Luo
2026-08-11 10:37 ` [PATCH net v4 1/2] net: ravb: avoid dereferencing an invalid PTP clock Xuanqiang Luo
2026-08-11 10:37 ` [PATCH net v4 2/2] net: ravb: serialize PTP clock teardown Xuanqiang Luo
2026-08-13 10:41 ` [PATCH net v4 0/2] net: ravb: fix PTP clock lifetime Niklas Söderlund
2026-08-14  8:37   ` luoxuanqiang [this message]
2026-08-17 22:50 ` patchwork-bot+netdevbpf

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=b43dc1ef-3b44-463f-b99f-148a9da2d578@linux.dev \
    --to=xuanqiang.luo@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=vadim.fedorenko@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