Re: Use km_alloc instead of the single page allocator

2011-04-05 Thread Anton Maksimenkov
2011/4/5 Artur Grabowski a...@cvs.openbsd.org:
  - Use km_alloc for all backend allocations in pools.
  - Use km_alloc for the emergmency kentry allocations in uvm_mapent_alloc
  - Garbage collect uvm_km_getpage, uvm_km_getpage_pla and uvm_km_putpage

I have some idea related to allocator for (! __HAVE_PMAP_DIRECT) case.
It is how to get rid the kmthread.
It was related to uvm_km_getpage, now I will use uvm_km_alloc to explain.
I think that there is a problem is that there is a loop related to
kentries.

uvm_km_alloc
 |
 +uvm_km_kmemalloc
   |
   +uvm_map
 |
 +uvm_mapent_alloc
   |
   +uvm_km_alloc

The uvm_mapent_alloc() may use last kentry_free. Next time,
uvm_mapent_alloc() realize that kentry_free is NULL and it tries to
uvm_km_alloc() one fresh page.
The uvm_km_alloc() may directly call the uvm_km_kmemalloc()...
But when uvm_km_kmemalloc() will try to uvm_map() physical page, the
the uvm_map() sees that it have not free entry and calls
uvm_mapent_alloc() and here we are.
That is why kmthread exists?

My idea is how to resolve that loop by another way.
We must keep track the number of free kentries. And when we see, in
uvm_mapent_alloc(), that there is only 1 kentry remains then we must
allocate more entries immediately. This last kentry may be used by
uvm_map. So, when it will be done we'll have a page, divide it to new
fresh entries, and now we safe.
Then we can proceed further.

So here is a QuickDirty diff that shows the concept. Please, don't
kick me much. I just wanted to prepare it fast because I see high uvm
related activity and If I'll be very accurate it will be too late...
(that is why km_free() case is not implemented too).

Index: uvm.h
===
RCS file: /cvs/src/sys/uvm/uvm.h,v
retrieving revision 1.41
diff -u -r1.41 uvm.h
--- uvm.h   29 Jun 2010 20:39:27 -  1.41
+++ uvm.h   5 Apr 2011 05:13:11 -
@@ -128,6 +128,7 @@

/* static kernel map entry pool */
vm_map_entry_t kentry_free; /* free page pool */
+   int numof_free_kentries;
simple_lock_data_t kentry_lock;

/* aio_done is locked by uvm.aiodoned_lock. */
Index: uvm_km.c
===
RCS file: /cvs/src/sys/uvm/uvm_km.c,v
retrieving revision 1.92
diff -u -r1.92 uvm_km.c
--- uvm_km.c5 Apr 2011 01:28:05 -   1.92
+++ uvm_km.c5 Apr 2011 05:13:11 -
@@ -929,6 +929,7 @@
 #ifdef __HAVE_PMAP_DIRECT
panic(km_alloc: DIRECT single page);
 #else
