The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Jordan Rhee <jordanrhee@google.com>
Cc: Harshitha Ramamurthy <hramamurthy@google.com>,
	<netdev@vger.kernel.org>, <joshwash@google.com>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<richardcochran@gmail.com>, <jstultz@google.com>,
	<tglx@kernel.org>, <sboyd@kernel.org>, <willemb@google.com>,
	<nktgrg@google.com>, <jfraker@google.com>, <ziweixiao@google.com>,
	<maolson@google.com>, <thostet@google.com>,
	<alok.a.tiwari@oracle.com>, <pkaligineedi@google.com>,
	<horms@kernel.org>, <dwmw2@infradead.org>, <yyd@google.com>,
	<jefrogers@google.com>, <linux-kernel@vger.kernel.org>,
	Naman Gulati <namangulati@google.com>
Subject: Re: [PATCH net-next v6 3/3] gve: implement PTP gettimex64
Date: Fri, 8 May 2026 14:53:10 -0700	[thread overview]
Message-ID: <01f89483-596e-441b-b48a-f79fb6d5067c@intel.com> (raw)
In-Reply-To: <CA+mzVtu9OVgK3XEsoRsZ3BamQGjBnsdu2cAtesamiDQQi_69sA@mail.gmail.com>

On 5/8/2026 10:43 AM, Jordan Rhee wrote:
> On Thu, May 7, 2026 at 2:23 PM Jacob Keller <jacob.e.keller@intel.com> wrote:
>> On 5/7/2026 2:13 PM, Harshitha Ramamurthy wrote:
>>
>> I'm a bit worried about this part, but if I understand, it would only
>> affect the fallback variant anyways since the clock samples are taken in
>> the host in the precise/fast path.
> 
> Good point, the snapshot *is* used in the precise path to interpolate
> system timestamps that occur before the current timekeeping interval.
> This is my understanding of how historical timestamp interpolation
> works (adjust_historical_crosststamp()).
> 
>         <--      total_history_cycles                      -->
>                                <-- partial_history_cycles -->
> -------|------------------+------------------------------------|----------------+---------->
>  cycles (input)
>   snapshot         sample                               cur_interval        now
> -------|------------------+------------------------------------|----------------+---------->
>  ktime (output)
>         <--                      corr_raw                        -->
> 
> At the start of each timekeeping interval, both the current cycle
> count and ktime are recorded. Each interval boundary consists of a
> (cycle count, ktime) pair.
> 
> It computes the ktime corresponding to sampled cycle count as corr_raw
> * partial_history_cycles / total_history_cycles. In other words, it
> scales the distance between the interval boundaries in ktime units by
> the relative position of the sample in the interval computed using the
> cycle counts. It adds or subtracts this value to whichever interval
> boundary is closer to get the absolute ktime.
> 
> How would this be affected by a very old snapshot? The interpolation
> would still work, but it may be less accurate if the clock is not
> stable. To get a sense of the timescales,
>  - the timekeeping interval is typically 4ms (CONFIG_HZ=250).
>  - the AQ command typically takes 60-80us.
>  - there are 2 sources of contention on the mutex (aux task and gettimex64)
>  - worst case retry loop is 100ms (but this should not happen due to
> how the firmware rate limiter has been tuned)
>  - typical clock stability for the relevant cloud server platforms is
> about 10ppm
> 
> The vast majority of the time, the sample should fall in the current
> or previous timekeeping interval, resulting in the most accurate
> interpolation possible.
> 
> In the worst case for retries and contention, the snapshot could be up
> to 200ms before the current timekeeping interval. Assuming clock
> stability of 10ppm, this translates to 10us of drift per 1s, or 2us
> per 200ms. This is still considerably better than the root dispersion
> in the fallback path (81us), so I think it's OK.
> 
Excellent analysis, and yes I agree that its acceptable.

Thanks,
Jake

  reply	other threads:[~2026-05-08 21:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 21:13 [PATCH net-next v6 0/3] gve: add support for PTP gettimex64 Harshitha Ramamurthy
2026-05-07 21:13 ` [PATCH net-next v6 1/3] gve: skip error logging for retryable AdminQ commands Harshitha Ramamurthy
2026-05-07 21:14   ` Jacob Keller
2026-05-10  4:31     ` Jordan Rhee
2026-05-07 21:13 ` [PATCH net-next v6 2/3] gve: make nic clock reads thread safe Harshitha Ramamurthy
2026-05-07 21:15   ` Jacob Keller
2026-05-07 21:13 ` [PATCH net-next v6 3/3] gve: implement PTP gettimex64 Harshitha Ramamurthy
2026-05-07 21:23   ` Jacob Keller
2026-05-08 17:43     ` Jordan Rhee
2026-05-08 21:53       ` Jacob Keller [this message]
2026-05-10  4:54   ` Jordan Rhee

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=01f89483-596e-441b-b48a-f79fb6d5067c@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=alok.a.tiwari@oracle.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dwmw2@infradead.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=hramamurthy@google.com \
    --cc=jefrogers@google.com \
    --cc=jfraker@google.com \
    --cc=jordanrhee@google.com \
    --cc=joshwash@google.com \
    --cc=jstultz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maolson@google.com \
    --cc=namangulati@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=nktgrg@google.com \
    --cc=pabeni@redhat.com \
    --cc=pkaligineedi@google.com \
    --cc=richardcochran@gmail.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@kernel.org \
    --cc=thostet@google.com \
    --cc=willemb@google.com \
    --cc=yyd@google.com \
    --cc=ziweixiao@google.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