Re: CVS commit: src/sys/dev/sysmon

2011-06-04 Thread Jukka Ruohonen
On Sat, Jun 04, 2011 at 01:24:33PM +, Paul Goyette wrote:
 Since nothing actually records or maintains an average sensor value,
 remove value_avg from the prop_dict.  We can't completely remove it
 because there's one driver that uses this field for its own private
 purposes, so for now we just rename the member.

Wouldn't it be better to just modify the (apparently misbehaving) driver
instead of harness the whole KPI for one quirk?

- Jukka.


Re: CVS commit: src/sys/dev/sysmon

2011-06-04 Thread Paul Goyette

On Sat, 4 Jun 2011, Jukka Ruohonen wrote:


On Sat, Jun 04, 2011 at 01:24:33PM +, Paul Goyette wrote:

Since nothing actually records or maintains an average sensor value,
remove value_avg from the prop_dict.  We can't completely remove it
because there's one driver that uses this field for its own private
purposes, so for now we just rename the member.


Wouldn't it be better to just modify the (apparently misbehaving) driver
instead of harness the whole KPI for one quirk?


Yes, that driver will be modified.  It is dev/pci/arcmsr.c that does the 
abuse.  Unfortunately there is more abuse in that driver, so clean-up 
will take a little bit longer.


Note that when that modification does happen, it will require a version 
bump, since the ABI for sensor modules will have changed.



-
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com|
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |  | pgoyette at netbsd.org  |
-


Re: CVS commit: src/sys/kern

2011-06-04 Thread David Laight
On Sat, Jun 04, 2011 at 10:52:47AM +1000, Simon Burge wrote:
 
  On Thu, Jun 02, 2011 at 09:21:11PM +0100, David Laight wrote:
   Passing 'l' is a register rename (or copy) so is almost zero cost.
   
   Recovering curlwp may involve a function call, and is, at best, a real
   memory access of global data (possibly via an asm statement) that will
   be slow and multiple accesses might need caching in a local anyway.
...
 As far as I could tell, the change to put curlwp in a register was never
 actually benchmarked on MIPS.  I asked a few times and never got an
 answer, other than that a kernel was about 2.5kB smaller.

Removing 2.5k is probably unlikely to make it slower :-)
Was that done by telling gcc that the register always help that variable?
or by stopping gcc using it, and useing a (non-volatile?) asm statement
to get the value.

 I'd be rather curious that if other arches investigate this, especially
 if there's some performance data to back up the change this time around.

Hmmm... I wonder if I can make it a kernel compile-time option so that
different archs can do it differently, and the whole thing can be switched
back for performance measurements.

The following defines would do it (with better names):
#ifdef SYS_CALL_USE_CURLWP
#define SYSCALL_FN(fn, l, uap, r) fn(uap, r)
#define SYSCALL_CURLWP curlwp
#else
#define SYSCALL_FN(fn, l, uap, r) fn(l, uap, r)
#define SYSCALL_CURLWP l
#endif

For non-smp builds (on old archs) 'curlwp' is a simple memory access, and the 
access
to the 'l' argument is likely to be a stack access - so probably not much 
difference.

Do we support smp vax or m68k ? (or even arm!)

IIRC the arm ABI defines standard uses for a lot of the registers, one must be 
for
thread data - so could be used in the kernel for curlwp.

Thinking about SMP, both CURCPU() and curlwp could be the register - with the
other being indirected from it.  I wonder which it used most?
curproc should be readable from either.

David

-- 
David Laight: da...@l8s.co.uk


RE: CVS commit: [matt-nb5-mips64] src/sys

2011-06-04 Thread Toru Nishimura

Committed By:   matt
Date:   Wed May 25 23:58:51 UTC 2011

Modified Files:
...
Log Message:
Make uvm_map recognize UVM_FLAG_COLORMATCH which tells uvm_map that the
'align' argument specifies the starting color of the KVA range to be returned.
...
Make the socket and pipe loan color-safe.
...
Make the mips pmap enforce strict page color (color(VA) == color(PA)).


