From: Richard Cochran <richardcochran@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Sagi Maimon <maimon.sagi@gmail.com>,
Andy Lutomirski <luto@kernel.org>,
tglx@linutronix.de, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Peter Zijlstra <peterz@infradead.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Sohil Mehta <sohil.mehta@intel.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Nhat Pham <nphamcs@gmail.com>, Palmer Dabbelt <palmer@sifive.com>,
Kees Cook <keescook@chromium.org>,
Alexey Gladkov <legion@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
Linux-Arch <linux-arch@vger.kernel.org>,
Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v3] posix-timers: add multi_clock_gettime system call
Date: Wed, 10 Jan 2024 23:31:00 -0800 [thread overview]
Message-ID: <ZZ-ZNHgDsZwg9CaW@hoboy.vegasvil.org> (raw)
In-Reply-To: <84d8e9d7-09ce-4781-8dfa-a74bb0955ae8@app.fastmail.com>
On Tue, Jan 02, 2024 at 12:29:59PM +0100, Arnd Bergmann wrote:
> I think Andy's suggestion of exposing time offsets instead
> of absolute times would actually achieve that: If the
> interface is changed to return the offset against
> CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW or CLOCK_BOOTTIME
> (not sure what is best here), then the new syscall can use
> getcrosststamp() where supported for the best results or
> fall back to gettimex64() or gettime64() otherwise to
> provide a consistent user interface.
Yes, it makes more sense to provide the offset, since that is what the
user needs in the end.
Can we change the name of the system call to "clock compare"?
int clock_compare(clockid_t a, clockid_t b,
int64_t *offset, int64_t *error);
returns: zero or error code,
offset = a - b
error = maximum error due to asymmetry
If clocks a and b are both System-V clocks, then *error=0 and *offset
can be returned directly from the kernel's time keeping state.
If getcrosststamp() is supported on a or b, then invoke it.
otherwise do this:
t1 = gettime(a)
t2 = gettime(b)
t3 - gettime(c)
*offset = (t1 + t3)/2 - t2
*error = (t3 - t1)/2
There is no need for repeated measurement, since user space can call
again when `error` is unacceptable.
Thanks,
Richard
next prev parent reply other threads:[~2024-01-11 7:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 12:24 [PATCH v3] posix-timers: add multi_clock_gettime system call Sagi Maimon
2023-12-29 3:21 ` kernel test robot
2023-12-29 4:03 ` kernel test robot
2023-12-29 15:26 ` Arnd Bergmann
2023-12-31 16:00 ` Sagi Maimon
2024-01-02 11:29 ` Arnd Bergmann
2024-01-07 14:05 ` Sagi Maimon
2024-01-11 7:31 ` Richard Cochran [this message]
2024-01-15 15:49 ` Sagi Maimon
2024-01-15 23:41 ` Richard Cochran
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=ZZ-ZNHgDsZwg9CaW@hoboy.vegasvil.org \
--to=richardcochran@gmail.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=geert@linux-m68k.org \
--cc=hannes@cmpxchg.org \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=legion@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=maimon.sagi@gmail.com \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nphamcs@gmail.com \
--cc=palmer@sifive.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=sohil.mehta@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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