From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH v4 tip 3/7] tracing: allow BPF programs to call ktime_get_ns() Date: Sat, 28 Feb 2015 09:21:20 -0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Ingo Molnar , Steven Rostedt , Namhyung Kim , Arnaldo Carvalho de Melo , Jiri Olsa , Masami Hiramatsu , "David S. Miller" , Linux API , Network Development , LKML , Daniel Borkmann To: Peter Zijlstra Return-path: Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Sat, Feb 28, 2015 at 2:20 AM, Peter Zijlstra wrote: >> >> +static u64 bpf_ktime_get_ns(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5) >> +{ >> + return ktime_get_ns(); >> +} > > Please use ktime_get_mono_fast_ns() instead. If you ever want to allow > running BPF stuff from general tracepoints and the like you need to > be NMI safe. good point. will do. Currently in trace_call_bpf() I have: if (in_nmi()) /* not supported yet */ return 1; to tackle nmi after all pieces are in place. Likely nmi-safe programs will have access to reduced set of helper functions.