Re: radix lookup w/o KERNEL_LOCK()

2017-06-09 Thread Alexander Bluhm
On Fri, Jun 09, 2017 at 04:40:18PM +0200, Martin Pieuchot wrote: > Now with the correct diff: OK bluhm@ > > Index: net/radix.c > === > RCS file: /cvs/src/sys/net/radix.c,v > retrieving revision 1.56 > diff -u -p -r1.56 radix.c >

Re: radix lookup w/o KERNEL_LOCK()

2017-06-09 Thread Martin Pieuchot
On 09/06/17(Fri) 16:23, Martin Pieuchot wrote: > On 09/06/17(Fri) 15:46, Alexander Bluhm wrote: > > On Fri, Jun 09, 2017 at 03:11:05PM +0200, Martin Pieuchot wrote: > > > > The static variable last_zeroed does not look MP safe. If I get > > > > this code correctly it is only an optimization to

Re: radix lookup w/o KERNEL_LOCK()

2017-06-09 Thread Alexander Bluhm
On Fri, Jun 09, 2017 at 04:23:13PM +0200, Martin Pieuchot wrote: > I couldn't convince myself that rn_search() do not check bits > after 'mlen' so I added the memset() as you suggested. It looks like you forgot to put the memset() in the diff. > @@ -432,14 +440,10 @@ rn_addmask(void *n_arg, int

Re: radix lookup w/o KERNEL_LOCK()

2017-06-09 Thread Martin Pieuchot
On 09/06/17(Fri) 15:46, Alexander Bluhm wrote: > On Fri, Jun 09, 2017 at 03:11:05PM +0200, Martin Pieuchot wrote: > > > The static variable last_zeroed does not look MP safe. If I get > > > this code correctly it is only an optimization to avoid multiple > > > zeroing in addmask_key. This does

Re: radix lookup w/o KERNEL_LOCK()

2017-06-09 Thread Alexander Bluhm
On Fri, Jun 09, 2017 at 03:11:05PM +0200, Martin Pieuchot wrote: > > The static variable last_zeroed does not look MP safe. If I get > > this code correctly it is only an optimization to avoid multiple > > zeroing in addmask_key. This does not work anyway with addmask_key > > on the stack. > >

Re: radix lookup w/o KERNEL_LOCK()

2017-06-09 Thread Martin Pieuchot
On 08/06/17(Thu) 23:46, Alexander Bluhm wrote: > On Tue, Jun 06, 2017 at 03:36:12PM +0200, Martin Pieuchot wrote: > > +#define SALEN(sa) (*(u_char *)sa) > > Put () around macro arguments. > #define SALEN(sa) (*(u_char *)(sa)) Done. > > -int > > +static int > > rn_refines(void *m_arg, void

Re: radix lookup w/o KERNEL_LOCK()

2017-06-08 Thread Alexander Bluhm
On Tue, Jun 06, 2017 at 03:36:12PM +0200, Martin Pieuchot wrote: > +#define SALEN(sa)(*(u_char *)sa) Put () around macro arguments. #define SALEN(sa) (*(u_char *)(sa)) > -int > +static int > rn_refines(void *m_arg, void *n_arg) > -int > +static int > rn_inithead0(struct

radix lookup w/o KERNEL_LOCK()

2017-06-06 Thread Martin Pieuchot
One of the reasons IPsec still requires the KERNEL_LOCK() in the forwarding path is that it uses the radix tree for the SPD lookup. Since the radix code is used by other subsystems (NFS export list, PIPEX, PF) we want it to be able to run on parallel, at least when callers aren't manipulating the