Oh, YES!  So, NetBSD is now the world's first VIPT cache aware OS, isn't it?  
Since
the introduction of MIPS R4000, OS designers have been in trouble about how to 
make
VM VIPT cache coherent.  The answer was simple; make sure to have colour(VA) == 
colour(PA).

Toru Nishimura / ALKYL Technology


Re: CVS commit: src/sys/kern

2011-06-04 Thread Matt Thomas
 Thinking about SMP, both CURCPU() and curlwp could be the register - with the
 other being indirected from it.  I wonder which it used most?
 curproc should be readable from either.

Some MIPS CPUs have OS Scratch registers.  I use one to store curcpu since 
that is the one most useful in the exception handler.

I just made the changes so that PowerPC kernels will keep curlwp in %r13  (I 
choose r13 over r2 because r2 is used for TOC in the PPC64 ABI).  It has 
allowed me to remove several loads of curlwp in the assembly code let alone how 
many references in C code.

   textdata bss dec hex filename
6652040 3805600  212056 10669696 a2ce80 before
6642116 3805600  212056 10659772 a2a7bc after

That's nearly a reduction of 64KB.  The loading of %r13 with curlwp is free 
since in all cases, curlwp would have eventually been loaded into a register at 
some point.



Re: CVS commit: [matt-nb5-mips64] src/sys

2011-06-04 Thread Matt Thomas

On Jun 4, 2011, at 9:57 AM, Toru Nishimura wrote:

 Committed By:   matt
 Date:   Wed May 25 23:58:51 UTC 2011
 
 Modified Files:
 ...
 Log Message:
 Make uvm_map recognize UVM_FLAG_COLORMATCH which tells uvm_map that the
 'align' argument specifies the starting color of the KVA range to be 
 returned.
 ...
 Make the socket and pipe loan color-safe.
 ...
 Make the mips pmap enforce strict page color (color(VA) == color(PA)).
 
 Oh, YES!  So, NetBSD is now the world's first VIPT cache aware OS, isn't 
 it?  Since
 the introduction of MIPS R4000, OS designers have been in trouble about how 
 to make
 VM VIPT cache coherent.  The answer was simple; make sure to have colour(VA) 
 == colour(PA).

This is still a work in progress.  Right I'm modifying page daemon to treat 
each color as a separate collection of pages with its own free target, color 
hand, etc.

re: CVS commit: src/usr.sbin/envstat

2011-06-04 Thread matthew green

 Module Name:  src
 Committed By: pgoyette
 Date: Sat Jun  4 13:29:03 UTC 2011
 
 Modified Files:
   src/usr.sbin/envstat: envstat.c
 
 Log Message:
 Since there is no longer a value-avg property, remove the code that
 extracts it.

what's the behaviour of old envstat and new kernel?

thanks.


.mrg.


Re: CVS commit: src/tests/lib/libc/stdlib

2011-06-04 Thread Jukka Ruohonen
On Sat, Jun 04, 2011 at 10:49:49PM +, Adam Hamsik wrote:
 Module Name:  src
 Committed By: haad
 Date: Sat Jun  4 22:49:49 UTC 2011
 
 Modified Files:
   src/tests/lib/libc/stdlib: t_strtol.c
 
 Log Message:
 Fix problem with overflowing constant definition
 
 t_strtol.c:95: warning: overflow in implicit constant conversion

Can you note the architecture and explain the overflow so that I can
learn something?

- Jukka.


Re: CVS commit: src/tests/lib/libc/stdlib

2011-06-04 Thread Adam Hamsik

On Jun,Sunday 5 2011, at 12:58 AM, Jukka Ruohonen wrote:

 On Sat, Jun 04, 2011 at 10:49:49PM +, Adam Hamsik wrote:
 Module Name: src
 Committed By:haad
 Date:Sat Jun  4 22:49:49 UTC 2011
 
 Modified Files:
  src/tests/lib/libc/stdlib: t_strtol.c
 
 Log Message:
 Fix problem with overflowing constant definition
 
 t_strtol.c:95: warning: overflow in implicit constant conversion
 
 Can you note the architecture and explain the overflow so that I can
 learn something?

