Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-15 Thread Cong Wang
On Wed, Apr 14, 2021 at 9:25 PM Alexei Starovoitov wrote: > > As I said earlier: > " > If prog refers such hmap as above during prog free the kernel does > for_each_map_elem {if (elem->opaque) del_timer().} > " This goes back to our previous discussion. Forcing timer deletions on prog exit is not

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-14 Thread Alexei Starovoitov
On Wed, Apr 14, 2021 at 9:02 PM Cong Wang wrote: > > On Mon, Apr 12, 2021 at 4:01 PM Alexei Starovoitov > wrote: > > > > On Mon, Apr 05, 2021 at 05:36:27PM -0700, Cong Wang wrote: > > > On Fri, Apr 2, 2021 at 4:45 PM Alexei Starovoitov > > > wrote: > > > > > > > > On Fri, Apr 02, 2021 at 02:24:5

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-14 Thread Cong Wang
On Mon, Apr 12, 2021 at 4:01 PM Alexei Starovoitov wrote: > > On Mon, Apr 05, 2021 at 05:36:27PM -0700, Cong Wang wrote: > > On Fri, Apr 2, 2021 at 4:45 PM Alexei Starovoitov > > wrote: > > > > > > On Fri, Apr 02, 2021 at 02:24:51PM -0700, Cong Wang wrote: > > > > > > where the key is the timer I

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-12 Thread Alexei Starovoitov
On Mon, Apr 05, 2021 at 05:36:27PM -0700, Cong Wang wrote: > On Fri, Apr 2, 2021 at 4:45 PM Alexei Starovoitov > wrote: > > > > On Fri, Apr 02, 2021 at 02:24:51PM -0700, Cong Wang wrote: > > > > > where the key is the timer ID and the value is the timer expire > > > > > timer. > > > > > > > > The

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-08 Thread Cong Wang
On Tue, Apr 6, 2021 at 4:36 PM Song Liu wrote: > I am not sure whether this makes sense. I feel there is still some > misunderstanding. It will be helpful if you can share more information > about the overall design. > > BTW: this could be a good topic for the BPF office hour. See more details > h

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-06 Thread Song Liu
> On Apr 6, 2021, at 9:48 AM, Cong Wang wrote: > > On Mon, Apr 5, 2021 at 11:18 PM Song Liu wrote: >> >> >> >>> On Apr 5, 2021, at 6:24 PM, Cong Wang wrote: >>> >>> On Mon, Apr 5, 2021 at 6:08 PM Song Liu wrote: > On Apr 5, 2021, at 4:49 PM, Cong Wang wrote: >

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-06 Thread Cong Wang
On Mon, Apr 5, 2021 at 11:18 PM Song Liu wrote: > > > > > On Apr 5, 2021, at 6:24 PM, Cong Wang wrote: > > > > On Mon, Apr 5, 2021 at 6:08 PM Song Liu wrote: > >> > >> > >> > >>> On Apr 5, 2021, at 4:49 PM, Cong Wang wrote: > >>> > >>> On Fri, Apr 2, 2021 at 4:31 PM Song Liu wrote: > > >>

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-05 Thread Song Liu
> On Apr 5, 2021, at 6:24 PM, Cong Wang wrote: > > On Mon, Apr 5, 2021 at 6:08 PM Song Liu wrote: >> >> >> >>> On Apr 5, 2021, at 4:49 PM, Cong Wang wrote: >>> >>> On Fri, Apr 2, 2021 at 4:31 PM Song Liu wrote: > On Apr 2, 2021, at 1:57 PM, Cong Wang wrote: >

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-05 Thread Cong Wang
On Mon, Apr 5, 2021 at 6:08 PM Song Liu wrote: > > > > > On Apr 5, 2021, at 4:49 PM, Cong Wang wrote: > > > > On Fri, Apr 2, 2021 at 4:31 PM Song Liu wrote: > >> > >> > >> > >>> On Apr 2, 2021, at 1:57 PM, Cong Wang wrote: > >>> > >>> Ideally I even prefer to create timers in kernel-space too,

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-05 Thread Song Liu
> On Apr 5, 2021, at 4:49 PM, Cong Wang wrote: > > On Fri, Apr 2, 2021 at 4:31 PM Song Liu wrote: >> >> >> >>> On Apr 2, 2021, at 1:57 PM, Cong Wang wrote: >>> >>> Ideally I even prefer to create timers in kernel-space too, but as I already >>> explained, this seems impossible to me. >>

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-05 Thread Cong Wang
On Fri, Apr 2, 2021 at 4:45 PM Alexei Starovoitov wrote: > > On Fri, Apr 02, 2021 at 02:24:51PM -0700, Cong Wang wrote: > > > > where the key is the timer ID and the value is the timer expire > > > > timer. > > > > > > The timer ID is unnecessary. We cannot introduce new IDR for every new > > > bp

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-05 Thread Cong Wang
On Fri, Apr 2, 2021 at 4:31 PM Song Liu wrote: > > > > > On Apr 2, 2021, at 1:57 PM, Cong Wang wrote: > > > > Ideally I even prefer to create timers in kernel-space too, but as I already > > explained, this seems impossible to me. > > Would hrtimer (include/linux/hrtimer.h) work? By impossible,

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Alexei Starovoitov
On Fri, Apr 02, 2021 at 02:24:51PM -0700, Cong Wang wrote: > > > where the key is the timer ID and the value is the timer expire > > > timer. > > > > The timer ID is unnecessary. We cannot introduce new IDR for every new > > bpf object. It doesn't scale. > > The IDR is per map, not per timer. Per

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Song Liu
> On Apr 2, 2021, at 1:57 PM, Cong Wang wrote: > > On Fri, Apr 2, 2021 at 12:45 PM Song Liu wrote: >> >> >> >>> On Apr 2, 2021, at 12:08 PM, Cong Wang wrote: >>> >>> On Fri, Apr 2, 2021 at 10:57 AM Song Liu wrote: > On Apr 2, 2021, at 10:34 AM, Cong Wang wrote: >>

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Cong Wang
On Fri, Apr 2, 2021 at 12:28 PM Alexei Starovoitov wrote: > > On Wed, Mar 31, 2021 at 09:26:35PM -0700, Cong Wang wrote: > > > This patch introduces a bpf timer map and a syscall to create bpf timer > > from user-space. > > That will severely limit timer api usability. > I agree with Song here. If

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Cong Wang
On Fri, Apr 2, 2021 at 12:45 PM Song Liu wrote: > > > > > On Apr 2, 2021, at 12:08 PM, Cong Wang wrote: > > > > On Fri, Apr 2, 2021 at 10:57 AM Song Liu wrote: > >> > >> > >> > >>> On Apr 2, 2021, at 10:34 AM, Cong Wang wrote: > >>> > >>> On Thu, Apr 1, 2021 at 1:17 PM Song Liu wrote: > >

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Song Liu
> On Apr 2, 2021, at 12:08 PM, Cong Wang wrote: > > On Fri, Apr 2, 2021 at 10:57 AM Song Liu wrote: >> >> >> >>> On Apr 2, 2021, at 10:34 AM, Cong Wang wrote: >>> >>> On Thu, Apr 1, 2021 at 1:17 PM Song Liu wrote: > On Apr 1, 2021, at 10:28 AM, Cong Wang wrote: >>

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Alexei Starovoitov
On Wed, Mar 31, 2021 at 09:26:35PM -0700, Cong Wang wrote: > This patch introduces a bpf timer map and a syscall to create bpf timer > from user-space. That will severely limit timer api usability. I agree with Song here. If user space has to create it there is no reason to introduce new sys_bpf

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Cong Wang
On Fri, Apr 2, 2021 at 10:57 AM Song Liu wrote: > > > > > On Apr 2, 2021, at 10:34 AM, Cong Wang wrote: > > > > On Thu, Apr 1, 2021 at 1:17 PM Song Liu wrote: > >> > >> > >> > >>> On Apr 1, 2021, at 10:28 AM, Cong Wang wrote: > >>> > >>> On Wed, Mar 31, 2021 at 11:38 PM Song Liu wrote: >

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Song Liu
> On Apr 2, 2021, at 10:34 AM, Cong Wang wrote: > > On Thu, Apr 1, 2021 at 1:17 PM Song Liu wrote: >> >> >> >>> On Apr 1, 2021, at 10:28 AM, Cong Wang wrote: >>> >>> On Wed, Mar 31, 2021 at 11:38 PM Song Liu wrote: > On Mar 31, 2021, at 9:26 PM, Cong Wang wrote: >

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-02 Thread Cong Wang
On Thu, Apr 1, 2021 at 1:17 PM Song Liu wrote: > > > > > On Apr 1, 2021, at 10:28 AM, Cong Wang wrote: > > > > On Wed, Mar 31, 2021 at 11:38 PM Song Liu wrote: > >> > >> > >> > >>> On Mar 31, 2021, at 9:26 PM, Cong Wang wrote: > >>> > >>> From: Cong Wang > >>> > >>> (This patch is still in ear

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-01 Thread Song Liu
> On Apr 1, 2021, at 10:28 AM, Cong Wang wrote: > > On Wed, Mar 31, 2021 at 11:38 PM Song Liu wrote: >> >> >> >>> On Mar 31, 2021, at 9:26 PM, Cong Wang wrote: >>> >>> From: Cong Wang >>> >>> (This patch is still in early stage and obviously incomplete. I am sending >>> it out to get s

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-04-01 Thread Cong Wang
On Wed, Mar 31, 2021 at 11:38 PM Song Liu wrote: > > > > > On Mar 31, 2021, at 9:26 PM, Cong Wang wrote: > > > > From: Cong Wang > > > > (This patch is still in early stage and obviously incomplete. I am sending > > it out to get some high-level feedbacks. Please kindly ignore any coding > > det

Re: [RFC Patch bpf-next] bpf: introduce bpf timer

2021-03-31 Thread Song Liu
> On Mar 31, 2021, at 9:26 PM, Cong Wang wrote: > > From: Cong Wang > > (This patch is still in early stage and obviously incomplete. I am sending > it out to get some high-level feedbacks. Please kindly ignore any coding > details for now and focus on the design.) Could you please explain

[RFC Patch bpf-next] bpf: introduce bpf timer

2021-03-31 Thread Cong Wang
From: Cong Wang (This patch is still in early stage and obviously incomplete. I am sending it out to get some high-level feedbacks. Please kindly ignore any coding details for now and focus on the design.) This patch introduces a bpf timer map and a syscall to create bpf timer from user-space.