From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
Saeed Mahameed <saeed@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Saeed Mahameed <saeedm@nvidia.com>, <netdev@vger.kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Gal Pressman <gal@nvidia.com>,
Richard Cochran <richardcochran@gmail.com>,
Vincent Cheng <vincent.cheng.xh@renesas.com>
Subject: Re: [net-next 03/15] net/mlx5: Add adjphase function to support hardware-only offset control
Date: Thu, 19 Jan 2023 20:26:04 -0800 [thread overview]
Message-ID: <87pmb9u90j.fsf@nvidia.com> (raw)
In-Reply-To: <20230119200343.2eb82899@kernel.org> (Jakub Kicinski's message of "Thu, 19 Jan 2023 20:03:43 -0800")
On Thu, 19 Jan, 2023 20:03:43 -0800 Jakub Kicinski <kuba@kernel.org> wrote:
> On Thu, 19 Jan 2023 19:56:24 -0800 Rahul Rameshbabu wrote:
>> >> Makes sense. Once you've verified that the delta is within the accepted
>> >> range you can just re-use the existing adjtime function.
>> >
>> > Seems like we should add a "max_time_adj" to struct ptp_clock_info
>> > and let the core call adjphase if the offset is small enough to fit.
>> > Instead of having all drivers redirect the calls internally.
>>
>> With guidance from Saeed on this topic, I have a patch in the works for
>> advertising the max phase adjustment supported by a driver through the
>> use of the PTP_CLOCK_GETCAPS ioctl. This is how the ptp stack handles
>> advertising the max frequency supported by a driver today. In linuxptp,
>> this ioctl is wrapped in a function call for getting the max frequency
>> adjustment supported by a device before ptp is actually run. I believe a
>> similar logic should occur for phase (time) adjustments. This patch
>> would introduce a "max_phase_adj" in ptp_clock_info that would be
>> handled in ptp_clock_adjtime in the ptp core stack.
>
> Nice, can we make the core also call ->adjtime automatically if driver
> doesn't define ->adjphase and the abs(delta) < .max_phase_adj ?
One of my concerns with doing this is breaking userspace expectations.
In linuxptp, there is a configuration setting "write_phase_mode" and an
expectation that when adjphase is called, there will not be a fallback
to adjtime. This because adjphase is used in situations where small fine
tuning is explicitly needed, so the errors would indicate a logical or
situational error.
Quoting Vincent Cheng, the author of the adjphase functionality in the
ptp core stack.
-----BEGIN QUOTE-----
adjtime modifies HW counter with a value to move the 1 PPS abruptly to new location.
adjphase modifies the frequency to quickly nudge the 1 PPS to new location and also includes a HW filter to smooth out the adjustments and fine tune frequency.
Continuous small offset adjustments using adjtime, likley see sudden shifts of the 1 PPS. The 1 PPS probably disappears and re-appears.
Continuous small offset adjustments using adjphase, should see continuous 1 PPS.
adjtime is good for large offset corrections
adjphase is good for small offset corrections to allow HW filter to control the frequency instead of relying on SW filter.
-----END QUOTE-----
https://lore.kernel.org/netdev/20220804132902.GA25315@renesas.com/
Using the mlx5 implementation as a reference, the mlx5 stack provides
the adjphase offset to the device. The device is then able to make the
sudden shift small offsets internally using the device's internal
functionality (offload). For the larger values that are handled using
adjtime, our devices perform just fine when we get the time from the
device, offset that time in the driver stack, and write back the new
time to the device.
>
> The other question is about the exact semantics of ->adjphase
> - do all timecounter based clock implementations support it
> by definition?
My understanding is no (though anyone is free to jump in to correct me
on this). Only implementations with support for precisely handling small
PPS corrections can support adjphase (being able to adjust small offsets
without causing same or worse drift).
next prev parent reply other threads:[~2023-01-20 4:26 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 18:35 [pull request][net-next 00/15] mlx5 updates 2023-01-18 Saeed Mahameed
2023-01-18 18:35 ` [net-next 01/15] net/mlx5e: Suppress Send WQEBB room warning for PAGE_SIZE >= 16KB Saeed Mahameed
2023-01-18 21:31 ` Jacob Keller
2023-01-20 4:00 ` patchwork-bot+netdevbpf
2023-01-18 18:35 ` [net-next 02/15] net/mlx5: Suppress error logging on UCTX creation Saeed Mahameed
2023-01-18 21:32 ` Jacob Keller
2023-01-18 18:35 ` [net-next 03/15] net/mlx5: Add adjphase function to support hardware-only offset control Saeed Mahameed
2023-01-18 21:33 ` Jacob Keller
2023-01-20 3:46 ` Jakub Kicinski
2023-01-20 3:56 ` Rahul Rameshbabu
2023-01-20 4:03 ` Jakub Kicinski
2023-01-20 4:26 ` Rahul Rameshbabu [this message]
2023-01-20 5:08 ` Jakub Kicinski
2023-01-20 5:22 ` Rahul Rameshbabu
2023-01-20 5:45 ` Jakub Kicinski
2023-01-20 6:02 ` Rahul Rameshbabu
2023-01-20 17:21 ` Jacob Keller
2023-01-20 18:00 ` Rahul Rameshbabu
2023-01-20 23:58 ` Jacob Keller
2023-01-21 0:06 ` Jakub Kicinski
2023-01-22 21:11 ` Rahul Rameshbabu
2023-01-23 2:22 ` Richard Cochran
2023-01-23 2:48 ` Rahul Rameshbabu
2023-01-23 2:58 ` Richard Cochran
2023-01-23 18:44 ` Rahul Rameshbabu
2023-01-23 19:13 ` Jacob Keller
2023-01-23 22:39 ` Richard Cochran
2023-01-23 22:36 ` Richard Cochran
2023-01-24 10:33 ` Bar Shapira
2023-01-24 19:15 ` Richard Cochran
2023-01-25 0:48 ` Jakub Kicinski
2023-01-25 2:26 ` Rahul Rameshbabu
2023-01-25 8:28 ` Gal Pressman
2023-01-23 2:15 ` Richard Cochran
2023-01-23 18:14 ` Jacob Keller
2023-01-18 18:35 ` [net-next 04/15] net/mlx5: Add hardware extended range support for PTP adjtime and adjphase Saeed Mahameed
2023-01-18 21:35 ` Jacob Keller
2023-01-18 18:35 ` [net-next 05/15] net/mlx5: E-switch, Remove redundant comment about meta rules Saeed Mahameed
2023-01-18 21:40 ` Jacob Keller
2023-01-18 18:35 ` [net-next 06/15] net/mlx5e: Fail with messages when params are not valid for XSK Saeed Mahameed
2023-01-18 21:41 ` Jacob Keller
2023-01-18 18:35 ` [net-next 07/15] net/mlx5e: Add warning when log WQE size is smaller than log stride size Saeed Mahameed
2023-01-18 21:42 ` Jacob Keller
2023-01-18 18:35 ` [net-next 08/15] net/mlx5e: TC, Pass flow attr to attach/detach mod hdr functions Saeed Mahameed
2023-01-18 21:42 ` Jacob Keller
2023-01-18 18:35 ` [net-next 09/15] net/mlx5e: TC, Add tc prefix to attach/detach " Saeed Mahameed
2023-01-18 21:44 ` Jacob Keller
2023-01-18 18:35 ` [net-next 10/15] net/mlx5e: TC, Use common function allocating flow mod hdr or encap mod hdr Saeed Mahameed
2023-01-18 21:45 ` Jacob Keller
2023-01-18 18:35 ` [net-next 11/15] net/mlx5e: Warn when destroying mod hdr hash table that is not empty Saeed Mahameed
2023-01-18 21:45 ` Jacob Keller
2023-01-18 18:35 ` [net-next 12/15] net/mlx5: E-Switch, Fix typo for egress Saeed Mahameed
2023-01-18 21:46 ` Jacob Keller
2023-01-18 18:36 ` [net-next 13/15] net/mlx5e: Support Geneve and GRE with VF tunnel offload Saeed Mahameed
2023-01-18 21:48 ` Jacob Keller
2023-01-18 18:36 ` [net-next 14/15] net/mlx5e: Remove redundant allocation of spec in create indirect fwd group Saeed Mahameed
2023-01-18 21:50 ` Jacob Keller
2023-01-18 18:36 ` [net-next 15/15] net/mlx5e: Use read lock for eswitch get callbacks Saeed Mahameed
2023-01-18 21:51 ` Jacob Keller
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=87pmb9u90j.fsf@nvidia.com \
--to=rrameshbabu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=saeed@kernel.org \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=vincent.cheng.xh@renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.