+/*
mtx_enter(uvm_km_pages.mtx);
while (uvm_km_pages.free == 0) {
if (kd-kd_waitok == 0) {
@@ -947,6 +948,9 @@
wakeup(uvm_km_pages.km_proc);
}
mtx_leave(uvm_km_pages.mtx);
+*/
+   va = (vaddr_t)uvm_km_kmemalloc(kernel_map,
+NULL, PAGE_SIZE, UVM_KMF_VALLOC);
 #endif
} else {
struct uvm_object *uobj = NULL;
@@ -1000,6 +1004,7 @@
pg = pmap_unmap_direct(va);
uvm_pagefree(pg);
 #else
+   /* uvm_km_doputpage's job must be implemented here */
struct uvm_km_free_page *fp = v;
mtx_enter(uvm_km_pages.mtx);
fp-next = uvm_km_pages.freelist;
Index: uvm_map.c
===
RCS file: /cvs/src/sys/uvm/uvm_map.c,v
retrieving revision 1.132
diff -u -r1.132 uvm_map.c
--- uvm_map.c   5 Apr 2011 01:28:05 -   1.132
+++ uvm_map.c   5 Apr 2011 05:13:11 -
@@ -394,7 +394,7 @@
 struct vm_map_entry *
 uvm_mapent_alloc(struct vm_map *map, int flags)
 {
-   struct vm_map_entry *me, *ne;
+   struct vm_map_entry *me;
int s, i;
int pool_flags;
UVMHIST_FUNC(uvm_mapent_alloc); UVMHIST_CALLED(maphist);
@@ -406,25 +406,39 @@
if (map-flags  VM_MAP_INTRSAFE || cold) {
s = splvm();
simple_lock(uvm.kentry_lock);
-   me = uvm.kentry_free;
-   if (me == NULL) {
-   ne = km_alloc(PAGE_SIZE, kv_page, kp_dirty,
+   /*
+* If there is only one kentry remains we MUST
+* allocate more (page of) entries.
+* Because uvm_km_kmemalloc (called by uvm_km_alloc)
+* may use that last kentry when it tries to uvm_map new
+* physical page.
+* Then this virtual address of that mapped physpage
+* will be returned to us (by uvm_km_alloc) so we can
+* allocate more kentries from it and proceed
+*/
+   if (uvm.numof_free_kentries == 1 || cold) {
+   me = km_alloc(PAGE_SIZE, kv_page, kp_dirty,
kd_nowait);
-   if (ne == NULL)
+   if (me == NULL)

Re: Compiling the kernel with pcc

2011-04-05 Thread Pascal Stumpf
On Mon, Apr 04, 2011 at 11:18:26AM -0700, Philip Guenther wrote:
 On Mon, Apr 4, 2011 at 11:06 AM, Pascal Stumpf pascal.stu...@cubes.de wrote:
  pcc currently only chokes on some inline functions that need external
  linkage. gcc isn't pesky about that, but pcc and clang are (rightfully,
  imo).
 
 It's completely legal and defined (by the standard and not just gcc!)
 for a function to be inline in the file where it's defined and have
 external linkage.  That just means inline if you can in this file,
 but still provide a copy callable from other files. 
Not if it's never declared as extern, according to the standard. In that
case it's an inline definition, as they call it.

 That's exactly
 the semantic we want for pf_addr_compare().  If pcc or clang are
 complaining about it they're broken or their warning settings are
 misset.
 
 
 Philip Guenther



Re: Compiling the kernel with pcc

2011-04-05 Thread Mark Kettenis
 Date: Tue, 5 Apr 2011 09:44:21 +0200
 From: Pascal Stumpf pascal.stu...@cubes.de
 
 On Mon, Apr 04, 2011 at 11:18:26AM -0700, Philip Guenther wrote:
  On Mon, Apr 4, 2011 at 11:06 AM, Pascal Stumpf pascal.stu...@cubes.de 
  wrote:
   pcc currently only chokes on some inline functions that need external
   linkage. gcc isn't pesky about that, but pcc and clang are (rightfully,
   imo).
  
  It's completely legal and defined (by the standard and not just gcc!)
  for a function to be inline in the file where it's defined and have
  external linkage.  That just means inline if you can in this file,
  but still provide a copy callable from other files. 
 Not if it's never declared as extern, according to the standard. In that
 case it's an inline definition, as they call it.

No that's not what the standard says.  The standard says that
something is an inline definition if *all* declarations of a
functions have inline on them.  That clearly isn't the case here.
The standard also says that a function declaration with no
starage-class specifier on it has external linkage.  So while there is
a (minor) ambuguity in the spec here, the logical conclusion would be
that C99 should behave as we expect and that clang (according to you,
but not according to jsg@) and pcc have a bug.

As long as we're stuck with gcc2 and gcc3 for some of our
architectures, working around those bugs in clang and pcc is not an
option.



Re: Compiling the kernel with pcc

2011-04-05 Thread Pascal Stumpf
On Tue, Apr 05, 2011 at 10:21:18AM +0200, Mark Kettenis wrote:
  Date: Tue, 5 Apr 2011 09:44:21 +0200
  From: Pascal Stumpf pascal.stu...@cubes.de
  
  On Mon, Apr 04, 2011 at 11:18:26AM -0700, Philip Guenther wrote:
   On Mon, Apr 4, 2011 at 11:06 AM, Pascal Stumpf pascal.stu...@cubes.de 
   wrote:
pcc currently only chokes on some inline functions that need external
linkage. gcc isn't pesky about that, but pcc and clang are (rightfully,
imo).
   
   It's completely legal and defined (by the standard and not just gcc!)
   for a function to be inline in the file where it's defined and have
   external linkage.  That just means inline if you can in this file,
   but still provide a copy callable from other files. 
  Not if it's never declared as extern, according to the standard. In that
  case it's an inline definition, as they call it.
 
 No that's not what the standard says.  The standard says that
 something is an inline definition if *all* declarations of a
 functions have inline on them.  That clearly isn't the case here.
 The standard also says that a function declaration with no
 starage-class specifier on it has external linkage.  So while there is
 a (minor) ambuguity in the spec here, the logical conclusion would be
 that C99 should behave as we expect and that clang (according to you,
 but not according to jsg@) and pcc have a bug.
Ok, I seem to have misread the standard there, sorry. Anyway, I've done
some tests with all three compilers, and gotten three different
behaviours:

inline declaration in header file *and* definition:
Should be an inline definition, but gcc still creates external linkage,
violating the standard. pcc and clang fail. So adding __inline to the
declaration in pfvar.h shouldn't fix, but break the build with clang.
Maybe that behaviour was changed after 2.8.

non-inline declaration in header, but inline for the definition:
gcc and clang work, pcc does not. Probably a bug in pcc, although ragge
says it's conforming.

extern inline on both the declaration and definition:
pcc and clang work, gcc fails (why?).

 
 As long as we're stuck with gcc2 and gcc3 for some of our
 architectures, working around those bugs in clang and pcc is not an
 option.



Re: Compiling the kernel with pcc

2011-04-05 Thread Joerg Sonnenberger
On Tue, Apr 05, 2011 at 11:09:14AM +0200, Pascal Stumpf wrote:
 Ok, I seem to have misread the standard there, sorry. Anyway, I've done
 some tests with all three compilers, and gotten three different
 behaviours:

Can you please say explicitly which GCC version you are talking about?
The behavior changed with 4.3 to follow the C99 semantic by default,
which in turn is what clang and PCC should be implementing.

Joerg



rc.subr: quote daemon flags

2011-04-05 Thread Piotr Sikora

Hello,
$daemon_flags are sanitized using echo and tr, but the input isn't quoted, 
which makes it indistinguishable from echo's options. Effect of this is that 
when $daemon_flags starts with -n then this argument is lost in the 
process.


Best regards,
Piotr Sikora  piotr.sik...@frickle.com 


Index: rc.subr
===
RCS file: /cvs/src/etc/rc.d/rc.subr,v
retrieving revision 1.30
diff -u -r1.30 rc.subr
--- rc.subr 25 Mar 2011 10:03:26 -  1.30
+++ rc.subr 5 Apr 2011 10:59:08 -
@@ -116,6 +116,6 @@
[ -n ${_rcflags} ]  daemon_flags=${_rcflags}
[ -n ${_rcuser}  ]  daemon_user=${_rcuser}

-daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
+daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
pexp=${daemon}${daemon_flags:+ ${daemon_flags}}
rcexec=su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c



vnds considerd harmful.

2011-04-05 Thread Thordur Bjornsson
Hi,

Now that I've disallowed swapping to vnd's the purpose
of vnd (vs svnd) is suspect, it serves no purpose other
then providing a different way of doing what svnd does
(which imo, isn't even better).

So, nuke vnds (keep svnds though!).

This will make svndXn the same as vndXn etc. The idea is
that in a few releases we'll simply remove the svnd0 notes.

comments/ok ?


Index: dev/vnd.c
===
RCS file: /home/thib/cvs/src/sys/dev/vnd.c,v
retrieving revision 1.108
diff -u -p -r1.108 vnd.c
--- dev/vnd.c   2 Apr 2011 15:24:03 -   1.108
+++ dev/vnd.c   3 Apr 2011 18:29:52 -
@@ -33,25 +33,11 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * from: Utah $Hdr: vn.c 1.13 94/04/02$
- *
- * @(#)vn.c8.6 (Berkeley) 4/1/94
  */
 
 /*
- * Vnode disk driver.
- *
- * Block/character interface to a vnode.  Allows one to treat a file
- * as a disk (e.g. build a filesystem in it, mount it, etc.).
- *
- * NOTE 1: This uses either the VOP_BMAP/VOP_STRATEGY interface to the
- * vnode or simple VOP_READ/VOP_WRITE.  The former is suitable for swapping
- * as it doesn't distort the local buffer cache.  The latter is good for
- * building disk images as it keeps the cache consistent after the block
- * device is closed.
+ * There is a security issue involved with this driver.
  *
- * NOTE 2: There is a security issue involved with this driver.
  * Once mounted all access to the contents of the mapped file via
  * the special file is controlled by the permissions on the special
  * file, the protection of the mapped file is ignored (effectively,
@@ -102,12 +88,8 @@ int vnddebug = 0x00;
  * DISKUNIT(), but with the minor masked off.
  */
 #definevndunit(x)  DISKUNIT(makedev(major(x), minor(x)  0x7ff))
-#definevndsimple(x)(minor(x)  0x800)
-
-/* same as MAKEDISKDEV, preserving the vndsimple() property */
 #defineVNDLABELDEV(dev)\
-   makedev(major(dev), DISKMINOR(vndunit(dev), RAW_PART) | \
-   (vndsimple(dev) ? 0x800 : 0))
+   makedev(major(dev), DISKMINOR(vndunit(dev), RAW_PART))
 
 struct vndbuf {
struct buf  vb_buf;
@@ -145,7 +127,6 @@ struct vnd_softc {
 #defineVNF_LABELLING   0x0100
 #defineVNF_WLABEL  0x0200
 #defineVNF_HAVELABEL   0x0400
-#defineVNF_SIMPLE  0x1000
 #defineVNF_READONLY0x2000
 
 #defineVNDRW(v)((v)-sc_flags  VNF_READONLY ? FREAD : 
FREAD|FWRITE)
@@ -157,7 +138,6 @@ int numvnd = 0;
 void   vndattach(int);
 
 void   vndclear(struct vnd_softc *);
-void   vndstart(struct vnd_softc *, struct buf *);
 intvndsetcred(struct vnd_softc *, struct ucred *);
 void   vndiodone(struct buf *);
 void   vndshutdown(void);
@@ -232,12 +212,6 @@ vndopen(dev_t dev, int flags, int mode, 
if ((error = vndlock(sc)) != 0)
return (error);
 
-   if (!vndsimple(dev)  sc-sc_vp != NULL 
-   (sc-sc_vp-v_type != VREG || sc-sc_keyctx != NULL)) {
-   error = EINVAL;
-   goto bad;
-   }
-
if ((flags  FWRITE)  (sc-sc_flags  VNF_READONLY)) {
error = EROFS;
goto bad;
@@ -252,20 +226,11 @@ vndopen(dev_t dev, int flags, int mode, 
part = DISKPART(dev);
pmask = 1  part;
 
-   /*
-* If any partition is open, all succeeding openings must be of the
-* same type or read-only.
-*/
-   if (sc-sc_dk.dk_openmask) {
-   if (((sc-sc_flags  VNF_SIMPLE) != 0) !=
-   (vndsimple(dev) != 0)  (flags  FWRITE)) {
-   error = EBUSY;
-   goto bad;
-   }
-   } else if (vndsimple(dev))
-   sc-sc_flags |= VNF_SIMPLE;
-   else
-   sc-sc_flags = ~VNF_SIMPLE;
+   /* XXX: OK ?*/
+   if (sc-sc_dk.dk_openmask  (flags  FWRITE)) {
+   error = EBUSY;
+   goto bad;
+   }
 
/* Check that the partition exists. */
if (part != RAW_PART 
@@ -360,30 +325,13 @@ vndclose(dev_t dev, int flags, int mode,
return (0);
 }
 
-/*
- * Two methods are used, the traditional buffercache bypassing and the
- * newer, cache-coherent on unmount, one.
- *
- * Former method:
- * Break the request into bsize pieces and submit using VOP_BMAP/VOP_STRATEGY.
- * Note that this driver can only be used for swapping over NFS on the hp
- * since nfs_strategy on the vax cannot handle u-areas and page tables.
- *
- * Latter method:
- * Repack the buffer into an uio structure and use VOP_READ/VOP_WRITE to
- * access the underlying file.
- */
 void
 vndstrategy(struct buf *bp)
 {
int unit = vndunit(bp-b_dev);
struct vnd_softc *vnd = vnd_softc[unit];
-   struct vndbuf *nbp;
-   int bsize;
off_t bn;
-   caddr_t addr;
-   

let isp(4) refuse to let the midlayer use high luns

2011-04-05 Thread David Gwynne
...so the io path doesnt have to do it EVERY TIME FOR EVERY IO.


Index: isp_openbsd.c
===
RCS file: /cvs/src/sys/dev/ic/isp_openbsd.c,v
retrieving revision 1.45
diff -u -p -r1.45 isp_openbsd.c
--- isp_openbsd.c   31 Dec 2010 19:20:42 -  1.45
+++ isp_openbsd.c   5 Apr 2011 11:28:57 -
@@ -61,6 +61,7 @@
 #define_XT(xs) xs)-timeout/1000) * hz) + (3 * hz))
 
 static void ispminphys(struct buf *, struct scsi_link *);
+static int isp_scsi_probe(struct scsi_link *);
 static void ispcmd_slow(XS_T *);
 static void ispcmd(XS_T *);
 
@@ -94,6 +95,7 @@ isp_attach(struct ispsoftc *isp)
struct scsibus_attach_args saa;
struct scsi_link *lptr = isp-isp_osinfo._link[0];
isp-isp_osinfo._adapter.scsi_minphys = ispminphys;
+   isp-isp_osinfo._adapter.dev_probe = isp_scsi_probe;
 
isp-isp_state = ISP_RUNSTATE;
 
@@ -283,6 +285,17 @@ isp_add2_blocked_queue(struct ispsoftc *
xs-free_list.le_next = NULL;
 }
 
+int
+isp_scsi_probe(struct scsi_link *link)
+{
+   struct ispsoftc *isp = (struct ispsoftc *)link-adapter_softc;
+
+   if (link-lun = isp-isp_maxluns)
+   return (ENXIO);
+
+   return (0);
+}
+
 void
 ispcmd(XS_T *xs)
 {
@@ -298,13 +311,6 @@ ispcmd(XS_T *xs)
 
ISP_LOCK(isp);
 
-   if (XS_LUN(xs) = isp-isp_maxluns) {
-   xs-error = XS_SELTIMEOUT;
-   scsi_done(xs);
-   ISP_UNLOCK(isp);
-   return;
-   }
-
if (isp-isp_state  ISP_RUNSTATE) {
ISP_DISABLE_INTS(isp);
isp_init(isp);



Re: Compiling the kernel with pcc

2011-04-05 Thread Pascal Stumpf
On Tue, Apr 05, 2011 at 01:04:22PM +0200, Joerg Sonnenberger wrote:
 On Tue, Apr 05, 2011 at 11:09:14AM +0200, Pascal Stumpf wrote:
  Ok, I seem to have misread the standard there, sorry. Anyway, I've done
  some tests with all three compilers, and gotten three different
  behaviours:
 
 Can you please say explicitly which GCC version you are talking about?
 The behavior changed with 4.3 to follow the C99 semantic by default,
 which in turn is what clang and PCC should be implementing.
 
 Joerg
 
 
4.2.1 from base.



Llevate 6 banners al precio de 5

2011-04-05 Thread MyC Publicidad
MyC  Publicidad. Porta  
   Banner faacute;cil armado + Gigantografia Impresa   
  en alta resolucioacute;n (1440 dpi) + Diseno  MEDIDAS: - 1.20 x 0.50
Mts $130 - 1.60 x 0.60 Mts $159 - 1.80 x 0.80 Mts $179 - 1.90 x 0.90 Mts
$205 - 2.30 x 1.20 Mts $349 Precios mas IVA



Richiesta di assenso Associazione Culturale Leggere

2011-04-05 Thread YouWriting
YouWriting h il sito dellAssociazione Culturale no profit Leggere h  fondata
per promuovere i libri favorendo lincontro fra Autori, Editori e Lettori.



Re: rc.subr: quote daemon flags

2011-04-05 Thread Antoine Jacoutot
On Tue, 5 Apr 2011, Piotr Sikora wrote:

 Hello,
 $daemon_flags are sanitized using echo and tr, but the input isn't quoted,
 which makes it indistinguishable from echo's options. Effect of this is that
 when $daemon_flags starts with -n then this argument is lost in the process.

Good catch!
Committed, thanks.


 
 Best regards,
 Piotr Sikora  piotr.sik...@frickle.com 
 
 
 Index: rc.subr
 ===
 RCS file: /cvs/src/etc/rc.d/rc.subr,v
 retrieving revision 1.30
 diff -u -r1.30 rc.subr
 --- rc.subr 25 Mar 2011 10:03:26 -  1.30
 +++ rc.subr 5 Apr 2011 10:59:08 -
 @@ -116,6 +116,6 @@
 [ -n ${_rcflags} ]  daemon_flags=${_rcflags}
 [ -n ${_rcuser}  ]  daemon_user=${_rcuser}
 
 -daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
 +daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
 pexp=${daemon}${daemon_flags:+ ${daemon_flags}}
 rcexec=su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c
 
 

-- 
Antoine



Re: rc.subr: quote daemon flags

2011-04-05 Thread Otto Moerbeek
On Tue, Apr 05, 2011 at 01:47:52PM +0200, Antoine Jacoutot wrote:

 On Tue, 5 Apr 2011, Piotr Sikora wrote:
 
  Hello,
  $daemon_flags are sanitized using echo and tr, but the input isn't quoted,
  which makes it indistinguishable from echo's options. Effect of this is that
  when $daemon_flags starts with -n then this argument is lost in the 
  process.
 
 Good catch!
 Committed, thanks.

Ehh

echo -n

still echoes nothing. Or am I missing something?

-Otto
 
 
  
  Best regards,
  Piotr Sikora  piotr.sik...@frickle.com 
  
  
  Index: rc.subr
  ===
  RCS file: /cvs/src/etc/rc.d/rc.subr,v
  retrieving revision 1.30
  diff -u -r1.30 rc.subr
  --- rc.subr 25 Mar 2011 10:03:26 -  1.30
  +++ rc.subr 5 Apr 2011 10:59:08 -
  @@ -116,6 +116,6 @@
  [ -n ${_rcflags} ]  daemon_flags=${_rcflags}
  [ -n ${_rcuser}  ]  daemon_user=${_rcuser}
  
  -daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
  +daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
  pexp=${daemon}${daemon_flags:+ ${daemon_flags}}
  rcexec=su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c
  
  
 
 -- 
 Antoine



Re: rc.subr: quote daemon flags

2011-04-05 Thread Otto Moerbeek
On Tue, Apr 05, 2011 at 02:08:57PM +0200, Otto Moerbeek wrote:

 On Tue, Apr 05, 2011 at 01:47:52PM +0200, Antoine Jacoutot wrote:
 
  On Tue, 5 Apr 2011, Piotr Sikora wrote:
  
   Hello,
   $daemon_flags are sanitized using echo and tr, but the input isn't quoted,
   which makes it indistinguishable from echo's options. Effect of this is 
   that
   when $daemon_flags starts with -n then this argument is lost in the 
   process.
  
  Good catch!
  Committed, thanks.
 
 Ehh
 
 echo -n
 
 still echoes nothing. Or am I missing something?

you likely want sth as:

echo '' ${daemon_flags}

(no -- handling for echo)

 
   -Otto
  
  
   
   Best regards,
   Piotr Sikora  piotr.sik...@frickle.com 
   
   
   Index: rc.subr
   ===
   RCS file: /cvs/src/etc/rc.d/rc.subr,v
   retrieving revision 1.30
   diff -u -r1.30 rc.subr
   --- rc.subr 25 Mar 2011 10:03:26 -  1.30
   +++ rc.subr 5 Apr 2011 10:59:08 -
   @@ -116,6 +116,6 @@
   [ -n ${_rcflags} ]  daemon_flags=${_rcflags}
   [ -n ${_rcuser}  ]  daemon_user=${_rcuser}
   
   -daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
   +daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
   pexp=${daemon}${daemon_flags:+ ${daemon_flags}}
   rcexec=su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c
   
   
  
  -- 
  Antoine



ahd(4) prerequisite for iopoolification

2011-04-05 Thread Kenneth R Westerback
We never allocate 253 scb's, and thus tag collisions should not
be possible if they are correctly initialized. This diff just rips
out the existing collision code. I haven't yet determined if we
need to initialize tags differently.

It is a prerequisite for iopoolification and testing on any ahd
hardware would be appreciated.

 Ken

Index: aic79xx.c
===
RCS file: /cvs/src/sys/dev/ic/aic79xx.c,v
retrieving revision 1.47
diff -u -p -r1.47 aic79xx.c
--- aic79xx.c   22 Sep 2010 00:35:19 -  1.47
+++ aic79xx.c   5 Apr 2011 12:19:19 -
@@ -216,10 +216,6 @@ struct scb *   ahd_find_scb_by_tag(struct 
 void   ahd_fini_scbdata(struct ahd_softc *ahd);
 void   ahd_setup_iocell_workaround(struct ahd_softc *ahd);
 void   ahd_iocell_first_selection(struct ahd_softc *ahd);
-void   ahd_add_col_list(struct ahd_softc *ahd,
-struct scb *scb, u_int col_idx);
-void   ahd_rem_col_list(struct ahd_softc *ahd,
-struct scb *scb);
 void   ahd_chip_init(struct ahd_softc *ahd);
 void   ahd_qinfifo_requeue(struct ahd_softc *ahd,
struct scb *prev_scb,
@@ -5804,84 +5800,19 @@ ahd_iocell_first_selection(struct ahd_so
ahd-flags |= AHD_HAD_FIRST_SEL;
 }
 
-/*** SCB Management 
***/
-void
-ahd_add_col_list(struct ahd_softc *ahd, struct scb *scb, u_int col_idx)
-{
-   struct  scb_list *free_list;
-   struct  scb_tailq *free_tailq;
-   struct  scb *first_scb;
-
-   scb-flags |= SCB_ON_COL_LIST;
-   AHD_SET_SCB_COL_IDX(scb, col_idx);
-   free_list = ahd-scb_data.free_scb_lists[col_idx];
-   free_tailq = ahd-scb_data.free_scbs;
-   first_scb = LIST_FIRST(free_list);
-   if (first_scb != NULL) {
-   LIST_INSERT_AFTER(first_scb, scb, collision_links);
-   } else {
-   LIST_INSERT_HEAD(free_list, scb, collision_links);
-   TAILQ_INSERT_TAIL(free_tailq, scb, links.tqe);
-   }
-}
-
-void
-ahd_rem_col_list(struct ahd_softc *ahd, struct scb *scb)
-{
-   struct  scb_list *free_list;
-   struct  scb_tailq *free_tailq;
-   struct  scb *first_scb;
-   u_int   col_idx;
-
-   scb-flags = ~SCB_ON_COL_LIST;
-   col_idx = AHD_GET_SCB_COL_IDX(ahd, scb);
-   free_list = ahd-scb_data.free_scb_lists[col_idx];
-   free_tailq = ahd-scb_data.free_scbs;
-   first_scb = LIST_FIRST(free_list);
-   if (first_scb == scb) {
-   struct scb *next_scb;
-
-   /*
-* Maintain order in the collision free
-* lists for fairness if this device has
-* other colliding tags active.
-*/
-   next_scb = LIST_NEXT(scb, collision_links);
-   if (next_scb != NULL) {
-   TAILQ_INSERT_AFTER(free_tailq, scb,
-  next_scb, links.tqe);
-   }
-   TAILQ_REMOVE(free_tailq, scb, links.tqe);
-   }
-   LIST_REMOVE(scb, collision_links);
-}
-
 /*
  * Get a free scb. If there are none, see if we can allocate a new SCB.
  */
 struct scb *
-ahd_get_scb(struct ahd_softc *ahd, u_int col_idx)
+ahd_get_scb(struct ahd_softc *ahd)
 {
struct scb *scb;
 
-   TAILQ_FOREACH(scb, ahd-scb_data.free_scbs, links.tqe) {
-   if (AHD_GET_SCB_COL_IDX(ahd, scb) != col_idx) {
-   ahd_rem_col_list(ahd, scb);
-   goto found;
-   }
-   }
if ((scb = LIST_FIRST(ahd-scb_data.any_dev_free_scb_list)) == NULL) {
/* All scb's are allocated at initialization in OpenBSD. */
return (NULL);
}
LIST_REMOVE(scb, links.le);
-   if (col_idx != AHD_NEVER_COL_IDX
- (scb-col_scb != NULL)
- (scb-col_scb-flags  SCB_ACTIVE) == 0) {
-   LIST_REMOVE(scb-col_scb, links.le);
-   ahd_add_col_list(ahd, scb-col_scb, col_idx);
-   }
-found:
scb-flags |= SCB_ACTIVE;
return (scb);
 }
@@ -5898,46 +5829,7 @@ ahd_free_scb(struct ahd_softc *ahd, stru
scb-hscb-control = 0;
ahd-scb_data.scbindex[SCB_GET_TAG(scb)] = NULL;
 
-   if (scb-col_scb == NULL) {
-
-   /*
-* No collision possible.  Just free normally.
-*/
-   LIST_INSERT_HEAD(ahd-scb_data.any_dev_free_scb_list,
-scb, links.le);
-   } else if ((scb-col_scb-flags  SCB_ON_COL_LIST) != 0) {
-
-   /*
-* The SCB we might have collided with is on
-* a free collision list.  Put both SCBs on
-* the generic list.
-*/
-   ahd_rem_col_list(ahd, scb-col_scb);
-   

Re: rc.subr: quote daemon flags

2011-04-05 Thread Philip Guenther
On Tue, Apr 5, 2011 at 4:07 AM, Piotr Sikora piotr.sik...@frickle.com wrote:
 $daemon_flags are sanitized using echo and tr, but the input isn't quoted,
 which makes it indistinguishable from echo's options. Effect of this is that
 when $daemon_flags starts with -n then this argument is lost in the
 process.
...
 -daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
 +daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])

Insufficient for the daemon_flags=-n case.  To be completely safe, use printf:

daemon_flags=$(printf '%s\n' ${daemon_flags} | tr -s [:space:])


Philip Guenther



isp isnt out of resources, it just gets busy

2011-04-05 Thread David Gwynne
so use the appropriate define to report that.

Index: isp_openbsd.c
===
RCS file: /cvs/src/sys/dev/ic/isp_openbsd.c,v
retrieving revision 1.46
diff -u -p -r1.46 isp_openbsd.c
--- isp_openbsd.c   5 Apr 2011 12:09:20 -   1.46
+++ isp_openbsd.c   5 Apr 2011 13:01:11 -
@@ -330,7 +330,7 @@ ispcmd(XS_T *xs)
 */
if (isp-isp_osinfo.blocked) {
if (xs-flags  SCSI_POLL) {
-   xs-error = XS_NO_CCB;
+   xs-error = XS_BUSY;
scsi_done(xs);
ISP_UNLOCK(isp);
return;
@@ -401,7 +401,7 @@ isp_polled_cmd(struct ispsoftc *isp, XS_
break;
case CMD_RQLATER:
case CMD_EAGAIN:
-   xs-error = XS_NO_CCB;
+   xs-error = XS_BUSY;
/* FALLTHROUGH */
case CMD_COMPLETE:
scsi_done(xs);



Re: rc.subr: quote daemon flags

2011-04-05 Thread Otto Moerbeek
On Tue, Apr 05, 2011 at 04:44:27AM -0700, Philip Guenther wrote:

 On Tue, Apr 5, 2011 at 4:07 AM, Piotr Sikora piotr.sik...@frickle.com wrote:
  $daemon_flags are sanitized using echo and tr, but the input isn't quoted,
  which makes it indistinguishable from echo's options. Effect of this is that
  when $daemon_flags starts with -n then this argument is lost in the
  process.
 ...
  -daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
  +daemon_flags=$(echo ${daemon_flags} | tr -s [:space:])
 
 Insufficient for the daemon_flags=-n case.  To be completely safe, use printf:
 
 daemon_flags=$(printf '%s\n' ${daemon_flags} | tr -s [:space:])
 
 
 Philip Guenther

Yep, I like this better than my solition.

-Otto



Re: rc.subr: quote daemon flags

2011-04-05 Thread Piotr Sikora

echo -n

still echoes nothing. Or am I missing something?


Damn, how did I miss that? I was pretty sure that I've checked passing just 
-n prior to submitting this, but apparently I didn't.


Thanks.

Best regards,
Piotr Sikora  piotr.sik...@frickle.com 



Re: rc.subr: quote daemon flags

2011-04-05 Thread Piotr Sikora

Hey,

Insufficient for the daemon_flags=-n case.  To be completely safe, use 
printf:


daemon_flags=$(printf '%s\n' ${daemon_flags} | tr -s [:space:])


It's indeed better / safer solution, thanks!

Best regards,
Piotr Sikora  piotr.sik...@frickle.com 



Google 1st Page Guaranteed for Olde Fort Inn?

2011-04-05 Thread Russell Chen
Having trouble reading this email? View it in your browser.
[http://bm1.nocserv2.com/display.php?M=721973C=b76c0fb6bb811a57db4d70a488f5bf04S=129L=29N=33]


Google First Page Guaranteed for Olde Fort Inn?

We can get your business on 1st page of Google Before You Pay! 

We Ensure You Receive CALLS Not Just Clicks!

Hi  

We can get your Olde Fort Inn business website  on the 1st page of Google
BEFORE YOU'RE BILLED! You are not billed until we get you there. We are
Internet Marketing Specialists that drive not just traffic to your business
but CALLS and RETURN! 

Stop letting your competition beat you because they have better online
marketing and not better product or service.

Strategic Business Consulting Group is a small firm located in New York
City specializing bringing more profitable business to you from the
Internet. We  ensure your business receives calls ... not just clicks! If
we don't perform and get you leads you don't pay a dime! In short we get
you the leads and you close the sale.

It's Simple - Here's How It Works

1) You pick or we help you find any 40 keyword phrases.  

2) You pick 5 areas (Cities, Towns, or Counties) you want to market to.

3) Once your web site starts coming up on the 1st page of Google then the
billing starts.


Or call me direct 347-857-7039 for a no obligation consultation to see how
1st page Google results can INCREASE YOUR SALES by leaps and bounds for
your Olde Fort Inn business ALMOST IMMEDIATELY TODAY!

Warmest regards,

Russell Chen, 

Internet Marketing Specialist
Strategic Business Consulting Group, LLC.
244 5th Ave. Suite Q224
New York, NY 10001

Direct Phone: 347-857-7039
Toll Free: 888-407-8856
Fax: 646-998-1325

PS:  Call me now! What have you got to lose? but only to gain!

This message was intended for 'tech@openbsd.org' 

Unsubscribe
[http://bm1.nocserv2.com/unsubscribe.php?M=721973C=b76c0fb6bb811a57db4d70a488f5bf04L=29N=129]
|

 


Powered by Interspire



altq, v6 ack prioritisation

2011-04-05 Thread Stuart Henderson
allow IPv6 empty TCP acks to be prioritized as happens with v4
using similar code to v4. tested over pppoe(4). ok?

Index: pf.c
===
RCS file: /cvs/src/sys/net/pf.c,v
retrieving revision 1.734
diff -u -p -r1.734 pf.c
--- pf.c5 Apr 2011 13:48:18 -   1.734
+++ pf.c5 Apr 2011 15:05:17 -
@@ -6021,6 +6021,7 @@ pf_test6(int fwdir, struct ifnet *ifp, s
union pf_headers hdrs;
int  off, hdrlen;
int  dir = (fwdir == PF_FWD) ? PF_OUT : fwdir;
+   u_int32_tqid, pqid = 0;
 
if (!pf_status.running)
return (PF_PASS);
@@ -6098,6 +6099,8 @@ pf_test6(int fwdir, struct ifnet *ifp, s
switch (pd.proto) {
 
case IPPROTO_TCP: {
+   if ((pd.hdr.tcp-th_flags  TH_ACK)  pd.p_len == 0)
+   pqid = 1;
action = pf_normalize_tcp(dir, kif, m, 0, off, h, pd);
if (action == PF_DROP)
goto done;
@@ -6188,10 +6191,19 @@ done:
}
 
if (action != PF_DROP) {
-   if (s)
+   if (s) {
pf_scrub_ip6(m, s-min_ttl);
-   else
+   if (pqid || (pd.tos  IPTOS_LOWDELAY))
+   qid = s-pqid;
+   else
+   qid = s-qid;
+   } else {
pf_scrub_ip6(m, r-min_ttl);
+   if (pqid || (pd.tos  IPTOS_LOWDELAY))
+   qid = r-pqid;
+   else
+   qid = r-qid;
+   }
}
if (s  s-tag)
pf_tag_packet(m, s ? s-tag : 0, s-rtableid[pd.didx]);
@@ -6200,13 +6212,9 @@ done:
m-m_pkthdr.pf.statekey = s-key[PF_SK_STACK];
 
 #ifdef ALTQ
-   if (action == PF_PASS  s  s-qid) {
-   if (pd.tos  IPTOS_LOWDELAY)
-   m-m_pkthdr.pf.qid = s-pqid;
-   else
-   m-m_pkthdr.pf.qid = s-qid;
-   /* add hints for ecn */
-   m-m_pkthdr.pf.hdr = h;
+   if (action == PF_PASS  qid) {
+   m-m_pkthdr.pf.qid = qid;
+   m-m_pkthdr.pf.hdr = h; /* add hints for ecn */
}
 #endif /* ALTQ */



traceroute TOS

2011-04-05 Thread Stuart Henderson
if -t is used, display a notice when the TOS changes en-route.
ok?

Index: traceroute.8
===
RCS file: /cvs/src/usr.sbin/traceroute/traceroute.8,v
retrieving revision 1.44
diff -u -p -r1.44 traceroute.8
--- traceroute.88 Jul 2010 20:23:03 -   1.44
+++ traceroute.85 Apr 2011 15:50:38 -
@@ -177,6 +177,8 @@ in probe packets to the following value 
 The value must be a decimal integer in the range 0 to 255.
 This option can be used to
 see if different types-of-service result in different paths.
+If this option is used, changes to the type-of-service in the
+returned packets are displayed.
 (If you are not running a
 .Bx 4.3 tahoe
 or later system, this may be academic since the normal network
@@ -384,6 +386,8 @@ ever occur and the associated gateway is
 (destination network or host unreachable for TOS),
 .Sy !code
 (other ICMP unreachable code).
+.Sy TOS=xxx
+(TOS bit in returned packet differs from last hop).
 If almost all the probes result in some kind of unreachable,
 .Nm
 will give up and exit.
Index: traceroute.c
===
RCS file: /cvs/src/usr.sbin/traceroute/traceroute.c,v
retrieving revision 1.74
diff -u -p -r1.74 traceroute.c
--- traceroute.c22 Mar 2011 10:16:23 -  1.74
+++ traceroute.c5 Apr 2011 15:50:38 -
@@ -293,11 +293,13 @@ main(int argc, char *argv[])
int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL };
int ttl_flag = 0, incflag = 1, protoset = 0, sump = 0;
int ch, i, lsrr = 0, on = 1, probe, seq = 0, tos = 0;
+   int last_tos, tos_returned;
size_t size = sizeof(max_ttl);
struct sockaddr_in from, to;
struct hostent *hp;
u_int32_t tmprnd;
-   struct ip *ip;
+   struct ip *ip, *inner_ip;
+   struct icmp *icp;
u_int8_t ttl;
char *ep;
const char *errstr;
@@ -427,7 +429,7 @@ main(int argc, char *argv[])
l = strtol(optarg, ep, 10);
if (errno || !*optarg || *ep || l  0 || l  255)
errx(1, tos must be 0 to 255.);
-   tos = (int)l;
+   last_tos = tos = (int)l;
break;
case 'v':
verbose++;
@@ -636,9 +638,21 @@ main(int argc, char *argv[])
++got_there;
break;
}
+
+   icp = (struct icmp *) (((u_char 
*)ip)+(ip-ip_hl2));
+   inner_ip = (struct ip *) (((u_char *)icp)+8);
+
+   tos_returned = inner_ip-ip_tos;
+
+   if (tos_returned != last_tos)
+   printf ( (TOS=%d!), tos_returned);
+
+   last_tos = tos_returned;
+
/* time exceeded in transit */
if (i == -1)
break;
+
code = i - 1;
switch (code) {
case ICMP_UNREACH_PORT:



Re: traceroute TOS

2011-04-05 Thread Stuart Henderson
On 2011/04/05 16:51, Stuart Henderson wrote:
 if -t is used, display a notice when the TOS changes en-route.
 ok?

oh, it's better with a (contrived) example:

$ traceroute -nt 7 naiad
traceroute to naiad.spacehopper.org (195.95.187.35), 64 hops max, 40 byte 
packets
 1  85.158.44.145  0.441 ms (TOS=33!)  0.328 ms  0.396 ms
 2  193.178.223.245  14.637 ms  15.213 ms  15.466 ms
 3  194.39.143.145  16.600 ms  15.468 ms  16.206 ms
 4  194.39.143.205  16.483 ms  16.210 ms  15.843 ms
 5  193.203.5.182  17.475 ms  16.708 ms  16.986 ms
 6  195.95.187.248  17.211 ms (TOS=4!)  16.460 ms  16.468 ms
 7  195.95.187.35  27.99 ms  16.207 ms  17.467 ms



 Index: traceroute.8
 ===
 RCS file: /cvs/src/usr.sbin/traceroute/traceroute.8,v
 retrieving revision 1.44
 diff -u -p -r1.44 traceroute.8
 --- traceroute.8  8 Jul 2010 20:23:03 -   1.44
 +++ traceroute.8  5 Apr 2011 15:50:38 -
 @@ -177,6 +177,8 @@ in probe packets to the following value 
  The value must be a decimal integer in the range 0 to 255.
  This option can be used to
  see if different types-of-service result in different paths.
 +If this option is used, changes to the type-of-service in the
 +returned packets are displayed.
  (If you are not running a
  .Bx 4.3 tahoe
  or later system, this may be academic since the normal network
 @@ -384,6 +386,8 @@ ever occur and the associated gateway is
  (destination network or host unreachable for TOS),
  .Sy !code
  (other ICMP unreachable code).
 +.Sy TOS=xxx
 +(TOS bit in returned packet differs from last hop).
  If almost all the probes result in some kind of unreachable,
  .Nm
  will give up and exit.
 Index: traceroute.c
 ===
 RCS file: /cvs/src/usr.sbin/traceroute/traceroute.c,v
 retrieving revision 1.74
 diff -u -p -r1.74 traceroute.c
 --- traceroute.c  22 Mar 2011 10:16:23 -  1.74
 +++ traceroute.c  5 Apr 2011 15:50:38 -
 @@ -293,11 +293,13 @@ main(int argc, char *argv[])
   int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL };
   int ttl_flag = 0, incflag = 1, protoset = 0, sump = 0;
   int ch, i, lsrr = 0, on = 1, probe, seq = 0, tos = 0;
 + int last_tos, tos_returned;
   size_t size = sizeof(max_ttl);
   struct sockaddr_in from, to;
   struct hostent *hp;
   u_int32_t tmprnd;
 - struct ip *ip;
 + struct ip *ip, *inner_ip;
 + struct icmp *icp;
   u_int8_t ttl;
   char *ep;
   const char *errstr;
 @@ -427,7 +429,7 @@ main(int argc, char *argv[])
   l = strtol(optarg, ep, 10);
   if (errno || !*optarg || *ep || l  0 || l  255)
   errx(1, tos must be 0 to 255.);
 - tos = (int)l;
 + last_tos = tos = (int)l;
   break;
   case 'v':
   verbose++;
 @@ -636,9 +638,21 @@ main(int argc, char *argv[])
   ++got_there;
   break;
   }
 +
 + icp = (struct icmp *) (((u_char 
 *)ip)+(ip-ip_hl2));
 + inner_ip = (struct ip *) (((u_char *)icp)+8);
 +
 + tos_returned = inner_ip-ip_tos;
 +
 + if (tos_returned != last_tos)
 + printf ( (TOS=%d!), tos_returned);
 +
 + last_tos = tos_returned;
 +
   /* time exceeded in transit */
   if (i == -1)
   break;
 +
   code = i - 1;
   switch (code) {
   case ICMP_UNREACH_PORT:



mechanic rename M_{TCP|UDP}V4_CSUM_OUT - M_{TCP|UDP}_CSUM_OUT

2011-04-05 Thread Henning Brauer
so i wanna change the world order a bit again.
basically, no part of the tree should bother with setting tcp and udp
checksums. when they are needed, the stack just sets these flags, and
ip_output / ip6_output do the checksum then. we're not too far off for
ipv4, as usual ipv6 has it all wrong.
most parts of the stack dealing with udp and tcp don't seperate v4/v6,
and having gazillions of
if (af == AF_INET)
m-m_flags |= M_TCPV4_CSUM_OUT;
else
m-m_flags |= M_TCPV6_CSUM_OUT;
is stupid. ip_output and ip6_output do have an idea wether they deal
with v4 or v6... (despite the fact that you could just do the
conditional on af there if really needed)

so here we go. ok?

Index: dev/ic/re.c
===
RCS file: /cvs/src/sys/dev/ic/re.c,v
retrieving revision 1.133
diff -u -p -r1.133 re.c
--- dev/ic/re.c 13 Mar 2011 15:35:20 -  1.133
+++ dev/ic/re.c 5 Apr 2011 16:12:32 -
@@ -1707,18 +1707,18 @@ re_encap(struct rl_softc *sc, struct mbu
 */
 
if ((m-m_pkthdr.csum_flags 
-   (M_IPV4_CSUM_OUT|M_TCPV4_CSUM_OUT|M_UDPV4_CSUM_OUT)) != 0) {
+   (M_IPV4_CSUM_OUT|M_TCP_CSUM_OUT|M_UDP_CSUM_OUT)) != 0) {
if (sc-rl_flags  RL_FLAG_DESCV2) {
vlanctl |= RL_TDESC_CMD_IPCSUMV2;
-   if (m-m_pkthdr.csum_flags  M_TCPV4_CSUM_OUT)
+   if (m-m_pkthdr.csum_flags  M_TCP_CSUM_OUT)
vlanctl |= RL_TDESC_CMD_TCPCSUMV2;
-   if (m-m_pkthdr.csum_flags  M_UDPV4_CSUM_OUT)
+   if (m-m_pkthdr.csum_flags  M_UDP_CSUM_OUT)
vlanctl |= RL_TDESC_CMD_UDPCSUMV2;
} else {
csum_flags |= RL_TDESC_CMD_IPCSUM;
-   if (m-m_pkthdr.csum_flags  M_TCPV4_CSUM_OUT)
+   if (m-m_pkthdr.csum_flags  M_TCP_CSUM_OUT)
csum_flags |= RL_TDESC_CMD_TCPCSUM;
-   if (m-m_pkthdr.csum_flags  M_UDPV4_CSUM_OUT)
+   if (m-m_pkthdr.csum_flags  M_UDP_CSUM_OUT)
csum_flags |= RL_TDESC_CMD_UDPCSUM;
}
}
Index: dev/ic/xl.c
===
RCS file: /cvs/src/sys/dev/ic/xl.c,v
retrieving revision 1.99
diff -u -p -r1.99 xl.c
--- dev/ic/xl.c 22 Sep 2010 08:49:14 -  1.99
+++ dev/ic/xl.c 5 Apr 2011 16:12:33 -
@@ -1661,9 +1661,9 @@ reload:
if (m_head-m_pkthdr.csum_flags) {
if (m_head-m_pkthdr.csum_flags  M_IPV4_CSUM_OUT)
status |= XL_TXSTAT_IPCKSUM;
-   if (m_head-m_pkthdr.csum_flags  M_TCPV4_CSUM_OUT)
+   if (m_head-m_pkthdr.csum_flags  M_TCP_CSUM_OUT)
status |= XL_TXSTAT_TCPCKSUM;
-   if (m_head-m_pkthdr.csum_flags  M_UDPV4_CSUM_OUT)
+   if (m_head-m_pkthdr.csum_flags  M_UDP_CSUM_OUT)
status |= XL_TXSTAT_UDPCKSUM;
}
 #endif
Index: dev/pci/if_age.c
===
RCS file: /cvs/src/sys/dev/pci/if_age.c,v
retrieving revision 1.12
diff -u -p -r1.12 if_age.c
--- dev/pci/if_age.c27 Aug 2010 17:08:00 -  1.12
+++ dev/pci/if_age.c5 Apr 2011 16:12:34 -
@@ -132,7 +132,7 @@ struct cfdriver age_cd = {
 int agedebug = 0;
 #defineDPRINTF(x)  do { if (agedebug) printf x; } while (0)
 
-#define AGE_CSUM_FEATURES  (M_TCPV4_CSUM_OUT | M_UDPV4_CSUM_OUT)
+#define AGE_CSUM_FEATURES  (M_TCP_CSUM_OUT | M_UDP_CSUM_OUT)
 
 int
 age_match(struct device *dev, void *match, void *aux)
@@ -1195,9 +1195,9 @@ age_encap(struct age_softc *sc, struct m
/* Configure Tx IP/TCP/UDP checksum offload. */
if ((m-m_pkthdr.csum_flags  AGE_CSUM_FEATURES) != 0) {
cflags |= AGE_TD_CSUM;
-   if ((m-m_pkthdr.csum_flags  M_TCPV4_CSUM_OUT) != 0)
+   if ((m-m_pkthdr.csum_flags  M_TCP_CSUM_OUT) != 0)
cflags |= AGE_TD_TCPCSUM;
-   if ((m-m_pkthdr.csum_flags  M_UDPV4_CSUM_OUT) != 0)
+   if ((m-m_pkthdr.csum_flags  M_UDP_CSUM_OUT) != 0)
cflags |= AGE_TD_UDPCSUM;
/* Set checksum start offset. */
cflags |= (poff  AGE_TD_CSUM_PLOADOFFSET_SHIFT);
Index: dev/pci/if_alc.c
===
RCS file: /cvs/src/sys/dev/pci/if_alc.c,v
retrieving revision 1.10
diff -u -p -r1.10 if_alc.c
--- dev/pci/if_alc.c18 Feb 2011 17:20:15 -  1.10
+++ dev/pci/if_alc.c5 Apr 2011 16:12:34 -
@@ -140,7 +140,7 @@ struct cfdriver alc_cd = {
 int alcdebug = 0;
 #defineDPRINTF(x)  do { if (alcdebug) printf x; } while (0)
 
-#define ALC_CSUM_FEATURES  

pmap prefer diff

2011-04-05 Thread Ariane van der Steldt
Hi,

So it turns out that my allocator is not capable of handling the pmap_prefer
horror. This diff exports the actual parameters of pmap_prefer, so I can
make the allocator deal with this intelligently.

I need compile tests on:
- arm
- hppa
- hppa64
- m68k
- mips64
- sh
- sparc
- sparc64
Since the code is not actually called, it should not affect running of kernels.

Ok?
-- 
Ariane


Index: arch//arm/include/pmap.h
===
RCS file: /cvs/src/sys/arch/arm/include/pmap.h,v
retrieving revision 1.17
diff -u -d -p -r1.17 pmap.h
--- arch//arm/include/pmap.h23 Mar 2011 16:54:34 -  1.17
+++ arch//arm/include/pmap.h5 Apr 2011 16:30:58 -
@@ -620,6 +620,14 @@ vaddr_tpmap_prefer(vaddr_t, vaddr_t);
 
 extern uint32_t pmap_alias_dist;
 extern uint32_t pmap_alias_bits;
+
+/* pmap prefer alias alignment. */
+#define PMAP_PREFER_ALIGN()(pmap_alias_dist)
+/* pmap prefer offset withing alignment. */
+#define PMAP_PREFER_OFFSET(of) \
+(PMAP_PREFER_ALIGN() == 0 ? 0 : ((of)  (PMAP_PREFER_ALIGN() - 1)))
+
+
 #endif /* _LOCORE */
 
 #endif /* _KERNEL */
Index: arch//hppa/include/pmap.h
===
RCS file: /cvs/src/sys/arch/hppa/include/pmap.h,v
retrieving revision 1.40
diff -u -d -p -r1.40 pmap.h
--- arch//hppa/include/pmap.h   26 Dec 2010 15:40:59 -  1.40
+++ arch//hppa/include/pmap.h   5 Apr 2011 16:30:59 -
@@ -101,6 +101,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint)
return pmap_prefer_hint;
 }
 
+/* pmap prefer alignment */
+#define PMAP_PREFER_ALIGN()(HPPA_PGALIAS)
+/* pmap prefer offset within alignment */
+#define PMAP_PREFER_OFFSET(of) ((of)  HPPA_PGAOFF)
+
 #definepmap_sid2pid(s) (((s) + 1)  1)
 #define pmap_kernel()  (kernel_pmap_store)
 #definepmap_resident_count(pmap)   
((pmap)-pm_stats.resident_count)
Index: arch//hppa64/include/pmap.h
===
RCS file: /cvs/src/sys/arch/hppa64/include/pmap.h,v
retrieving revision 1.4
diff -u -d -p -r1.4 pmap.h
--- arch//hppa64/include/pmap.h 26 Dec 2010 15:40:59 -  1.4
+++ arch//hppa64/include/pmap.h 5 Apr 2011 16:30:59 -
@@ -68,6 +68,11 @@ pmap_prefer(vaddr_t offs, vaddr_t hint)
return pmap_prefer_hint;
 }
 
+/* pmap prefer alignment */
+#define PMAP_PREFER_ALIGN()(HPPA_PGALIAS)
+/* pmap prefer offset within alignment */
+#define PMAP_PREFER_OFFSET(of) ((of)  HPPA_PGAOFF)
+
 #definePMAP_GROWKERNEL
 #definePMAP_STEAL_MEMORY
 
Index: arch//m68k/include/pmap_motorola.h
===
RCS file: /cvs/src/sys/arch/m68k/include/pmap_motorola.h,v
retrieving revision 1.22
diff -u -d -p -r1.22 pmap_motorola.h
--- arch//m68k/include/pmap_motorola.h  23 Mar 2011 16:54:35 -  1.22
+++ arch//m68k/include/pmap_motorola.h  5 Apr 2011 16:30:59 -
@@ -139,6 +139,12 @@ void   pmap_kenter_cache(vaddr_t, paddr_t,
 #ifdef M68K_MMU_HP
 vaddr_tpmap_prefer(vaddr_t, vaddr_t);
 #definePMAP_PREFER(foff, va)   pmap_prefer((foff), (va))
+
+extern int pmap_aliasmask; /* separation at which VA aliasing is ok */
+/* pmap prefer alignment */
+#define PMAP_PREFER_ALIGN()(pmap_aliasmask ? pmap_aliasmask + 1 : 0)
+/* pmap prefer offset */
+#define PMAP_PREFER_OFFSET(of) ((of)  pmap_aliasmask)
 #endif
 
 #endif /* _KERNEL */
Index: arch//m68k/m68k/pmap_motorola.c
===
RCS file: /cvs/src/sys/arch/m68k/m68k/pmap_motorola.c,v
retrieving revision 1.59
diff -u -d -p -r1.59 pmap_motorola.c
--- arch//m68k/m68k/pmap_motorola.c 6 Dec 2010 20:57:16 -   1.59
+++ arch//m68k/m68k/pmap_motorola.c 5 Apr 2011 16:30:59 -
@@ -276,9 +276,6 @@ vaddr_t virtual_end;/* VA of last avai
 TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
 intpv_nfree;
 
-#if defined(M68K_MMU_HP)
-extern int pmap_aliasmask; /* separation at which VA aliasing is ok */
-#endif
 #if defined(M68040) || defined(M68060)
 intprotostfree;/* prototype (default) free ST map */
 #endif
Index: arch//mips64/include/pmap.h
===
RCS file: /cvs/src/sys/arch/mips64/include/pmap.h,v
retrieving revision 1.25
diff -u -d -p -r1.25 pmap.h
--- arch//mips64/include/pmap.h 23 Mar 2011 16:54:36 -  1.25
+++ arch//mips64/include/pmap.h 5 Apr 2011 16:30:59 -
@@ -125,6 +125,13 @@ extern struct pmap *const kernel_pmap_pt
 
 #define PMAP_PREFER(pa, va)pmap_prefer(pa, va)
 
+extern vaddr_t CpuCacheAliasMask;  /* from mips64/mips64/cpu.c */
+/* pmap prefer alignment */
+#define PMAP_PREFER_ALIGN()\
+   (CpuCacheAliasMask ? CpuCacheAliasMask + 1 : 0)
+/* pmap prefer offset 

Re: mechanic rename M_{TCP|UDP}V4_CSUM_OUT - M_{TCP|UDP}_CSUM_OUT

2011-04-05 Thread Henning Brauer
* Henning Brauer henn...@openbsd.org [2011-04-05 18:22]:
 - if (m-m_pkthdr.csum_flags  M_IPV4_CSUM_OUT)
 + if (m-m_pkthdr.csum_flags  M_IP_CSUM_OUT)

err. minus this of course.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de
Full-Service ISP - Secure Hosting, Mail and DNS Services
Dedicated Servers, Rootservers, Application Hosting



Comunicazione Giornale Sanitaliaweb

2011-04-05 Thread RB COMUNICAZIONI
[IMAGE]

Alla cortese attenzione dell'Area Stampa e Comunicazione

OGGETTO: Inserimento Giornale nel Vostro indirizzario per ricevere
comunicazioni dalla Vostra Azienda/dal Vostro Ente.

Egregi,

www.sanitaliaweb.it h un Giornale On Line dedicato interamente al mondo
della Sanit`. Punto di riferimento rigoroso e credibile per l’incontro e
lo scambio di esperienze fra tutti gli operatori e i fruitori del
servizio sanitario pubblico e privato.

I nostri lettori sono cittadini comuni, medici specialisti, operatori
della salute e del benessere, professionisti di strutture cliniche e
sanitarie, universitari, ricercatori.

Fate veicolare le notizie che Vi riguardano anche attraverso
Sanitaliaweb.it, inviando al Giornale Vostri note e comunicati
all'indirizzo e-mail: redazi...@sanitaliaweb.it

Nel ringraziaVi di quanto farete, porgiamo distinti saluti.

Sanitaliaweb.it
Area Comunicazioni Esterne



R.B. Comunicazioni scarl Via Picazio, 1 - CASERTA
Tel. 0823 1700340 - Fax 0823 1761335 i...@rbcom.it | rb...@pec.it



Re: mechanic rename M_{TCP|UDP}V4_CSUM_OUT - M_{TCP|UDP}_CSUM_OUT

2011-04-05 Thread Kenneth R Westerback
On Tue, Apr 05, 2011 at 06:19:32PM +0200, Henning Brauer wrote:
 so i wanna change the world order a bit again.
 basically, no part of the tree should bother with setting tcp and udp
 checksums. when they are needed, the stack just sets these flags, and
 ip_output / ip6_output do the checksum then. we're not too far off for
 ipv4, as usual ipv6 has it all wrong.
 most parts of the stack dealing with udp and tcp don't seperate v4/v6,
 and having gazillions of
 if (af == AF_INET)
   m-m_flags |= M_TCPV4_CSUM_OUT;
 else
   m-m_flags |= M_TCPV6_CSUM_OUT;
 is stupid. ip_output and ip6_output do have an idea wether they deal
 with v4 or v6... (despite the fact that you could just do the
 conditional on af there if really needed)
 
 so here we go. ok?

Seems reasonable to me, not being a netinet[6] habitue. ok krw@ for
what that is worth.

 Ken



Cree su propia publicidad

2011-04-05 Thread ven...@depaginasweb.com.ar
Tel: 4582-4002 / 6091-4750

Si tiene problemas para visualizar este correo hagaClick aqum

Emarketingmasivo.com.ar

Llegue a potenciales clientes
=

El envmo de correo electrsnico es una herramienta muy eficaz, por su bajo
costo e impacto a la hora de atraer y/o fidelizar clientes.
-

LLEGUE A SUS POTENCIALES CLIENTES, COMO NOSOTROS LLEGAMOS A USTED!!!

Comunicacisn eficiente:
Envme informacisn de productos o servicios, promociones, mensajes
especiales a sus clientes y contactos.campaqas de fidelizacisn con los
costos mas bajos de mercado y facil implementacisn.

PODEMOS HACER SU CAMPAQA S PUEDE REALIZARLA USTED MISMO

Depaginasweb cuenta con un programa flexible y facil de utilizar,
desarrollado exclusivamente para el envmo de campaqas de email marketing.

O si lo prefiere Hacemos todo nosotros

COSTOS DE ENVMO : Puede optar por paquetes que van de 1.000 a 100.000
envmos

DISEQO : Realizamos el diseqo de su newsletter al mejor precio de
mercado.

Disponemos de mas de 200 pllanillas Gratis si desea realizarlo sin costo.

REPORTES EN TIEMPO REAL : Siga On Line vma web la informacisn sobre
Envmos. Aperturas. Rebotes. Eliminados. Graficos. etc..

Coszltenos a : ven...@depaginasweb.com.ar

Si no desea recibir mas nuestros newsletter's, puede desuscribirse
haciendo Click Aqui.

---



Re: Use km_alloc instead of the single page allocator

2011-04-05 Thread Anton Maksimenkov
2011/4/5 Anton Maksimenkov anton...@gmail.com:
 I have some idea related to allocator for (! __HAVE_PMAP_DIRECT) case.
...
 My idea is how to resolve that loop by another way.
 We must keep track the number of free kentries. And when we see, in
 uvm_mapent_alloc(), that there is only 1 kentry remains then we must
 allocate more entries immediately. This last kentry may be used by
 uvm_map. So, when it will be done we'll have a page, divide it to new
 fresh entries, and now we safe.
 Then we can proceed further.

Sorry, I missed the main trick.
There are must be some flag which tells the uvm_mapent_alloc() that it
was called recursively, so in that case it must use and return last
free kentry and not call km_alloc() again.
Furthermore, I think that it must check that if it is called
recursively then splvm() was already done.

  struct vm_map_entry *
  uvm_mapent_alloc(struct vm_map *map, int flags)
  {
 -   struct vm_map_entry *me, *ne;
 +   struct vm_map_entry *me;
...
if (recursion flag) {
me = uvm.kentry_free;
if (me == NULL)
panic(uvm_mapent_alloc: uvm.kentry_free is NULL in recursive call);
uvm.kentry_free = me-next; // NULL
uvm.numof_free_kentries--; // 0
uvmexp.kmapent++;
me-flags = UVM_MAP_STATIC;
} else if (map-flags  VM_MAP_INTRSAFE || cold) {
 +   /*
 +* If there is only one kentry remains we MUST
 +* allocate more (page of) entries.
 +* Because uvm_km_kmemalloc (called by uvm_km_alloc)
 +* may use that last kentry when it tries to uvm_map new
 +* physical page.
 +* Then this virtual address of that mapped physpage
 +* will be returned to us (by uvm_km_alloc) so we can
 +* allocate more kentries from it and proceed
 +*/
 +   if (uvm.numof_free_kentries == 1 || cold) {
 +   me = km_alloc(PAGE_SIZE, kv_page, kp_dirty,

here setup and pass the recursion flag into km_alloc() and it must
pass it into uvm_map() and it must pass it into the
uvm_mapent_alloc().

kd_nowait);

And, as it was pointed by art@, in the km_alloc() the kmem_map must be
used instead of kernel_map.

Again, excuse me for ugly style of my diffs...
--
antonvm



Re: horribly slow fsck_ffs pass1 performance

2011-04-05 Thread Andres Perera
On Tue, Apr 5, 2011 at 7:06 AM, Janne Johansson icepic...@gmail.com wrote:
 /forcefsck and /fastboot have nothing to do with that
 they are not even administered by the fs

 I wasn't trying to imply the filesystem is putting the files there, nor
 reading them. Rather, those two files show that
 since there is no way to mark known brokeness in a ext file system, we
wrap
 it up in shell scripts that create and look for
 B those files in order to 'know' if the filesystems are broken or not and
if
 fsck is in order

sorry, but those files aren't for that purpose. they're just means of
queuing fscks and never intended as a viable replacement for dirty
flags

conversely, openbsd has got /fastboot, yet aptly omits /forcefsck

you could say the latter has been avoided because it's a chicken and
egg problem, but keep in mind that it forces fsck on all filesystems
with a fs_passno greater than zero, not just root, and that / is very
unlikely to become corrupted because it's typically split and seldom
written to



more km_alloc - fork, exec and pipes

2011-04-05 Thread Artur Grabowski
A few more conversions to km_alloc: exec arguments, kernel stacks and
pipe buffers.

Tested on amd64, i386 and sparc. Please give it a spin on other architectures,
I would be especially interested in mips64 since it's the only one that needs
kernel stack alignment.

//art

Index: kern/kern_exec.c
===
RCS file: /cvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.117
diff -u -r1.117 kern_exec.c
--- kern/kern_exec.c4 Apr 2011 13:00:13 -   1.117
+++ kern/kern_exec.c5 Apr 2011 20:45:08 -
@@ -227,6 +227,11 @@
return (error);
 }
 
+struct kmem_va_mode kv_exec = {
+   .kv_map = exec_map,
+   .kv_wait = 1
+};
+
 /*
  * exec system call
  */
@@ -312,7 +317,7 @@
/* XXX -- THE FOLLOWING SECTION NEEDS MAJOR CLEANUP */
 
/* allocate an argument buffer */
-   argp = (char *) uvm_km_valloc_wait(exec_map, NCARGS);
+   argp = km_alloc(NCARGS, kv_exec, kp_pageable, kd_waitok);
 #ifdef DIAGNOSTIC
if (argp == NULL)
panic(execve: argp == NULL);
@@ -592,7 +597,7 @@
splx(s);
}
 
-   uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+   km_free(argp, NCARGS, kv_exec, kp_pageable);
 
pool_put(namei_pool, nid.ni_cnd.cn_pnbuf);
vn_close(pack.ep_vp, FREAD, cred, p);
@@ -689,7 +694,7 @@
/* close and put the exec'd file */
vn_close(pack.ep_vp, FREAD, cred, p);
pool_put(namei_pool, nid.ni_cnd.cn_pnbuf);
-   uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+   km_free(argp, NCARGS, kv_exec, kp_pageable);
 
  freehdr:
free(pack.ep_hdr, M_EXEC);
@@ -717,7 +722,7 @@
free(pack.ep_emul_arg, M_TEMP);
pool_put(namei_pool, nid.ni_cnd.cn_pnbuf);
vn_close(pack.ep_vp, FREAD, cred, p);
-   uvm_km_free_wakeup(exec_map, (vaddr_t) argp, NCARGS);
+   km_free(argp, NCARGS, kv_exec, kp_pageable);
 
 free_pack_abort:
free(pack.ep_hdr, M_EXEC);
Index: kern/kern_fork.c
===
RCS file: /cvs/src/sys/kern/kern_fork.c,v
retrieving revision 1.125
diff -u -r1.125 kern_fork.c
--- kern/kern_fork.c3 Apr 2011 14:56:28 -   1.125
+++ kern/kern_fork.c5 Apr 2011 20:45:08 -
@@ -195,6 +195,11 @@
 /* print the 'table full' message once per 10 seconds */
 struct timeval fork_tfmrate = { 10, 0 };
 
+struct kmem_va_mode kv_fork = {
+   .kv_map = kernel_map,
+   .kv_align = USPACE_ALIGN
+};
+
 int
 fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
 void (*func)(void *), void *arg, register_t *retval,
@@ -204,7 +209,7 @@
uid_t uid;
struct vmspace *vm;
int count;
-   vaddr_t uaddr;
+   struct user *uaddr;
int s;
extern void endtsleep(void *);
extern void realitexpire(void *);
@@ -251,10 +256,7 @@
return (EAGAIN);
}
 
-   uaddr = uvm_km_kmemalloc_pla(kernel_map, uvm.kernel_object, USPACE,
-   USPACE_ALIGN, UVM_KMF_ZERO,
-   dma_constraint.ucr_low, dma_constraint.ucr_high,
-   0, 0, USPACE/PAGE_SIZE);
+   uaddr = km_alloc(USPACE, kv_fork, kp_dma_zero, kd_waitok);
if (uaddr == 0) {
chgproccnt(uid, -1);
nprocs--;
Index: kern/sys_pipe.c
===
RCS file: /cvs/src/sys/kern/sys_pipe.c,v
retrieving revision 1.58
diff -u -r1.58 sys_pipe.c
--- kern/sys_pipe.c 14 Jan 2010 23:12:11 -  1.58
+++ kern/sys_pipe.c 5 Apr 2011 20:45:08 -
@@ -168,9 +168,9 @@
 int
 pipespace(struct pipe *cpipe, u_int size)
 {
-   caddr_t buffer;
+   void *buffer;
 
-   buffer = (caddr_t)uvm_km_valloc(kernel_map, size);
+   buffer = km_alloc(size, kv_any, kp_pageable, kd_waitok);
if (buffer == NULL) {
return (ENOMEM);
}
@@ -714,8 +714,8 @@
if (cpipe-pipe_buffer.size  PIPE_SIZE)
--nbigpipe;
amountpipekva -= cpipe-pipe_buffer.size;
-   uvm_km_free(kernel_map, (vaddr_t)cpipe-pipe_buffer.buffer,
-   cpipe-pipe_buffer.size);
+   km_free(cpipe-pipe_buffer.buffer, cpipe-pipe_buffer.size,
+   kv_any, kp_pageable);
cpipe-pipe_buffer.buffer = NULL;
}
 }
Index: uvm/uvm_glue.c
===
RCS file: /cvs/src/sys/uvm/uvm_glue.c,v
retrieving revision 1.56
diff -u -r1.56 uvm_glue.c
--- uvm/uvm_glue.c  1 Apr 2011 15:43:13 -   1.56
+++ uvm/uvm_glue.c  5 Apr 2011 20:45:08 -
@@ -361,9 +361,11 @@
 void
 uvm_exit(struct proc *p)
 {
+   extern struct kmem_va_mode kv_fork;
+
uvmspace_free(p-p_vmspace);
p-p_vmspace = NULL;
-   uvm_km_free(kernel_map, (vaddr_t)p-p_addr, USPACE);
+   km_free(p-p_addr, USPACE, kv_fork, kp_dma);

merge vfs_conf.c and vfs_init.c

2011-04-05 Thread Thordur Bjornsson
no need to have two tiny files around.

stuff everything into vfs_init, it belongs there
(along with other stuff, that will get moved soonish).

OK ?


Index: conf/files
===
RCS file: /home/thib/cvs/src/sys/conf/files,v
retrieving revision 1.511
diff -u -p -r1.511 files
--- conf/files  5 Apr 2011 18:51:25 -   1.511
+++ conf/files  5 Apr 2011 19:43:16 -
@@ -759,7 +759,6 @@ file kern/vfs_bio.c
 file kern/vfs_biomem.c
 file kern/vfs_cache.c
 file kern/vfs_cluster.c
-file kern/vfs_conf.c
 file kern/vfs_default.c
 file kern/vfs_init.c
 file kern/vfs_lockf.c
Index: kern/vfs_conf.c
===
RCS file: kern/vfs_conf.c
diff -N kern/vfs_conf.c
--- kern/vfs_conf.c 5 Apr 2011 18:51:25 -   1.41
+++ /dev/null   1 Jan 1970 00:00:00 -
@@ -1,179 +0,0 @@
-/* $OpenBSD: vfs_conf.c,v 1.41 2011/04/05 18:51:25 thib Exp $  */
-/* $NetBSD: vfs_conf.c,v 1.21.4.1 1995/11/01 00:06:26 jtc Exp $*/
-
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)vfs_conf.c  8.8 (Berkeley) 3/31/94
- */
-
-#include sys/param.h
-#include sys/mount.h
-#include sys/vnode.h
-#include sys/timeout.h
-
-#ifdef FFS
-#include ufs/ufs/quota.h
-#include ufs/ufs/inode.h
-#include ufs/ffs/ffs_extern.h
-#endif
-
-#ifdef EXT2FS
-#include ufs/ext2fs/ext2fs_extern.h
-#endif
-
-#ifdef CD9660
-#include isofs/cd9660/iso.h
-#include isofs/cd9660/cd9660_extern.h
-#endif
-
-#ifdef MFS
-#include ufs/mfs/mfs_extern.h
-#endif
-
-#ifdef NFSCLIENT
-#include nfs/rpcv2.h
-#include nfs/nfsproto.h
-#include nfs/nfsnode.h
-#include nfs/nfs.h
-#include nfs/nfsmount.h
-#endif
-
-/*
- * This defines the root filesystem.
- */
-struct vnode *rootvnode;
-
-/*
- * Set up the filesystem operations for vnodes.
- * The types are defined in mount.h.
- */
-
-
-#ifdef FFS
-extern const struct vfsops ffs_vfsops;
-#endif
-
-#ifdef MFS
-extern const struct vfsops mfs_vfsops;
-#endif
-
-#ifdef MSDOSFS
-extern const struct vfsops msdosfs_vfsops;
-#endif
-
-#ifdef NFSCLIENT
-extern const struct vfsops nfs_vfsops;
-#endif
-
-#ifdef PROCFS
-extern const struct vfsops procfs_vfsops;
-#endif
-
-#ifdef CD9660
-extern const struct vfsops cd9660_vfsops;
-#endif
-
-#ifdef EXT2FS
-extern const struct vfsops ext2fs_vfsops;
-#endif
-
-#ifdef NNPFS
-extern  const struct vfsops nnpfs_vfsops;
-#endif
-
-#ifdef NTFS
-extern  const struct vfsops ntfs_vfsops;
-#endif
-
-#ifdef UDF
-extern  const struct vfsops udf_vfsops;
-#endif
-
-/*
- * Set up the filesystem operations for vnodes.
- */
-static struct vfsconf vfsconflist[] = {
-
-/* Fast Filesystem */
-#ifdef FFS
-{ ffs_vfsops, MOUNT_FFS, 1, 0, MNT_LOCAL, NULL },
-#endif
-
-/* Memory-based Filesystem */
-#ifdef MFS
-{ mfs_vfsops, MOUNT_MFS, 3, 0, MNT_LOCAL, NULL },
-#endif
-
-#ifdef EXT2FS
-   { ext2fs_vfsops, MOUNT_EXT2FS, 17, 0, MNT_LOCAL, NULL },
-#endif
-/* ISO9660 (aka CDROM) Filesystem */
-#ifdef CD9660
-{ cd9660_vfsops, MOUNT_CD9660, 14, 0, MNT_LOCAL, NULL },
-#endif
-
-/* MSDOS Filesystem */
-#ifdef MSDOSFS
-{ msdosfs_vfsops, MOUNT_MSDOS, 4, 0, MNT_LOCAL, NULL },
-#endif
-
-/* Sun-compatible Network Filesystem */
-#ifdef NFSCLIENT
-{ nfs_vfsops, MOUNT_NFS, 2, 0, 0, NULL },
-#endif
-
-   /* NNPFS */
-#ifdef NNPFS
-   { nnpfs_vfsops, MOUNT_NNPFS, 21, 

Re: more km_alloc - fork, exec and pipes

2011-04-05 Thread Mark Kettenis
 Date: Tue, 5 Apr 2011 14:50:01 -0600 (MDT)
 From: Artur Grabowski a...@cvs.openbsd.org
 
 Index: kern/kern_fork.c
 ===
 RCS file: /cvs/src/sys/kern/kern_fork.c,v
 retrieving revision 1.125
 diff -u -r1.125 kern_fork.c
 --- kern/kern_fork.c  3 Apr 2011 14:56:28 -   1.125
 +++ kern/kern_fork.c  5 Apr 2011 20:45:08 -
 @@ -195,6 +195,11 @@
  /* print the 'table full' message once per 10 seconds */
  struct timeval fork_tfmrate = { 10, 0 };
  
 +struct kmem_va_mode kv_fork = {
 + .kv_map = kernel_map,
 + .kv_align = USPACE_ALIGN
 +};
 +
  int
  fork1(struct proc *p1, int exitsig, int flags, void *stack, size_t stacksize,
  void (*func)(void *), void *arg, register_t *retval,
 @@ -204,7 +209,7 @@
   uid_t uid;
   struct vmspace *vm;
   int count;
 - vaddr_t uaddr;
 + struct user *uaddr;

If you do this...

   int s;
   extern void endtsleep(void *);
   extern void realitexpire(void *);
 @@ -251,10 +256,7 @@
   return (EAGAIN);
   }
  
 - uaddr = uvm_km_kmemalloc_pla(kernel_map, uvm.kernel_object, USPACE,
 - USPACE_ALIGN, UVM_KMF_ZERO,
 - dma_constraint.ucr_low, dma_constraint.ucr_high,
 - 0, 0, USPACE/PAGE_SIZE);
 + uaddr = km_alloc(USPACE, kv_fork, kp_dma_zero, kd_waitok);
   if (uaddr == 0) {

...you should use NULL in the comparison here and drop the (struct
user *) cast a bit further down.



Re: more km_alloc - fork, exec and pipes

2011-04-05 Thread Miod Vallat
 A few more conversions to km_alloc: exec arguments, kernel stacks and
 pipe buffers.
 
 Tested on amd64, i386 and sparc. Please give it a spin on other architectures,
 I would be especially interested in mips64 since it's the only one that needs
 kernel stack alignment.

Works on mips64 with 4KB pages (which is the only case of
allocation with alignment where the size is larger than a page).



Re: more km_alloc - fork, exec and pipes

2011-04-05 Thread Artur Grabowski
On Tue, Apr 5, 2011 at 11:16 PM, Mark Kettenis mark.kette...@xs4all.nl
wrote:

 + uaddr = km_alloc(USPACE, kv_fork, kp_dma_zero, kd_waitok);
   if (uaddr == 0) {

 ...you should use NULL in the comparison here and drop the (struct
 user *) cast a bit further down.


Yup. I'll fix that after commit.

//art



Re: Use km_alloc instead of the single page allocator

2011-04-05 Thread Ariane van der Steldt
On Wed, Apr 06, 2011 at 12:12:35AM +0600, Anton Maksimenkov wrote:
 2011/4/5 Anton Maksimenkov anton...@gmail.com:
  I have some idea related to allocator for (! __HAVE_PMAP_DIRECT) case.
 ...
  My idea is how to resolve that loop by another way.
  We must keep track the number of free kentries. And when we see, in
  uvm_mapent_alloc(), that there is only 1 kentry remains then we must
  allocate more entries immediately. This last kentry may be used by
  uvm_map. So, when it will be done we'll have a page, divide it to new
  fresh entries, and now we safe.
  Then we can proceed further.
 
 Sorry, I missed the main trick.
 There are must be some flag which tells the uvm_mapent_alloc() that it
 was called recursively, so in that case it must use and return last
 free kentry and not call km_alloc() again.
 Furthermore, I think that it must check that if it is called
 recursively then splvm() was already done.
 
  ?struct vm_map_entry *
  ?uvm_mapent_alloc(struct vm_map *map, int flags)
  ?{
  - ? ? ? struct vm_map_entry *me, *ne;
  + ? ? ? struct vm_map_entry *me;
 ...
 if (recursion flag) {
 me = uvm.kentry_free;
 if (me == NULL)
 panic(uvm_mapent_alloc: uvm.kentry_free is NULL in recursive call);
 uvm.kentry_free = me-next; // NULL
 uvm.numof_free_kentries--; // 0
 uvmexp.kmapent++;
 me-flags = UVM_MAP_STATIC;
 } else if (map-flags  VM_MAP_INTRSAFE || cold) {
  + ? ? ? ? ? ? ? /*
  + ? ? ? ? ? ? ? ?* If there is only one kentry remains we MUST
  + ? ? ? ? ? ? ? ?* allocate more (page of) entries.
  + ? ? ? ? ? ? ? ?* Because uvm_km_kmemalloc (called by uvm_km_alloc)
  + ? ? ? ? ? ? ? ?* may use that last kentry when it tries to uvm_map new
  + ? ? ? ? ? ? ? ?* physical page.
  + ? ? ? ? ? ? ? ?* Then this virtual address of that mapped physpage
  + ? ? ? ? ? ? ? ?* will be returned to us (by uvm_km_alloc) so we can
  + ? ? ? ? ? ? ? ?* allocate more kentries from it and proceed
  + ? ? ? ? ? ? ? ?*/
  + ? ? ? ? ? ? ? if (uvm.numof_free_kentries == 1 || cold) {
  + ? ? ? ? ? ? ? ? ? ? ? me = km_alloc(PAGE_SIZE, kv_page, kp_dirty,
 
 here setup and pass the recursion flag into km_alloc() and it must
 pass it into uvm_map() and it must pass it into the
 uvm_mapent_alloc().
 
  ? ? ? ? ? ? ? ? ? ? ? ? ? ?kd_nowait);
 
 And, as it was pointed by art@, in the km_alloc() the kmem_map must be
 used instead of kernel_map.
 
 Again, excuse me for ugly style of my diffs...

Actually, the long-term fix is to make kernel memory interupt safe :D

You don't want to recurse in the uvm_km_getpage, it's a hornests nest.
It must be interupt safe, spl protected. If you recurse with a flag,
you may risk another thread using your skip my locking etc. flags.
While it is not an unsolvable problem, it probably won't improve
readability of that code.
Also, recurion in the kernel is problematic: we have a very small stack
and may run out easily. Could you guarantee that it wouldn't recurse
more than once?

Ciao,
-- 
Ariane



Push kernel stacks and malloc memory high

2011-04-05 Thread Theo de Raadt
We might not ever do this, but at the moment as we go into bigmem dma handling
it is nice if we trigger bugs earlier rather than later.

This triggers some bugs, some of which are easy to fix.  Run it please if you
can and report problems in details.

Index: kern_fork.c
===
RCS file: /cvs/src/sys/kern/kern_fork.c,v
retrieving revision 1.125
diff -u -p -u -r1.125 kern_fork.c
--- kern_fork.c 3 Apr 2011 14:56:28 -   1.125
+++ kern_fork.c 5 Apr 2011 23:05:26 -
@@ -253,7 +253,7 @@ fork1(struct proc *p1, int exitsig, int 
 
uaddr = uvm_km_kmemalloc_pla(kernel_map, uvm.kernel_object, USPACE,
USPACE_ALIGN, UVM_KMF_ZERO,
-   dma_constraint.ucr_low, dma_constraint.ucr_high,
+   no_constraint.ucr_low, no_constraint.ucr_high,
0, 0, USPACE/PAGE_SIZE);
if (uaddr == 0) {
chgproccnt(uid, -1);
Index: kern_malloc.c
===
RCS file: /cvs/src/sys/kern/kern_malloc.c,v
retrieving revision 1.86
diff -u -p -u -r1.86 kern_malloc.c
--- kern_malloc.c   26 Sep 2010 21:03:56 -  1.86
+++ kern_malloc.c   5 Apr 2011 23:05:20 -
@@ -244,7 +244,7 @@ malloc(unsigned long size, int type, int
(vsize_t)ptoa(npg), 0,
((flags  M_NOWAIT) ? UVM_KMF_NOWAIT : 0) |
((flags  M_CANFAIL) ? UVM_KMF_CANFAIL : 0),
-   dma_constraint.ucr_low, dma_constraint.ucr_high,
+   no_constraint.ucr_low, no_constraint.ucr_high,
0, 0, 0);
if (va == NULL) {
/*



no really, be quiet mode for ping{,6}

2011-04-05 Thread Peter Hessler
Sometimes I want ping to be quiet.  Not quiet in the only show me
headers way that the original author thought was cute, but in the
don't show me anything way, so cron doesn't spam me with useless
crap.

So, in honor of that, here is a patch to add -Q to ping and ping6.

OK?


Index: sbin/ping/ping.8
===
RCS file: /cvs/openbsd/src/sbin/ping/ping.8,v
retrieving revision 1.45
diff -u -p -r1.45 ping.8
--- sbin/ping/ping.83 Jul 2010 04:44:51 -   1.45
+++ sbin/ping/ping.85 Apr 2011 21:23:29 -
@@ -39,7 +39,7 @@
 .Sh SYNOPSIS
 .Nm ping
 .Bk -words
-.Op Fl DdEefLnqRrv
+.Op Fl DdEefLnQqRrv
 .Op Fl c Ar count
 .Op Fl I Ar ifaddr
 .Op Fl i Ar wait
@@ -155,6 +155,9 @@ will cause the sent packet to be filled 
 Quiet output.
 Nothing is displayed except the summary lines at startup time and
 when finished.
+.It Fl Q
+Very quiet output.
+Nothing is displayed at all.
 .It Fl R
 Record route.
 Includes the
Index: sbin/ping/ping.c
===
RCS file: /cvs/openbsd/src/sbin/ping/ping.c,v
retrieving revision 1.88
diff -u -p -r1.88 ping.c
--- sbin/ping/ping.c3 Jul 2010 04:44:51 -   1.88
+++ sbin/ping/ping.c5 Apr 2011 21:12:12 -
@@ -108,6 +108,7 @@ int options;
 #defineF_SO_JUMBO  0x1000
 #defineF_AUD_RECV  0x2000
 #defineF_AUD_MISS  0x4000
+#defineF_REALLY_QUIET  0x8000
 
 /* multicast options */
 int moptions;
@@ -201,7 +202,7 @@ main(int argc, char *argv[])
preload = 0;
datap = outpack[8 + sizeof(struct tvi)];
while ((ch = getopt(argc, argv,
-   DEI:LRS:c:defi:jl:np:qrs:T:t:V:vw:)) != -1)
+   DEI:LRS:c:defi:jl:np:Qqrs:T:t:V:vw:)) != -1)
switch(ch) {
case 'c':
npackets = (unsigned long)strtonum(optarg, 0,
@@ -277,7 +278,10 @@ main(int argc, char *argv[])
case 'p':   /* fill buffer with user pattern */
options |= F_PINGFILLED;
fill((char *)datap, optarg);
-   break;
+   break;
+   case 'Q':
+   options |= F_REALLY_QUIET;
+   /* FALLTHROUGH */
case 'q':
options |= F_QUIET;
break;
@@ -487,12 +491,14 @@ main(int argc, char *argv[])
warnx(Could only allocate a receive buffer of %i bytes 
(default %i),
bufspace, IP_MAXPACKET);
 
-   if (to-sin_family == AF_INET)
-   (void)printf(PING %s (%s): %d data bytes\n, hostname,
-   inet_ntoa(*(struct in_addr *)to-sin_addr.s_addr),
-   datalen);
-   else
-   (void)printf(PING %s: %d data bytes\n, hostname, datalen);
+   if (!(options  F_REALLY_QUIET)) {
+   if (to-sin_family == AF_INET)
+   (void)printf(PING %s (%s): %d data bytes\n, hostname,
+   inet_ntoa(*(struct in_addr *)to-sin_addr.s_addr),
+   datalen);
+   else
+   (void)printf(PING %s: %d data bytes\n, hostname, 
datalen);
+   }
 
(void)signal(SIGINT, finish);
(void)signal(SIGALRM, catcher);
@@ -1008,7 +1014,9 @@ finish(int signo)
 {
(void)signal(SIGINT, SIG_IGN);
 
-   summary(1, signo);
+   if (!(options  F_REALLY_QUIET))
+   summary(1, signo);
+
if (signo)
_exit(nreceived ? 0 : 1);
else
@@ -1363,7 +1371,7 @@ void
 usage(void)
 {
(void)fprintf(stderr,
-   usage: ping [-DdEefLnqRrv] [-c count] [-I ifaddr] [-i wait]\n
+   usage: ping [-DdEefLnQqRrv] [-c count] [-I ifaddr] [-i wait]\n
\t[-l preload] [-p pattern] [-s packetsize] [-T tos] [-t ttl]\n
\t[-V rtable] [-w maxwait] host\n);
exit(1);
Index: sbin/ping6/ping6.8
===
RCS file: /cvs/openbsd/src/sbin/ping6/ping6.8,v
retrieving revision 1.42
diff -u -p -r1.42 ping6.8
--- sbin/ping6/ping6.8  26 Jun 2010 18:30:03 -  1.42
+++ sbin/ping6/ping6.8  6 Apr 2011 04:52:29 -
@@ -36,7 +36,7 @@
 .Nd send ICMPv6 ECHO_REQUEST packets to network hosts
 .Sh SYNOPSIS
 .Nm ping6
-.Op Fl dEefHmNnqtvWw
+.Op Fl dEefHmNnQqtvWw
 .Op Fl a Ar addrtype
 .Op Fl b Ar bufsiz
 .Op Fl c Ar count
@@ -213,6 +213,9 @@ ones.
 Quiet output.
 Nothing is displayed except the summary lines at startup time and
 when finished.
+.It Fl Q
+Really quiet output.
+Nothing is displayed at all.
 .\.It Fl R
 .\Make the kernel believe that the target
 .\.Ar host
Index: sbin/ping6/ping6.c
===
RCS file: /cvs/openbsd/src/sbin/ping6/ping6.c,v
retrieving revision 1.81
diff -u -p -r1.81 ping6.c
--- sbin/ping6/ping6.c  3 Mar