[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzYMaU14=5bzzasAANJW7w2pNxHZOMDwsDF_btVWvf9ADA@mail.gmail.com>
Date: Mon, 27 Jul 2020 22:01:41 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: bimmy.pujari@...el.com
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
mchehab@...nel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin Lau <kafai@...com>, maze@...gle.com,
ashkan.nikravesh@...el.com
Subject: Re: [PATCH] bpf: Add bpf_ktime_get_real_ns
On Mon, Jul 27, 2020 at 4:35 PM <bimmy.pujari@...el.com> wrote:
>
> From: Ashkan Nikravesh <ashkan.nikravesh@...el.com>
>
> The existing bpf helper functions to get timestamp return the time
> elapsed since system boot. This timestamp is not particularly useful
> where epoch timestamp is required or more than one server is involved
> and time sync is required. Instead, you want to use CLOCK_REALTIME,
> which provides epoch timestamp.
> Hence add bfp_ktime_get_real_ns() based around CLOCK_REALTIME.
>
This doesn't seem like a good idea. With time-since-boot it's very
easy to translate timestamp into a real time on the host. Having
get_real_ns() variant might just encourage people to assume precise
wall-clock timestamps that can be compared between within or even
across different hosts. REALCLOCK can jump around, you can get
duplicate timestamps, timestamps can go back in time, etc. It's just
not a good way to measure time.
Also, you mention the need for time sync. It's an extremely hard thing
to have synchronized time between two different physical hosts, as
anyone that has dealt with distributed systems will attest. Having
this helper will just create a dangerous illusion that it is possible
and will just cause more problems down the road for people.
> Signed-off-by: Ashkan Nikravesh <ashkan.nikravesh@...el.com>
> Signed-off-by: Bimmy Pujari <bimmy.pujari@...el.com>
> ---
> drivers/media/rc/bpf-lirc.c | 2 ++
> include/linux/bpf.h | 1 +
> include/uapi/linux/bpf.h | 7 +++++++
> kernel/bpf/core.c | 1 +
> kernel/bpf/helpers.c | 14 ++++++++++++++
> kernel/trace/bpf_trace.c | 2 ++
> tools/include/uapi/linux/bpf.h | 7 +++++++
> 7 files changed, 34 insertions(+)
[...]
Powered by blists - more mailing lists