On Tue, Mar 16, 2021 at 9:21 PM Cong Wang <xiyou.wangcong@xxxxxxxxx> wrote: > We still need a timer map: > > struct { > __uint(type, BPF_MAP_TYPE_TIMER); > } map SEC(".maps"); > > However, its key is not a pointer to timer, it is a timer ID allocated with > > u32 bpf_timer_create(void *callback, void *arg, u64 flags); Hmm, we do not need a map at all, because the verifier could check whether create() and delete() are paired correctly, so we can just have the following API's: u32 bpf_timer_create(void *callback, void *arg, u32 flags); void bpf_timer_settime(u32 id, u64 expires); u64 bpf_timer_gettime(u32 id); int bpf_timer_delete(u32 id); Pretty much similar to Linux user-space timer API's. I will probably go this direction, unless there is any objection. Thanks.