[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0c1cea33-6676-4590-8c7c-9fe1a3d88f0b@nvidia.com>
Date: Tue, 29 Jul 2025 09:57:13 +0300
From: Carolina Jubran <cjubran@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>, Tariq Toukan <tariqt@...dia.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>, Mark Bloch <mbloch@...dia.com>,
Richard Cochran <richardcochran@...il.com>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 0/3] Support exposing raw cycle counters in PTP
and mlx5
On 22/07/2025 3:09, Jakub Kicinski wrote:
> On Tue, 15 Jul 2025 08:15:30 +0300 Tariq Toukan wrote:
>> This patch series introduces support for exposing the raw free-running
>> cycle counter of PTP hardware clocks.
>
> Could you say more about use cases? I realized when massaging the cover
> letter to apply the series that all the use cases are vague and
> hypothetical.
>
>> Some telemetry and low-level logging use cycle counter timestamps
>> rather than nanoseconds.
>
> What is that "some telemetry"?
>
>> Currently, there is no generic interface to
>> correlate these raw values with system time.
>>
>> To address this, the series introduces two new ioctl commands that
>> allow userspace to query the device's raw cycle counter together with
>> host time:
>>
>> - PTP_SYS_OFFSET_PRECISE_CYCLES
>>
>> - PTP_SYS_OFFSET_EXTENDED_CYCLES
>>
>> These commands work like their existing counterparts but return the
>> device timestamp in cycle units instead of real-time nanoseconds.
>>
>> This can also be useful in the XDP fast path: if a driver inserts the
>> raw cycle value into metadata instead of a real-time timestamp, it can
>> avoid the overhead of converting cycles to time in the kernel. Then
>> userspace can resolve the cycle-to-time mapping using this ioctl when
>> needed.
>
> There is no API to achieve that today, right? The XDP access helpers
> are supposed to return converted time. Are you planning to add new
> callbacks?
> > If there are solid networking use cases for this I'd prefer we fully
> iron them out before merging this uAPI. If there are RDMA use cases
> please spell them out in more detail.
Hi Jakub
Thanks for the feedback.
One concrete use case is monitoring the frequency stability of the
device clock in FreeRunning mode. User space can periodically sample the
(cycle, time) pairs returned by the new ioctl to estimate the clock’s
frequency and detect anomalies, for example, drift caused by temperature
changes. This is especially useful in holdover scenarios.
Another practical case is with DPDK. When the hardware is in FreeRunning
mode, the CQE contains raw cycle counter values. DPDK returns these
values directly to user space without converting them. The new ioctl
provides a generic and consistent way to translate those raw values to
host time.
As for XDP, you’re right that it doesn’t expose raw cycles today. The
point here is more future-looking: if drivers ever choose to emit raw
cycles into metadata for performance, this API gives user space a clean
way to interpret those timestamps.
Carolina
Powered by blists - more mailing lists