lkml.org 
[lkml]   [2020]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] net: bpf: add bpf_ktime_get_boot_ns()
On Sun, Apr 26, 2020 at 9:31 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Mon, Apr 20, 2020 at 01:26:43PM -0700, Maciej Żenczykowski wrote:
> > From: Maciej Żenczykowski <maze@google.com>
> >
> > On a device like a cellphone which is constantly suspending
> > and resuming CLOCK_MONOTONIC is not particularly useful for
> > keeping track of or reacting to external network events.
> > Instead you want to use CLOCK_BOOTTIME.
> >
> > Hence add bpf_ktime_get_boot_ns() as a mirror of bpf_ktime_get_ns()
> > based around CLOCK_BOOTTIME instead of CLOCK_MONOTONIC.
> >
> > Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ...
> > diff --git a/net/core/filter.c b/net/core/filter.c
> > index 755867867e57..ec567d1e6fb9 100644
> > --- a/net/core/filter.c
> > +++ b/net/core/filter.c
> > @@ -6009,6 +6009,8 @@ bpf_base_func_proto(enum bpf_func_id func_id)
> > return &bpf_tail_call_proto;
> > case BPF_FUNC_ktime_get_ns:
> > return &bpf_ktime_get_ns_proto;
> > + case BPF_FUNC_ktime_get_boot_ns:
> > + return &bpf_ktime_get_boot_ns_proto;
> > default:
> > break;
> > }
>
> That part got moved into kernel/bpf/helpers.c in the mean time.
> I fixed it up and applied. Thanks
>
> In the future please cc bpf@vger for all bpf related patches.

The order of comments for bpf_ktime_get_boot_ns
was also incorrect.
Most selftests were broken.
I fixed it up as well.

\
 
 \ /
  Last update: 2020-04-26 18:49    [W:0.071 / U:0.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site