Architecture i386 - PAE,

#   compile  kern/strtoull.o
/usr/devel/buildslave/obj/i386/tooldir/bin/i486--netbsdelf-gcc -O2 -Wall -Os 
-ffreestanding -std=gnu99 -Werror  -march=i386 -mtune=i386  
--sysroot=/usr/devel/buildslave/obj/i386/destdir.i386 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/arch/i386
 --sysroot=/usr/devel/buildslave/obj/i386/destdir.i386 -DSLOW -DSUPPORT_BOOTP 
-DSUPPORT_DHCP -DSUPPORT_TFTP -DBOOTROM -DRELOC=0x9 -nostdinc 
-I/usr/devel/buildslave/obj/i386/sys/arch/i386/stand/netboot/3c509 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../..
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../arch/i386/stand/lib
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libsa
 -D_STANDALONE 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/quad
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/string
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/arch/i386/string
  
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/quad
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/string
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/arch/i386/string
 
-I/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/include
  -c
/usr/devel/buildslave/full/build/sys/arch/i386/stand/netboot/3c509/../../../../../lib/libkern/../../../common/lib/libc/stdlib/strtoull.c
 -o strtoull.o
--- dependall-tests ---
cc1: warnings being treated as errors
/usr/devel/buildslave/full/build/tests/lib/libc/stdlib/t_strtol.c: In function 
'atfu_strtol_base_body':
/usr/devel/buildslave/full/build/tests/lib/libc/stdlib/t_strtol.c:95: warning: 
overflow in implicit constant conversion
/usr/devel/buildslave/full/build/tests/lib/libc/stdlib/t_strtol.c:96: warning: 
overflow in implicit constant conversion
*** [t_strtol.o] Error code 1
nbmake: stopped in /usr/devel/buildslave/full/build/tests/lib/libc/stdlib
1 error
nbmake: stopped in /usr/devel/buildslave/full/build/tests/lib/libc/stdlib

Please revert/fix my commit if I did it wrong. But I can compile -current with 
it.

Regards

Adam.



re: CVS commit: src/usr.sbin/envstat

2011-06-04 Thread Paul Goyette

On Sun, 5 Jun 2011, matthew green wrote:




Module Name:src
Committed By:   pgoyette
Date:   Sat Jun  4 13:29:03 UTC 2011

Modified Files:
src/usr.sbin/envstat: envstat.c

Log Message:
Since there is no longer a value-avg property, remove the code that
extracts it.


what's the behaviour of old envstat and new kernel?


Old envstat simply retrieved the value_avg from the returned prop-dict 
(if the value was exported by the kernel) but never used the resulting 
value.


Furthermore, the value_avg field was exported, if and only if the 
ENVSYS_FVALID_AVG flag was set.  Nothing ever sets the flag, and the 
only use of value_avg is within dev/pci/arcmsr.c where it is used for a 
purpose totally unrelated to sysmon (it is used to correlate the sensor 
to a raidset member).


So ...

The value was never exported, but even if it had been, it would have 
been ignored.  I simply cleaned up to remove the code that would never 
get triggered.



-
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com|
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |  | pgoyette at netbsd.org  |
-


Re: CVS commit: src/tests/lib/libc/stdlib

2011-06-04 Thread Matt Thomas

On Jun 4, 2011, at 4:35 PM, Adam Hamsik wrote:

 
 On Jun,Sunday 5 2011, at 12:58 AM, Jukka Ruohonen wrote:
 
 On Sat, Jun 04, 2011 at 10:49:49PM +, Adam Hamsik wrote:
 Module Name:src
 Committed By:   haad
 Date:   Sat Jun  4 22:49:49 UTC 2011
 
 Modified Files:
 src/tests/lib/libc/stdlib: t_strtol.c
 
 Log Message:
 Fix problem with overflowing constant definition
 
 t_strtol.c:95: warning: overflow in implicit constant conversion
 
 Can you note the architecture and explain the overflow so that I can
 learn something?
 
 Architecture i386 - PAE,

also dies on powerpc.