Re: Simplify NET_LOCK() variations

2020-04-28 Thread Alexandr Nedvedicky
Hello, > That's a bug, updated diff below. > OK I see. the diff looks better then. > If there's a consensus that this is a way to move forward, it would make > sense to commit it after unlock. > I have not spot anything else. I think this change should go in. OK sashan@

Re: Simplify NET_LOCK() variations

2020-04-27 Thread Martin Pieuchot
On 16/04/20(Thu) 11:08, Alexandr Nedvedicky wrote: > [...] > > @@ -356,7 +367,17 @@ taskq_thread(void *xtq) > > { > > struct taskq *tq = xtq; > > struct task work; > > - int last; > > + int last, i; > > + > > + mtx_enter(>tq_mtx); > > + for (i = 0; i < tq->tq_nthreads; i++) { > >

Re: Simplify NET_LOCK() variations

2020-04-16 Thread Alexandr Nedvedicky
Hello, On Thu, Apr 16, 2020 at 10:57:42AM +0200, Martin Pieuchot wrote: > On 14/04/20(Tue) 10:08, Martin Pieuchot wrote: > > On 13/04/20(Mon) 03:20, Alexandr Nedvedicky wrote: > > > On Sun, Apr 12, 2020 at 07:02:43PM +0200, Mark Kettenis wrote: > > > > > From: "Theo de Raadt" > > > > > Date:

Re: Simplify NET_LOCK() variations

2020-04-16 Thread Martin Pieuchot
On 14/04/20(Tue) 10:08, Martin Pieuchot wrote: > On 13/04/20(Mon) 03:20, Alexandr Nedvedicky wrote: > > On Sun, Apr 12, 2020 at 07:02:43PM +0200, Mark Kettenis wrote: > > > > From: "Theo de Raadt" > > > > Date: Sun, 12 Apr 2020 10:28:59 -0600 > > > > > > > > > + if ((p->p_flag & P_SYSTEM) &&

Re: Simplify NET_LOCK() variations

2020-04-14 Thread Martin Pieuchot
On 14/04/20(Tue) 10:47, Claudio Jeker wrote: > On Tue, Apr 14, 2020 at 10:08:54AM +0200, Martin Pieuchot wrote: > > Thanks for all the inputs, updated diff below. > > > > On 13/04/20(Mon) 03:20, Alexandr Nedvedicky wrote: > > > On Sun, Apr 12, 2020 at 07:02:43PM +0200, Mark Kettenis wrote: > > >

Re: Simplify NET_LOCK() variations

2020-04-14 Thread Claudio Jeker
On Tue, Apr 14, 2020 at 10:08:54AM +0200, Martin Pieuchot wrote: > Thanks for all the inputs, updated diff below. > > On 13/04/20(Mon) 03:20, Alexandr Nedvedicky wrote: > > On Sun, Apr 12, 2020 at 07:02:43PM +0200, Mark Kettenis wrote: > > > > From: "Theo de Raadt" > > > > Date: Sun, 12 Apr 2020

Re: Simplify NET_LOCK() variations

2020-04-14 Thread Martin Pieuchot
Thanks for all the inputs, updated diff below. On 13/04/20(Mon) 03:20, Alexandr Nedvedicky wrote: > On Sun, Apr 12, 2020 at 07:02:43PM +0200, Mark Kettenis wrote: > > > From: "Theo de Raadt" > > > Date: Sun, 12 Apr 2020 10:28:59 -0600 > > > > > > > + if ((p->p_flag & P_SYSTEM) && > > > > +

Re: Simplify NET_LOCK() variations

2020-04-12 Thread Alexandr Nedvedicky
Hallo, On Sun, Apr 12, 2020 at 07:02:43PM +0200, Mark Kettenis wrote: > > From: "Theo de Raadt" > > Date: Sun, 12 Apr 2020 10:28:59 -0600 > > > > > + if ((p->p_flag & P_SYSTEM) && > > > + (strncmp(p->p_p->ps_comm, "softnet", 7) == 0)) > > > > Wow that is ugly. > > A better

Re: Simplify NET_LOCK() variations

2020-04-12 Thread Mark Kettenis
> From: "Theo de Raadt" > Date: Sun, 12 Apr 2020 10:28:59 -0600 > > > + if ((p->p_flag & P_SYSTEM) && > > + (strncmp(p->p_p->ps_comm, "softnet", 7) == 0)) > > Wow that is ugly. A better approach might be to store a pointer to the softnet task's struct proc in a global variable

Re: Simplify NET_LOCK() variations

2020-04-12 Thread Theo de Raadt
> + if ((p->p_flag & P_SYSTEM) && > + (strncmp(p->p_p->ps_comm, "softnet", 7) == 0)) Wow that is ugly.

Re: Simplify NET_LOCK() variations

2020-04-12 Thread Mark Kettenis
> Date: Sun, 12 Apr 2020 14:38:55 + > From: Visa Hankala > > On Sun, Apr 12, 2020 at 03:26:14PM +0200, Martin Pieuchot wrote: > > The existing variations of the NET_LOCK() macros are confusing. We're > > now all aware of this fact. So let's keep them simple to prevent future > > mistakes

Re: Simplify NET_LOCK() variations

2020-04-12 Thread Visa Hankala
On Sun, Apr 12, 2020 at 03:26:14PM +0200, Martin Pieuchot wrote: > The existing variations of the NET_LOCK() macros are confusing. We're > now all aware of this fact. So let's keep them simple to prevent future > mistakes :) > > The diff below reduces the current set of methods to the

Re: Simplify NET_LOCK() variations

2020-04-12 Thread Vitaliy Makkoveev
> On 12 Apr 2020, at 16:26, Martin Pieuchot wrote: > > The existing variations of the NET_LOCK() macros are confusing. We're > now all aware of this fact. So let's keep them simple to prevent future > mistakes :) > > The diff below reduces the current set of methods to the following: > >

Simplify NET_LOCK() variations

2020-04-12 Thread Martin Pieuchot
The existing variations of the NET_LOCK() macros are confusing. We're now all aware of this fact. So let's keep them simple to prevent future mistakes :) The diff below reduces the current set of methods to the following: NET_LOCK()/NET_UNLOCK() NET_ASSERT_LOCKED()