Re: amd64 kernel, i386 userland

2014-01-29 Thread Emmanuel Dreyfus
Hi Any objections remaining against this being committed? On Sat, Jan 25, 2014 at 05:18:16PM +0100, Emmanuel Dreyfus wrote: Index: sys/kern/kern_exec.c === RCS file: /cvsroot/src/sys/kern/kern_exec.c,v retrieving revision 1.369

compat_netbsd32 swapctl

2014-01-29 Thread Emmanuel Dreyfus
Hi swapctl() netbsd32 emulation breaks for SWAP_STATS if there are multiple swaps to report. The reason is that compiler padding is different on i386 and amd64: struct swapent is 1049 bytes long, and it gets padded to 1052 on i386 (4 bytes alignement) and 1056 on amd64 (8 bytes alignement) The

Re: compat_netbsd32 swapctl

2014-01-29 Thread Martin Husemann
On Wed, Jan 29, 2014 at 10:42:14AM +, Emmanuel Dreyfus wrote: The solution is for netbsd32_swapctl() to call sys_swapctl() for each individual record, but it needs to know the i386 size for struct swapent. I suspect there is a macro for that. Someone knows? Tricky. You could define

Re: compat_netbsd32 swapctl

2014-01-29 Thread Martin Husemann
On Wed, Jan 29, 2014 at 11:54:29AM +0100, Martin Husemann wrote: You could define swapent32 with se_dev split into two 32bit halves and do full conversion back and forth, but better check what alignment mips and sparc would require here first. I verified i386 uses 4 byte, sparc uses 8 byte. I

Re: compat_netbsd32 swapctl

2014-01-29 Thread Martin Husemann
On Wed, Jan 29, 2014 at 12:06:39PM +0100, Martin Husemann wrote: On Wed, Jan 29, 2014 at 11:54:29AM +0100, Martin Husemann wrote: You could define swapent32 with se_dev split into two 32bit halves and do full conversion back and forth, but better check what alignment mips and sparc would

Re: compat_netbsd32 swapctl

2014-01-29 Thread Emmanuel Dreyfus
Martin Husemann mar...@duskware.de wrote: So: please fix it only for amd64/i386, it aint broken for the others. There is no way to discover the alignment used from within the code? I can only define a magic number? -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org

Re: quota2 grace time

2014-01-29 Thread Edgar Fuß
I've been running my patch to correctly set the quota2 grace time in production for four months now. Any chance to get it integrated? Shall I file a PR?

Re: compat_netbsd32 swapctl

2014-01-29 Thread Martin Husemann
On Wed, Jan 29, 2014 at 01:40:42PM +0100, Emmanuel Dreyfus wrote: There is no way to discover the alignment used from within the code? I can only define a magic number? You can find out how much the current compiler (amd64) aligns, but I don't know of a way to find that out about the 32bit

Re: compat_netbsd32 swapctl

2014-01-29 Thread Emmanuel Dreyfus
On Wed, Jan 29, 2014 at 01:48:35PM +0100, Martin Husemann wrote: My vote for this special case: hard code it #ifdef __x86_64__. If we run into other instances, we can add a define (like: DEV_T_ALIGN_32). Here is a patch that fixes the problem. Index: sys/compat/netbsd32/netbsd32_netbsd.c

pre-configure module initialization

2014-01-29 Thread Taylor R Campbell
If I have a module that needs to run some code to set up some data structures before I can configure a device, I would like to use code that looks like the following. This works for modules compiled separately, but for builtin modules, it doesn't, because the kernel runs configure long before it

Re: pre-configure module initialization

2014-01-29 Thread Martin Husemann
On Wed, Jan 29, 2014 at 04:01:47PM +, Taylor R Campbell wrote: What to do? Create a new modcmt_t like MODULE_CMD_PREINIT and have that called very early in init_main and when loading a module just before MODULE_CMD_INIT? Martin

Re: compat_netbsd32 swapctl

2014-01-29 Thread David Holland
On Wed, Jan 29, 2014 at 03:37:13PM +, Emmanuel Dreyfus wrote: +panic(unexpected cmd = %d, SCARG(ua, cmd)); panic on garbage from userland really isn't the ticket. -- David A. Holland dholl...@netbsd.org

Re: compat_netbsd32 swapctl

