public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Wen Gu <guwen@linux.alibaba.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Richard Cochran <richardcochran@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Dust Li <dust.li@linux.alibaba.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	virtualization@lists.linux.dev, Nick Shi <nick.shi@broadcom.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-clk@vger.kernel.org
Subject: Re: [RFC] Defining a home/maintenance model for non-NIC PHC devices using the /dev/ptpX API
Date: Wed, 14 Jan 2026 17:06:35 +0800	[thread overview]
Message-ID: <5f3bed2e-b174-4a89-9cde-5c43f9b93702@linux.alibaba.com> (raw)
In-Reply-To: <c4090523151f1994438726686c3bc9e12c977670.camel@infradead.org>



On 2026/1/12 16:04, David Woodhouse wrote:
> 
> Thanks for starting this discussion.
> 
> I agree that the existing 'pure' PHC drivers should keep the option of
> presenting themselves as PTP devices to userspace. I would probably
> have suggested moving them out of drivers/ptp/… to somewhere else under
> drivers/ entirely, but that's bikeshedding.
> 

Thanks for the feedback. The directory and naming will be improved.

> I do think we have slightly different requirements for the pure PHCs
> too though, particularly the virt-focused ones. It would be good if we
> could set a guest's clock from them at startup, and the primary focus
> of them is for calibrating the guest's CLOCK_REALTIME. Which means we
> do actually care about consuming UTC offset and leap second information
> from them, not just TAI.
> 

Yes, we have slightly different requirements. The original motivation
for Alibaba CIPU PTP clock was to provide usable PTP clocks for cloud
services that require precise timing. Guest/VM time synchronization
was not the primary target.

However, I think the idea you mentioned is valuable for virtualization
scenario, eliminating the need for a userspace daemon and directly
calibrating the guest's CLOCK_REALTIME.

> I'd also like microvms to be able to consume time directly, especially
> from vmclock, without needing a full-blown NTP-capable userspace. I've
> experimented with simulating 1PPS support to feed into the kernel's
> timekeeping, although I don't think that's the best answer:
> https://lore.kernel.org/all/87cb97d5a26d0f4909d2ba2545c4b43281109470.camel@infradead.org/
> 
> We could do with harmonising the workarounds for kvmclock too. I made
> sure the vmclock driver reports its timestamp pairs in terms of either
> CSID_X86_TSC or CSID_X86_KVM_CLK as appropriate, but ptp_kvm *only*
> uses kvmclock (which is daft, since anyone who cares about accurate
> time will be using tsc). I was thinking that interface of the pure PHC
> drivers could be really simple, and our new infrastructure could
> provide the ptp_clock_info glue, including the kvmclock conversion if
> needed. And *also* hook them in for setting the clock at startup, and
> even calibrating CLOCK_REALTIME.

I expect the drivers covered by "pure PHC" will be diverse, covering
a range of non-network/IEEE 1588-oriented implementations.
PHC drivers for virtualization scenarios could be one subset. Further
virtualization-specific optimizations can be considered as follow-up
work with the virtualization and timekeeping experts.

Regards.

  reply	other threads:[~2026-01-14  9:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09  2:56 [RFC] Defining a home/maintenance model for non-NIC PHC devices using the /dev/ptpX API Wen Gu
2026-01-12  8:04 ` David Woodhouse
2026-01-14  9:06   ` Wen Gu [this message]
2026-01-12 11:00 ` Sven Schnelle
2026-01-12 12:15   ` Vadim Fedorenko
2026-01-12 13:24     ` Andrew Lunn
2026-01-12 14:52       ` Vadim Fedorenko
2026-01-14  9:13         ` Wen Gu
2026-01-14 10:50           ` Vadim Fedorenko
2026-01-14 12:45             ` Wen Gu
2026-01-13  4:21 ` Richard Cochran
2026-01-14  9:16   ` Wen Gu
2026-01-19 14:48 ` Manivannan Sadhasivam
2026-01-21 14:20   ` Wen Gu
2026-01-21 14:29 ` Wen Gu
2026-02-19  9:29   ` Imran Shaik
2026-02-25  1:45     ` Wen Gu

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=5f3bed2e-b174-4a89-9cde-5c43f9b93702@linux.alibaba.com \
    --to=guwen@linux.alibaba.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=dust.li@linux.alibaba.com \
    --cc=dwmw2@infradead.org \
    --cc=kuba@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nick.shi@broadcom.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=svens@linux.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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