Re: CVS commit: src/sys
[6~ > Also, thinking to use FreeBSD code for validation (plus checking for > memwords we have). It seems to be simpler and faster: > > http://www.netbsd.org/~rmind/bpf_validate.diff It is nice that you point out to comprehensive test suite, but you don't have time nor interest to do anything about it. Of course as a brilliant coder, you don't need any documentation neither. That always tells something about the whole import (at leat where I $WORK). Sorry, had to point out the NetBSD normalities. - Jukka.
Re: CVS commit: src/sys
chris...@astron.com (Christos Zoulas) wrote: > >> > Module Name:src > >> > Committed By: rmind > >> > Date: Wed Aug 1 23:24:29 UTC 2012 > >> > > >> > <...> > >> > > >> > Log Message: > >> [...] > >> > Also, make few BPF fixes and > >> > simplifications while here. > >> [...] > > > >You've added a memset() to clear the scratch memory in > >bpf_filter(). We had this before... the point of > >bpf_validate() is to make sure that the filter program > >doesn't access uninitialized values. The runtime cost > >of clearing the array can thus be avoided. > >Or do you have reason to believe that the validator > >doesn't work as expected? > > Probably this code was copied from FreeBSD without knowing > that the code is tested at runtime. Yes, the whole point > is to not call memset on every invocation... Right, I removed it. Also, thinking to use FreeBSD code for validation (plus checking for memwords we have). It seems to be simpler and faster: http://www.netbsd.org/~rmind/bpf_validate.diff -- Mindaugas
Re: CVS commit: src/sys
Hi Alex, Alexander Nasonov wrote: > Mindaugas Rasiukevicius wrote: > > > Log Message: > > > Add BPF JIT compiler, currently supporting amd64 and i386. Code > > > obtained from FreeBSD. Also, make few BPF fixes and simplifications > > > while here. Note that bpf_jit_enable is false for now. > > I wonder why do you want to generate code yourself while you could use > some jit library? I've almost finished my bpfjit library, I just need > one or two weekends to clean up all mess I made in my local tree while > trying to figure out the best way to integrate my changes into the tree. > Unfortunately, my day job keeps me busy. The code from FreeBSD is pretty small and simple. It is also mature and more widely tested. If we decide to have a generic JIT compiler, like sljit, I think BPF can just be converted to use that. However, sljit is larger and the library is not straightforward to use for in-kernel compilation. Do we need a generic JIT compiler, though? > > FYI: > > > > FreeBSD has quite comprehensive regression tests for BPF. With some > > changes they run on NetBSD. > > I have tests too. See https://github.com/alnsn/bpfjit > > Alex -- Mindaugas
Re: CVS commit: src/sys/modules/bpf
On Thu, Aug 02, 2012 at 01:32:27AM +0100, Mindaugas Rasiukevicius wrote: > "Matt Thomas" wrote: > > Module Name:src > > Committed By: matt > > Date: Thu Aug 2 00:22:32 UTC 2012 > > > > Modified Files: > > src/sys/modules/bpf: Makefile > > > > Log Message: > > Add missing paren. > > > > > > To generate a diff of this commit: > > cvs rdiff -u -r1.2 -r1.3 src/sys/modules/bpf/Makefile > > Seems that make ignored the syntax error in .if statement, as it compiles > on e.g. x86 where the first check is true. Is this a bug in make? Possibly a side effect of the .if 'short circuiting' of && and ||. David -- David Laight: da...@l8s.co.uk
Re: CVS commit: src/sys
In article <20120802145819.331e6919@zelz27>, Matthias Drochner wrote: > >On Thu, 2 Aug 2012 02:15:08 +0100 >Mindaugas Rasiukevicius wrote: >> "Mindaugas Rasiukevicius" wrote: >> > Module Name:src >> > Committed By: rmind >> > Date: Wed Aug 1 23:24:29 UTC 2012 >> > >> > <...> >> > >> > Log Message: >> [...] >> > Also, make few BPF fixes and >> > simplifications while here. >> [...] > >You've added a memset() to clear the scratch memory in >bpf_filter(). We had this before... the point of >bpf_validate() is to make sure that the filter program >doesn't access uninitialized values. The runtime cost >of clearing the array can thus be avoided. >Or do you have reason to believe that the validator >doesn't work as expected? Probably this code was copied from FreeBSD without knowing that the code is tested at runtime. Yes, the whole point is to not call memset on every invocation... christos
Re: CVS commit: src/sys
On Thu, 2 Aug 2012 02:15:08 +0100 Mindaugas Rasiukevicius wrote: > "Mindaugas Rasiukevicius" wrote: > > Module Name:src > > Committed By: rmind > > Date: Wed Aug 1 23:24:29 UTC 2012 > > > > <...> > > > > Log Message: > [...] > > Also, make few BPF fixes and > > simplifications while here. > [...] You've added a memset() to clear the scratch memory in bpf_filter(). We had this before... the point of bpf_validate() is to make sure that the filter program doesn't access uninitialized values. The runtime cost of clearing the array can thus be avoided. Or do you have reason to believe that the validator doesn't work as expected? best regards Matthias Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt, Prof. Dr. Sebastian M. Schmidt Kennen Sie schon unsere app? http://www.fz-juelich.de/app
Re: CVS commit: src/sys
Mindaugas Rasiukevicius wrote: > > Log Message: > > Add BPF JIT compiler, currently supporting amd64 and i386. Code obtained > > from FreeBSD. Also, make few BPF fixes and simplifications while here. > > Note that bpf_jit_enable is false for now. I wonder why do you want to generate code yourself while you could use some jit library? I've almost finished my bpfjit library, I just need one or two weekends to clean up all mess I made in my local tree while trying to figure out the best way to integrate my changes into the tree. Unfortunately, my day job keeps me busy. > FYI: > > FreeBSD has quite comprehensive regression tests for BPF. With some > changes they run on NetBSD. I have tests too. See https://github.com/alnsn/bpfjit Alex