2014-01-29 Thread David Holland
On Wed, Jan 29, 2014 at 05:45:51PM +, David Holland wrote: On Wed, Jan 29, 2014 at 03:37:13PM +, Emmanuel Dreyfus wrote: + panic(unexpected cmd = %d, SCARG(ua, cmd)); panic on garbage from userland really isn't the ticket. ok, so that is actually checked

Re: quota2 grace time

2014-01-29 Thread David Holland
On Wed, Jan 29, 2014 at 01:47:36PM +0100, Edgar Fu? wrote: I've been running my patch to correctly set the quota2 grace time in production for four months now. Any chance to get it integrated? Shall I file a PR? That should have been committed, I think it flew under my radar and/or I

Re: compat_netbsd32 swapctl

2014-01-29 Thread David Laight
On Wed, Jan 29, 2014 at 11:54:29AM +0100, Martin Husemann wrote: On Wed, Jan 29, 2014 at 10:42:14AM +, Emmanuel Dreyfus wrote: The solution is for netbsd32_swapctl() to call sys_swapctl() for each individual record, but it needs to know the i386 size for struct swapent. I suspect there

Re: compat_netbsd32 swapctl

2014-01-29 Thread David Holland
On Wed, Jan 29, 2014 at 06:26:14PM +, David Laight wrote: There is a 64bit integer type that has an alignment requirement of 8. If that is used instead of a normal 64bit type then the structure alignement under amd64 matches that of i386. Also, if nothing else, the structure should be

Re: compat_netbsd32 swapctl

2014-01-29 Thread Paul_Koning
On Wed, Jan 29, 2014 at 06:26:14PM +, David Laight wrote: There is a 64bit integer type that has an alignment requirement of 8. If that is used instead of a normal 64bit type then the structure alignement under amd64 matches that of i386. The easiest way to get such alignment is to ask for

Re: quota2 grace time

2014-01-29 Thread Manuel Bouyer
On Wed, Jan 29, 2014 at 01:47:36PM +0100, Edgar Fuß wrote: I've been running my patch to correctly set the quota2 grace time in production for four months now. Any chance to get it integrated? Shall I file a PR? I just commited it to HEAD. Sorry for the delay; in fact your last message on the

Re: compat_netbsd32 swapctl

2014-01-29 Thread David Laight
On Wed, Jan 29, 2014 at 06:38:06PM +, paul_kon...@dell.com wrote: On Wed, Jan 29, 2014 at 06:26:14PM +, David Laight wrote: There is a 64bit integer type that has an alignment requirement of 8. If that is used instead of a normal 64bit type then the structure alignement under amd64

Re: compat_netbsd32 swapctl

2014-01-29 Thread Christos Zoulas
In article 20140129153713.gl5...@homeworld.netbsd.org, Emmanuel Dreyfus m...@netbsd.org wrote: On Wed, Jan 29, 2014 at 01:48:35PM +0100, Martin Husemann wrote: My vote for this special case: hard code it #ifdef __x86_64__. If we run into other instances, we can add a define (like:

Re: The lamentation of proplib(3)

2014-01-29 Thread James K. Lowden
On Tue, 28 Jan 2014 21:36:48 + Taylor R Campbell campbell+netbsd-tech-k...@mumble.net wrote: libnv may be more type-safe as an API itself than proplib, but if we are going to seriously adopt something for formal protocols, it ought to have schemas that support enforcement in the C type

re: compat_netbsd32 swapctl

2014-01-29 Thread matthew green
this is gross. all those magic numbers turn my stomach. can you please define a compat structure using appropriately placed __packed members to force the correct values, and then use these structures as necessary. thanks, .mrg.

re: compat_netbsd32 swapctl

2014-01-29 Thread matthew green
this is gross. all those magic numbers turn my stomach. can you please define a compat structure using appropriately placed __packed members to force the correct values, and then use these structures as necessary. ... which is basically what dsl was suggesting, but with more useful

Re: compat_netbsd32 swapctl

2014-01-29 Thread Emmanuel Dreyfus
On Wed, Jan 29, 2014 at 03:37:13PM +, Emmanuel Dreyfus wrote: On Wed, Jan 29, 2014 at 01:48:35PM +0100, Martin Husemann wrote: My vote for this special case: hard code it #ifdef __x86_64__. If we run into other instances, we can add a define (like: DEV_T_ALIGN_32). Here is a patch that