Re: [PATCH glibc] Hurd: Fix definition of `PAGE_COPY_THRESHOLD'

2014-12-10 Thread Justus Winter
Quoting Justus Winter (2014-12-10 01:50:17)
> Quoting Samuel Thibault (2014-12-10 00:07:28)
> > so people can try them.
> Yes, on real workloads.

Somewhat less synthetic:

% bash do_pipebench.bash
Piping 1024 MByte from zero to null.
(dd if=zero bs=X count=overall/X | dd of=null bs=X)
4096  8192 12288 16384 32768 65536
‘libc.so.0.3’ -> ‘libc.so.586asm’
30.78 15.69 12.11  9.47  5.63  3.90
‘libc.so.0.3’ -> ‘libc.so.1page’
28.57 15.54 10.85  8.13  4.39  2.67
‘libc.so.0.3’ -> ‘libc.so.2page’
29.32 15.30 10.13  8.23  4.51  2.70
‘libc.so.0.3’ -> ‘libc.so.3page’
29.94 17.07 10.93  8.40  4.55  2.62
‘libc.so.0.3’ -> ‘libc.so.4page’
28.88 16.64 11.46  8.16  4.39  2.63
‘libc.so.0.3’ -> ‘libc.so.inftypage’
30.21 14.75 12.33  9.69  6.01  3.91

> > Do not install them in /lib/i386-gnu! That does not seem to be
> > working yet, boot hangs early, apparently when starting pflocal.
> :/ I wonder why.

I believe pflocal is just fine.  Looks like runsystem.sysv or sysvinit
crashes (I wish /hurd/crash would tell us about crashes):

start ext2fs: Hurd server bootstrap: ext2fs[device:hd0s1] exec startup proc 
auth.

Stopped at  machine_idle+0xe:   leave
db> show all ta
ID TASK NAME [THREADS]
0 a0895f00 gnumach [8]
1 a0895e40 ext2fs [12]
2 a0895d80 exec [4]
3 a0895cc0 a0895cc0 [1]
4 a0895c00 a0895c00 [4]
5 a0895b40 a0895b40 [4]
6 a0895900 /hurd/pflocal(9) [6]
7 a0895780 a0895780 [6]
8 a0895840 /hurd/crash(13) [2]
db>

Justus



Neat trick to rescue Hurd systems

2014-12-10 Thread Justus Winter
Hello,

I came up with a neat trick to rescue hanging Hurd systems.  Or
rather, the filesystems.  When we kill an essential task from the
kernel debugger, /hurd/startup will reboot the system:


Stopped  at  machine_idle+0xe:   leave
db> call task_terminate($task4)
 0
db> c
/hurd/startup: Crashing system; essential task proc died
startup: notifying ext2fs device:hd0s1 of reboot...done
startup: rebooting Mach (flags 0)...

Justus



[PATCH hurd 2/5] libpager: use libports notification functions

2014-12-10 Thread Justus Winter
Now that we do not use sequence numbers anymore, we can simply use
libports notification server functions.

* libpager/Makefile (SRCS): Drop `no-senders.c', and `notify-stubs.c'.
(OBJS): Drop `notifyServer.o'.
* libpager/demuxer.c (pager_demuxer): Use libports server functions.
* libpager/mig-mutate.h: Drop all notification mutators.
* libpager/no-senders.c: Remove file.
* libpager/notify-stubs.c: Likewise.
---
 libpager/Makefile   |  6 ++---
 libpager/demuxer.c  |  4 ++--
 libpager/mig-mutate.h   |  9 
 libpager/no-senders.c   | 34 ---
 libpager/notify-stubs.c | 61 -
 5 files changed, 5 insertions(+), 109 deletions(-)
 delete mode 100644 libpager/no-senders.c
 delete mode 100644 libpager/notify-stubs.c

diff --git a/libpager/Makefile b/libpager/Makefile
index 2bfd845..72b4bfd 100644
--- a/libpager/Makefile
+++ b/libpager/Makefile
@@ -20,16 +20,16 @@ makemode := library
 libname = libpager
 SRCS = data-request.c data-return.c data-unlock.c pager-port.c \
inhibit-term.c lock-completed.c lock-object.c mark-error.c \
-   no-senders.c object-init.c object-terminate.c pagemap.c \
+   object-init.c object-terminate.c pagemap.c \
pager-create.c pager-flush.c pager-shutdown.c pager-sync.c \
stubs.c demuxer.c chg-compl.c pager-attr.c clean.c \
-   dropweak.c notify-stubs.c get-upi.c pager-memcpy.c pager-return.c \
+   dropweak.c get-upi.c pager-memcpy.c pager-return.c \
offer-page.c
 installhdrs = pager.h
 
 HURDLIBS= ports
 LDLIBS += -lpthread
-OBJS = $(SRCS:.c=.o) memory_objectServer.o notifyServer.o
+OBJS = $(SRCS:.c=.o) memory_objectServer.o
 
 MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
 MIGCOMSFLAGS = -prefix _pager_
diff --git a/libpager/demuxer.c b/libpager/demuxer.c
index 57a6ccb..4dd3cd8 100644
--- a/libpager/demuxer.c
+++ b/libpager/demuxer.c
@@ -22,7 +22,7 @@
 
 #include "priv.h"
 #include "memory_object_S.h"
-#include "notify_S.h"
+#include "libports/notify_S.h"
 #include "queue.h"
 
 /*
@@ -89,7 +89,7 @@ pager_demuxer (struct requests *requests,
 
   mig_routine_t routine;
   if (! ((routine = _pager_memory_object_server_routine (inp)) ||
-(routine = _pager_notify_server_routine (inp
+(routine = ports_notify_server_routine (inp
 return FALSE;
 
 #define MASK   (8u - 1u)
diff --git a/libpager/mig-mutate.h b/libpager/mig-mutate.h
index c4f30ce..66d37cd 100644
--- a/libpager/mig-mutate.h
+++ b/libpager/mig-mutate.h
@@ -21,12 +21,3 @@
 #define MEMORY_OBJECT_INTRAN_PAYLOAD pager_t begin_using_pager_payload
 #define MEMORY_OBJECT_DESTRUCTOR end_using_pager (pager_t)
 #define MEMORY_OBJECT_IMPORTS import "mig-decls.h";
-
-#define NOTIFY_INTRAN  \
-  port_info_t begin_using_port_info_port (mach_port_t)
-#define NOTIFY_INTRAN_PAYLOAD  \
-  port_info_t begin_using_port_info_payload
-#define NOTIFY_DESTRUCTOR  \
-  end_using_port_info (port_info_t)
-#define NOTIFY_IMPORTS \
-  import "libports/mig-decls.h";
diff --git a/libpager/no-senders.c b/libpager/no-senders.c
deleted file mode 100644
index b750101..000
--- a/libpager/no-senders.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Called when a nosenders notification happens
-   Copyright (C) 1994, 1995 Free Software Foundation
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-#include "priv.h"
-#include 
-#include "notify_S.h"
-
-error_t
-_pager_do_mach_notify_no_senders (struct port_info *pi,
-mach_port_mscount_t mscount)
-{
-  if (!pi ||
-  pi->class != _pager_class)
-return EOPNOTSUPP;
-
-  ports_no_senders (pi, mscount);
-
-  return 0;
-}
diff --git a/libpager/notify-stubs.c b/libpager/notify-stubs.c
deleted file mode 100644
index 6440815..000
--- a/libpager/notify-stubs.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 
-   Copyright (C) 1995, 2011 Free Software Foundation, Inc.
-   Written by Michael I. Bushnell.
-
-   This file is part of the GNU Hurd.
-
-   The GNU Hurd is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any la

[PATCH hurd 3/5] ext2fs: tune the size of the inode cache

2014-12-10 Thread Justus Winter
The node cache uses a fixed number of buckets giving it a linear
access complexity, although with a small constant factor.  Paper over
this issue by increasing the number of buckets.

* ext2fs/inode.c (INOHSZ): Increase from 512 to 8192 entries.
---
 ext2fs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index ed78265..27530fb 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -39,7 +39,7 @@
 #define UF_IMMUTABLE 0
 #endif
 
-#defineINOHSZ  512
+#defineINOHSZ  8192
 #if((INOHSZ&(INOHSZ-1)) == 0)
 #defineINOHASH(ino)((ino)&(INOHSZ-1))
 #else
-- 
2.1.3




[PATCH hurd 1/5] libpager: remove the `seqno' parameters

2014-12-10 Thread Justus Winter
* libpager/Makefile (MIGSFLAGS): Drop `-DSEQNOS'.
* libpager/priv.h (struct pager): Drop fields `seqno' and `waitingforseqno'.
* libpager/chg-compl.c: Adopt accordingly.
* libpager/data-request.c: Likewise.
* libpager/data-return.c: Likewise.
* libpager/data-unlock.c: Likewise.
* libpager/demuxer.c: Likewise.
* libpager/lock-completed.c: Likewise.
* libpager/no-senders.c: Likewise.
* libpager/notify-stubs.c: Likewise.
* libpager/object-init.c: Likewise.
* libpager/object-terminate.c: Likewise.
* libpager/pager-create.c: Likewise.
* libpager/stubs.c: Likewise.
---
 libpager/Makefile   |  2 +-
 libpager/chg-compl.c|  3 +--
 libpager/data-request.c |  3 +--
 libpager/data-return.c  | 13 ++---
 libpager/data-unlock.c  |  3 +--
 libpager/demuxer.c  |  4 ++--
 libpager/lock-completed.c   |  3 +--
 libpager/no-senders.c   |  3 +--
 libpager/notify-stubs.c | 15 +--
 libpager/object-init.c  |  3 +--
 libpager/object-terminate.c |  3 +--
 libpager/pager-create.c |  2 --
 libpager/priv.h |  3 ---
 libpager/stubs.c|  9 +++--
 14 files changed, 24 insertions(+), 45 deletions(-)

diff --git a/libpager/Makefile b/libpager/Makefile
index a15a899..2bfd845 100644
--- a/libpager/Makefile
+++ b/libpager/Makefile
@@ -31,7 +31,7 @@ HURDLIBS= ports
 LDLIBS += -lpthread
 OBJS = $(SRCS:.c=.o) memory_objectServer.o notifyServer.o
 
-MIGSFLAGS = -DSEQNOS -imacros $(srcdir)/mig-mutate.h
+MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
 MIGCOMSFLAGS = -prefix _pager_
 
 include ../Makeconf
diff --git a/libpager/chg-compl.c b/libpager/chg-compl.c
index 89ccfc8..3ffe60a 100644
--- a/libpager/chg-compl.c
+++ b/libpager/chg-compl.c
@@ -22,8 +22,7 @@
when a memory_object_change_attributes call has completed.  Read this
in combination with pager-attr.c.  */
 kern_return_t
-_pager_seqnos_memory_object_change_completed (struct pager *p,
-  mach_port_seqno_t seq,
+_pager_S_memory_object_change_completed (struct pager *p,
   boolean_t maycache,
   memory_object_copy_strategy_t strat)
 {
diff --git a/libpager/data-request.c b/libpager/data-request.c
index 18f3de6..7069fc8 100644
--- a/libpager/data-request.c
+++ b/libpager/data-request.c
@@ -22,8 +22,7 @@
 
 /* Implement pagein callback as described in . */
 kern_return_t
-_pager_seqnos_memory_object_data_request (struct pager *p,
- mach_port_seqno_t seqno,
+_pager_S_memory_object_data_request (struct pager *p,
  mach_port_t control,
  vm_offset_t offset,
  vm_size_t length,
diff --git a/libpager/data-return.c b/libpager/data-return.c
index f16f323..01f3db2 100644
--- a/libpager/data-return.c
+++ b/libpager/data-return.c
@@ -21,13 +21,12 @@
 #include 
 #include 
 
-/* Worker function used by _pager_seqnos_memory_object_data_return
-   and _pager_seqnos_memory_object_data_initialize.  All args are
-   as for _pager_seqnos_memory_object_data_return; the additional
+/* Worker function used by _pager_S_memory_object_data_return
+   and _pager_S_memory_object_data_initialize.  All args are
+   as for _pager_S_memory_object_data_return; the additional
INITIALIZING arg identifies which function is calling us. */
 kern_return_t
 _pager_do_write_request (struct pager *p,
-mach_port_seqno_t seqno,
 mach_port_t control,
 vm_offset_t offset,
 pointer_t data,
@@ -113,6 +112,7 @@ _pager_do_write_request (struct pager *p,
  than we really have to require (because *all* future writes on
  this object are going to wait for seqno while we wait for the
  previous write), but the case is relatively infrequent.  */
+  /* XXX: Is this still needed?  */
  retry:
   for (i = 0; i < npages; i++)
 if (pm_entries[i] & PM_PAGINGOUT)
@@ -254,8 +254,7 @@ _pager_do_write_request (struct pager *p,
 
 /* Implement pageout call back as described by . */
 kern_return_t
-_pager_seqnos_memory_object_data_return (struct pager *p,
-mach_port_seqno_t seqno,
+_pager_S_memory_object_data_return (struct pager *p,
 mach_port_t control,
 vm_offset_t offset,
 pointer_t data,
@@ -263,6 +262,6 @@ _pager_seqnos_memory_object_data_return (struct pager *p,
 int dirty,
 int kcopy)
 {
-  return _pager_do_write_request (p, seqno, control, offset, data,
+  return _pager_do_write_request (p, control, offset, data,
  length, dirty, kcopy, 0);
 }
diff --git a/libpager/data-unlock.c b/libpager/data-unlock.c

[PATCH hurd 5/5] Replace `bcopy' with `memcpy' or `memmove' as appropriate

2014-12-10 Thread Justus Winter
* ext2fs/inode.c: Replace `bcopy' with `memcpy' or `memmove' as
appropriate.
* ext2fs/pager.c: Likewise.
* isofs/lookup.c: Likewise.
* isofs/main.c: Likewise.
* isofs/rr.c: Likewise.
* libdiskfs/file-get-trans.c: Likewise.
* libiohelp/return-buffer.c: Likewise.
* libpager/pagemap.c: Likewise.
* libpipe/pq.c: Likewise.
* libpipe/pq.h: Likewise.
* libstore/unzipstore.c: Likewise.
* mach-defpager/default_pager.c: Likewise.
* pfinet/ethernet.c: Likewise.
* pfinet/tunnel.c: Likewise.
* storeio/dev.c: Likewise.
---
 ext2fs/inode.c|  6 +++---
 ext2fs/pager.c|  4 ++--
 isofs/lookup.c|  4 ++--
 isofs/main.c  |  2 +-
 isofs/rr.c|  6 +++---
 libdiskfs/file-get-trans.c| 10 +-
 libiohelp/return-buffer.c |  2 +-
 libpager/pagemap.c|  2 +-
 libpipe/pq.c  | 12 ++--
 libpipe/pq.h  |  2 +-
 libstore/unzipstore.c |  6 +++---
 mach-defpager/default_pager.c |  4 ++--
 pfinet/ethernet.c | 10 +-
 pfinet/tunnel.c   |  2 +-
 storeio/dev.c |  6 +++---
 15 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/ext2fs/inode.c b/ext2fs/inode.c
index 27530fb..6b8b749 100644
--- a/ext2fs/inode.c
+++ b/ext2fs/inode.c
@@ -733,7 +733,7 @@ diskfs_set_translator (struct node *np, const char *name, 
unsigned namelen,
 
   buf[0] = namelen & 0xFF;
   buf[1] = (namelen >> 8) & 0xFF;
-  bcopy (name, buf + 2, namelen);
+  memcpy (buf + 2, name, namelen);
 
   blkptr = disk_cache_block_ref (blkno);
   memcpy (blkptr, buf, block_size);
@@ -805,7 +805,7 @@ write_symlink (struct node *node, const char *target)
 
   assert (node->dn_stat.st_blocks == 0);
 
-  bcopy (target, node->dn->info.i_data, len);
+  memcpy (node->dn->info.i_data, target, len);
   node->dn_stat.st_size = len - 1;
   node->dn_set_ctime = 1;
   node->dn_set_mtime = 1;
@@ -822,7 +822,7 @@ read_symlink (struct node *node, char *target)
 
   assert (node->dn_stat.st_size < MAX_INODE_SYMLINK);
 
-  bcopy (node->dn->info.i_data, target, node->dn_stat.st_size);
+  memcpy (target, node->dn->info.i_data, node->dn_stat.st_size);
   return 0;
 }
 
diff --git a/ext2fs/pager.c b/ext2fs/pager.c
index ae51530..a6c4fbb 100644
--- a/ext2fs/pager.c
+++ b/ext2fs/pager.c
@@ -209,7 +209,7 @@ file_pager_read_page (struct node *node, vm_offset_t page,
  else
/* We've already got some buffer, so copy into it.  */
{
- bcopy (new_buf, *buf + offs, new_len);
+ memcpy (*buf + offs, new_buf, new_len);
  free_page_buf (new_buf); /* Return NEW_BUF to our pool.  */
  STAT_INC (file_pagein_freed_bufs);
}
@@ -316,7 +316,7 @@ pending_blocks_write (struct pending_blocks *pb)
/* Put what we're going to write into a page-aligned buffer.  */
{
  void *page_buf = get_page_buf ();
- bcopy (pb->buf + pb->offs, (void *)page_buf, length);
+ memcpy ((void *)page_buf, pb->buf + pb->offs, length);
  err = store_write (store, dev_block, page_buf, length, &amount);
  free_page_buf (page_buf);
}
diff --git a/isofs/lookup.c b/isofs/lookup.c
index b5b814d..e51b9cb 100644
--- a/isofs/lookup.c
+++ b/isofs/lookup.c
@@ -338,7 +338,7 @@ diskfs_get_directs (struct node *dp,
   (ouralloc
? (allocsize *= 2)
: (allocsize = vm_page_size * 2)), 1);
- bcopy ((void *) *data, (void *)newdata, datap - *data);
+ memcpy ((void *) newdata, (void *) *data, datap - *data);
 
  if (ouralloc)
munmap (*data, allocsize / 2);
@@ -374,7 +374,7 @@ diskfs_get_directs (struct node *dp,
  userp->d_type = DT_UNKNOWN;
  userp->d_reclen = reclen;
  userp->d_namlen = namlen;
- bcopy (name, userp->d_name, namlen);
+ memcpy (userp->d_name, name, namlen);
  userp->d_name[namlen] = '\0';
 
  /* And move along */
diff --git a/isofs/main.c b/isofs/main.c
index 5d002af..4f531f7 100644
--- a/isofs/main.c
+++ b/isofs/main.c
@@ -101,7 +101,7 @@ read_sblock ()
   sblock = malloc (sizeof (struct sblock));
   if (!sblock)
 error (1, errno, "Could not allocate memory for superblock");
-  bcopy (sb, sblock, sizeof (struct sblock));
+  memcpy (sblock, sb, sizeof (struct sblock));
   diskfs_end_catch_exception ();
 
   /* Parse some important bits of this */
diff --git a/isofs/rr.c b/isofs/rr.c
index be4395d..adc95c3 100644
--- a/isofs/rr.c
+++ b/isofs/rr.c
@@ -282,7 +282,7 @@ rrip_work (struct dirrect *dr, struct rrip_lookup *rr,
nmbuf = realloc (nmbuf, (nmbufsize += nmlen) + 1);
  assert (nmbuf);
 
- bcopy (nm->name, nmbuf + nmbufsize - nmlen, nmlen);
+ memcpy (nmbuf + nmbufsize - nmlen, nm->name, nmlen);
 
  if (nm->flags & NAM

[PATCH hurd 4/5] Replace `bzero' with `memset'

2014-12-10 Thread Justus Winter
For reference, this patch was created using the following semantic
patch, and then manually applying the change in all functions
containing nested functions, as those are not supported by Coccinelle.

@@
expression A, B;
@@

- bzero (A, B)
+ memset (A, 0, B)

* auth/auth.c: Replace `bzero' with `memset'.
* boot/boot.c: Likewise.
* defpager/defpager.c: Likewise.
* exec/exec.c: Likewise.  Also, drop `safe_bzero' and just use
`hurd_safe_memset' directly.
* ext2fs/ext2fs.c: Likewise.
* ext2fs/getblk.c: Likewise.
* ext2fs/pager.c: Likewise.
* fatfs/pager.c: Likewise.
* ftpfs/dir.c: Likewise.
* ftpfs/netfs.c: Likewise.
* isofs/inode.c: Likewise.
* isofs/pager.c: Likewise.
* libdiskfs/file-getfh.c: Likewise.
* libdiskfs/file-statfs.c: Likewise.
* libfshelp/fetch-root.c: Likewise.
* libfshelp/start-translator.c: Likewise.
* libftpconn/create.c: Likewise.
* libftpconn/open.c: Likewise.
* libftpconn/unix.c: Likewise.
* libpipe/pipe.c: Likewise.
* libps/procstat.c: Likewise.
* libps/spec.c: Likewise.
* libshouldbeinlibc/cacheq.c: Likewise.
* libshouldbeinlibc/idvec.c: Likewise.
* libshouldbeinlibc/ugids.c: Likewise.
* libstore/argp.c: Likewise.
* libstore/enc.c: Likewise.
* libstore/kids.c: Likewise.
* libthreads/alpha/thread.c: Likewise.
* libtreefs/fsys.c: Likewise.
* libtrivfs/file-statfs.c: Likewise.
* mach-defpager/default_pager.c: Likewise.
* pfinet/glue-include/asm/uaccess.h: Likewise.
* pfinet/io-ops.c: Likewise.
* pfinet/options.c: Likewise.
* pfinet/socket.c: Likewise.
* pfinet/timer-emul.c: Likewise.
* pflocal/io.c: Likewise.
* startup/startup.c: Likewise.
* storeio/storeio.c: Likewise.
* sutils/fstab.c: Likewise.
* usermux/usermux.c: Likewise.
* utils/fakeauth.c: Likewise.
* utils/frobauth.c: Likewise.
* utils/login.c: Likewise.
* utils/x.c: Likewise.
---
 auth/auth.c   |  2 +-
 boot/boot.c   |  4 ++--
 defpager/defpager.c   |  3 +--
 exec/exec.c   | 18 +++---
 ext2fs/ext2fs.c   |  2 +-
 ext2fs/getblk.c   |  2 +-
 ext2fs/pager.c|  4 ++--
 fatfs/pager.c |  2 +-
 ftpfs/dir.c   |  4 ++--
 ftpfs/netfs.c |  2 +-
 isofs/inode.c |  2 +-
 isofs/pager.c |  2 +-
 libdiskfs/file-getfh.c|  2 +-
 libdiskfs/file-statfs.c   |  2 +-
 libfshelp/fetch-root.c|  6 +++---
 libfshelp/start-translator.c  |  2 +-
 libftpconn/create.c   |  2 +-
 libftpconn/open.c |  2 +-
 libftpconn/unix.c |  4 ++--
 libpipe/pipe.c|  6 +++---
 libps/procstat.c  |  4 ++--
 libps/spec.c  |  2 +-
 libshouldbeinlibc/cacheq.c|  2 +-
 libshouldbeinlibc/idvec.c |  2 +-
 libshouldbeinlibc/ugids.c |  2 +-
 libstore/argp.c   |  2 +-
 libstore/enc.c|  4 ++--
 libstore/kids.c   |  2 +-
 libthreads/alpha/thread.c |  2 +-
 libtreefs/fsys.c  |  4 ++--
 libtrivfs/file-statfs.c   |  2 +-
 mach-defpager/default_pager.c |  8 
 pfinet/glue-include/asm/uaccess.h |  2 +-
 pfinet/io-ops.c   |  2 +-
 pfinet/options.c  |  4 ++--
 pfinet/socket.c   |  2 +-
 pfinet/timer-emul.c   |  2 +-
 pflocal/io.c  |  4 ++--
 startup/startup.c |  4 ++--
 storeio/storeio.c |  4 ++--
 sutils/fstab.c|  4 ++--
 usermux/usermux.c |  5 +++--
 utils/fakeauth.c  |  2 +-
 utils/frobauth.c  |  2 +-
 utils/login.c |  4 ++--
 utils/x.c |  4 ++--
 46 files changed, 75 insertions(+), 79 deletions(-)

diff --git a/auth/auth.c b/auth/auth.c
index 7d35bd3..c36bcb2 100644
--- a/auth/auth.c
+++ b/auth/auth.c
@@ -59,7 +59,7 @@ create_authhandle (struct authhandle **new)
   error_t err = ports_create_port (authhandle_portclass, auth_bucket,
   sizeof **new, new);
   if (! err)
-bzero (&(*new)->euids, (void *) &(*new)[1] - (void *) &(*new)->euids);
+memset (&(*new)->euids, 0, (void *)&(*new)[1] - (void *)&(*new)->euids);
   return err;
 }
 
diff --git a/boot/boot.c b/boot/boot.c
index e2cb907..4bdeb52 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -359,7 +359,7 @@ boot_script_exec_cmd (void *hook,
   *(char **) p = 0;
   p = (void *) p + sizeof (char *);
   memcpy (p, strings, stringlen);
-  bzero (args, (vm_offset_t) arg_pos & (vm_page_size - 1));
+  memset (args, 0, (vm_offset_t)arg_pos & (vm_page_size - 1));
   vm_write (task, trunc_page ((vm_offset_t) arg_pos), (vm_address_t) args,
stack_end - trunc_page ((vm_offset_t) arg_pos));
   munmap ((caddr_t) args,
@@ -1579,7 +1579,7 @@ S_io_stat (mach_port_t object,
   if (object != pseudo_console)
 retur

Re: [PATCH glibc] Hurd: Fix definition of `PAGE_COPY_THRESHOLD'

2014-12-10 Thread Justus Winter
Quoting Justus Winter (2014-12-10 12:59:43)
> Somewhat less synthetic:
> 
> % bash do_pipebench.bash
> Piping 1024 MByte from zero to null.
> (dd if=zero bs=X count=overall/X | dd of=null bs=X)
> 4096  8192 12288 16384 32768 65536
> ‘libc.so.0.3’ -> ‘libc.so.586asm’
> 30.78 15.69 12.11  9.47  5.63  3.90
> ‘libc.so.0.3’ -> ‘libc.so.1page’
> 28.57 15.54 10.85  8.13  4.39  2.67
> ‘libc.so.0.3’ -> ‘libc.so.2page’
> 29.32 15.30 10.13  8.23  4.51  2.70
> ‘libc.so.0.3’ -> ‘libc.so.3page’
> 29.94 17.07 10.93  8.40  4.55  2.62
> ‘libc.so.0.3’ -> ‘libc.so.4page’
> 28.88 16.64 11.46  8.16  4.39  2.63
> ‘libc.so.0.3’ -> ‘libc.so.inftypage’
> 30.21 14.75 12.33  9.69  6.01  3.91

The effect is more pronounced with pflocal using more memcpy instead
of memmove (bcopy is implemented using memmove).

% bash ~/do_pipebench.bash
Piping 1024 MByte from zero to null.
(dd if=zero bs=X count=overall/X | dd of=null bs=X)
4096  8192 12288 16384 32768 65536
‘libc.so.0.3’ -> ‘libc.so.586asm’
32.57 17.30 12.15  9.38  5.52  3.89
‘libc.so.0.3’ -> ‘libc.so.1page’
29.62 14.26 10.19  7.42  3.43  1.73
‘libc.so.0.3’ -> ‘libc.so.2page’
31.78 14.01  8.69  7.71  3.81  1.81
‘libc.so.0.3’ -> ‘libc.so.3page’
30.90 15.62  8.37  7.12  3.54  1.82
‘libc.so.0.3’ -> ‘libc.so.4page’
31.14 16.40 12.00  7.47  3.81  1.91
‘libc.so.0.3’ -> ‘libc.so.inftypage’
29.83 16.78 11.50  9.50  5.65  3.87

do_pipebench.bash is in the time-memcpy repository.

Justus



Re: [PATCH hurd 3/5] ext2fs: tune the size of the inode cache

2014-12-10 Thread Samuel Thibault
Justus Winter, le Wed 10 Dec 2014 17:21:57 +0100, a écrit :
> The node cache uses a fixed number of buckets giving it a linear
> access complexity, although with a small constant factor.  Paper over
> this issue by increasing the number of buckets.
> 
> * ext2fs/inode.c (INOHSZ): Increase from 512 to 8192 entries.

Ack.

> ---
>  ext2fs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ext2fs/inode.c b/ext2fs/inode.c
> index ed78265..27530fb 100644
> --- a/ext2fs/inode.c
> +++ b/ext2fs/inode.c
> @@ -39,7 +39,7 @@
>  #define UF_IMMUTABLE 0
>  #endif
>  
> -#define  INOHSZ  512
> +#define  INOHSZ  8192
>  #if  ((INOHSZ&(INOHSZ-1)) == 0)
>  #define  INOHASH(ino)((ino)&(INOHSZ-1))
>  #else
> -- 
> 2.1.3
> 

-- 
Samuel
 je la connaissais pas celle la : "make: Entering an unknown directory"
 -+- #ens-mim -+-



Re: [PATCH hurd 4/5] Replace `bzero' with `memset'

2014-12-10 Thread Samuel Thibault
Justus Winter, le Wed 10 Dec 2014 17:21:58 +0100, a écrit :
> For reference, this patch was created using the following semantic
> patch, and then manually applying the change in all functions
> containing nested functions, as those are not supported by Coccinelle.

Ack.




Re: [PATCH hurd 5/5] Replace `bcopy' with `memcpy' or `memmove' as appropriate

2014-12-10 Thread Samuel Thibault
Justus Winter, le Wed 10 Dec 2014 17:21:59 +0100, a écrit :
> * ext2fs/inode.c: Replace `bcopy' with `memcpy' or `memmove' as
> appropriate.
> * ext2fs/pager.c: Likewise.
> * isofs/lookup.c: Likewise.
> * isofs/main.c: Likewise.
> * isofs/rr.c: Likewise.
> * libdiskfs/file-get-trans.c: Likewise.
> * libiohelp/return-buffer.c: Likewise.
> * libpager/pagemap.c: Likewise.
> * libpipe/pq.c: Likewise.
> * libpipe/pq.h: Likewise.
> * libstore/unzipstore.c: Likewise.
> * mach-defpager/default_pager.c: Likewise.
> * pfinet/ethernet.c: Likewise.
> * pfinet/tunnel.c: Likewise.
> * storeio/dev.c: Likewise.

Ack.

> ---
>  ext2fs/inode.c|  6 +++---
>  ext2fs/pager.c|  4 ++--
>  isofs/lookup.c|  4 ++--
>  isofs/main.c  |  2 +-
>  isofs/rr.c|  6 +++---
>  libdiskfs/file-get-trans.c| 10 +-
>  libiohelp/return-buffer.c |  2 +-
>  libpager/pagemap.c|  2 +-
>  libpipe/pq.c  | 12 ++--
>  libpipe/pq.h  |  2 +-
>  libstore/unzipstore.c |  6 +++---
>  mach-defpager/default_pager.c |  4 ++--
>  pfinet/ethernet.c | 10 +-
>  pfinet/tunnel.c   |  2 +-
>  storeio/dev.c |  6 +++---
>  15 files changed, 39 insertions(+), 39 deletions(-)
> 
> diff --git a/ext2fs/inode.c b/ext2fs/inode.c
> index 27530fb..6b8b749 100644
> --- a/ext2fs/inode.c
> +++ b/ext2fs/inode.c
> @@ -733,7 +733,7 @@ diskfs_set_translator (struct node *np, const char *name, 
> unsigned namelen,
>  
>buf[0] = namelen & 0xFF;
>buf[1] = (namelen >> 8) & 0xFF;
> -  bcopy (name, buf + 2, namelen);
> +  memcpy (buf + 2, name, namelen);
>  
>blkptr = disk_cache_block_ref (blkno);
>memcpy (blkptr, buf, block_size);
> @@ -805,7 +805,7 @@ write_symlink (struct node *node, const char *target)
>  
>assert (node->dn_stat.st_blocks == 0);
>  
> -  bcopy (target, node->dn->info.i_data, len);
> +  memcpy (node->dn->info.i_data, target, len);
>node->dn_stat.st_size = len - 1;
>node->dn_set_ctime = 1;
>node->dn_set_mtime = 1;
> @@ -822,7 +822,7 @@ read_symlink (struct node *node, char *target)
>  
>assert (node->dn_stat.st_size < MAX_INODE_SYMLINK);
>  
> -  bcopy (node->dn->info.i_data, target, node->dn_stat.st_size);
> +  memcpy (target, node->dn->info.i_data, node->dn_stat.st_size);
>return 0;
>  }
>  
> diff --git a/ext2fs/pager.c b/ext2fs/pager.c
> index ae51530..a6c4fbb 100644
> --- a/ext2fs/pager.c
> +++ b/ext2fs/pager.c
> @@ -209,7 +209,7 @@ file_pager_read_page (struct node *node, vm_offset_t page,
> else
>   /* We've already got some buffer, so copy into it.  */
>   {
> -   bcopy (new_buf, *buf + offs, new_len);
> +   memcpy (*buf + offs, new_buf, new_len);
> free_page_buf (new_buf); /* Return NEW_BUF to our pool.  */
> STAT_INC (file_pagein_freed_bufs);
>   }
> @@ -316,7 +316,7 @@ pending_blocks_write (struct pending_blocks *pb)
>   /* Put what we're going to write into a page-aligned buffer.  */
>   {
> void *page_buf = get_page_buf ();
> -   bcopy (pb->buf + pb->offs, (void *)page_buf, length);
> +   memcpy ((void *)page_buf, pb->buf + pb->offs, length);
> err = store_write (store, dev_block, page_buf, length, &amount);
> free_page_buf (page_buf);
>   }
> diff --git a/isofs/lookup.c b/isofs/lookup.c
> index b5b814d..e51b9cb 100644
> --- a/isofs/lookup.c
> +++ b/isofs/lookup.c
> @@ -338,7 +338,7 @@ diskfs_get_directs (struct node *dp,
>  (ouralloc
>   ? (allocsize *= 2)
>   : (allocsize = vm_page_size * 2)), 1);
> -   bcopy ((void *) *data, (void *)newdata, datap - *data);
> +   memcpy ((void *) newdata, (void *) *data, datap - *data);
>  
> if (ouralloc)
>   munmap (*data, allocsize / 2);
> @@ -374,7 +374,7 @@ diskfs_get_directs (struct node *dp,
> userp->d_type = DT_UNKNOWN;
> userp->d_reclen = reclen;
> userp->d_namlen = namlen;
> -   bcopy (name, userp->d_name, namlen);
> +   memcpy (userp->d_name, name, namlen);
> userp->d_name[namlen] = '\0';
>  
> /* And move along */
> diff --git a/isofs/main.c b/isofs/main.c
> index 5d002af..4f531f7 100644
> --- a/isofs/main.c
> +++ b/isofs/main.c
> @@ -101,7 +101,7 @@ read_sblock ()
>sblock = malloc (sizeof (struct sblock));
>if (!sblock)
>  error (1, errno, "Could not allocate memory for superblock");
> -  bcopy (sb, sblock, sizeof (struct sblock));
> +  memcpy (sblock, sb, sizeof (struct sblock));
>diskfs_end_catch_exception ();
>  
>/* Parse some important bits of this */
> diff --git a/isofs/rr.c b/isofs/rr.c
> index be4395d..adc95c3 100644
> --- a/isofs/rr.c
> +++ b/isofs/rr.c
> @@ -282,7 +282,7 @@ rrip_work (struct dirrect *dr, struct r

Re: [PATCH hurd 1/5] libpager: remove the `seqno' parameters

2014-12-10 Thread Samuel Thibault
Justus Winter, le Wed 10 Dec 2014 17:21:55 +0100, a écrit :
> * libpager/Makefile (MIGSFLAGS): Drop `-DSEQNOS'.
> * libpager/priv.h (struct pager): Drop fields `seqno' and `waitingforseqno'.
> * libpager/chg-compl.c: Adopt accordingly.
> * libpager/data-request.c: Likewise.
> * libpager/data-return.c: Likewise.
> * libpager/data-unlock.c: Likewise.
> * libpager/demuxer.c: Likewise.
> * libpager/lock-completed.c: Likewise.
> * libpager/no-senders.c: Likewise.
> * libpager/notify-stubs.c: Likewise.
> * libpager/object-init.c: Likewise.
> * libpager/object-terminate.c: Likewise.
> * libpager/pager-create.c: Likewise.
> * libpager/stubs.c: Likewise.

Ack.

> ---
>  libpager/Makefile   |  2 +-
>  libpager/chg-compl.c|  3 +--
>  libpager/data-request.c |  3 +--
>  libpager/data-return.c  | 13 ++---
>  libpager/data-unlock.c  |  3 +--
>  libpager/demuxer.c  |  4 ++--
>  libpager/lock-completed.c   |  3 +--
>  libpager/no-senders.c   |  3 +--
>  libpager/notify-stubs.c | 15 +--
>  libpager/object-init.c  |  3 +--
>  libpager/object-terminate.c |  3 +--
>  libpager/pager-create.c |  2 --
>  libpager/priv.h |  3 ---
>  libpager/stubs.c|  9 +++--
>  14 files changed, 24 insertions(+), 45 deletions(-)
> 
> diff --git a/libpager/Makefile b/libpager/Makefile
> index a15a899..2bfd845 100644
> --- a/libpager/Makefile
> +++ b/libpager/Makefile
> @@ -31,7 +31,7 @@ HURDLIBS= ports
>  LDLIBS += -lpthread
>  OBJS = $(SRCS:.c=.o) memory_objectServer.o notifyServer.o
>  
> -MIGSFLAGS = -DSEQNOS -imacros $(srcdir)/mig-mutate.h
> +MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
>  MIGCOMSFLAGS = -prefix _pager_
>  
>  include ../Makeconf
> diff --git a/libpager/chg-compl.c b/libpager/chg-compl.c
> index 89ccfc8..3ffe60a 100644
> --- a/libpager/chg-compl.c
> +++ b/libpager/chg-compl.c
> @@ -22,8 +22,7 @@
> when a memory_object_change_attributes call has completed.  Read this
> in combination with pager-attr.c.  */
>  kern_return_t
> -_pager_seqnos_memory_object_change_completed (struct pager *p,
> -mach_port_seqno_t seq,
> +_pager_S_memory_object_change_completed (struct pager *p,
>  boolean_t maycache,
>  memory_object_copy_strategy_t strat)
>  {
> diff --git a/libpager/data-request.c b/libpager/data-request.c
> index 18f3de6..7069fc8 100644
> --- a/libpager/data-request.c
> +++ b/libpager/data-request.c
> @@ -22,8 +22,7 @@
>  
>  /* Implement pagein callback as described in . */
>  kern_return_t
> -_pager_seqnos_memory_object_data_request (struct pager *p,
> -   mach_port_seqno_t seqno,
> +_pager_S_memory_object_data_request (struct pager *p,
> mach_port_t control,
> vm_offset_t offset,
> vm_size_t length,
> diff --git a/libpager/data-return.c b/libpager/data-return.c
> index f16f323..01f3db2 100644
> --- a/libpager/data-return.c
> +++ b/libpager/data-return.c
> @@ -21,13 +21,12 @@
>  #include 
>  #include 
>  
> -/* Worker function used by _pager_seqnos_memory_object_data_return
> -   and _pager_seqnos_memory_object_data_initialize.  All args are
> -   as for _pager_seqnos_memory_object_data_return; the additional
> +/* Worker function used by _pager_S_memory_object_data_return
> +   and _pager_S_memory_object_data_initialize.  All args are
> +   as for _pager_S_memory_object_data_return; the additional
> INITIALIZING arg identifies which function is calling us. */
>  kern_return_t
>  _pager_do_write_request (struct pager *p,
> -  mach_port_seqno_t seqno,
>mach_port_t control,
>vm_offset_t offset,
>pointer_t data,
> @@ -113,6 +112,7 @@ _pager_do_write_request (struct pager *p,
>   than we really have to require (because *all* future writes on
>   this object are going to wait for seqno while we wait for the
>   previous write), but the case is relatively infrequent.  */
> +  /* XXX: Is this still needed?  */
>   retry:
>for (i = 0; i < npages; i++)
>  if (pm_entries[i] & PM_PAGINGOUT)
> @@ -254,8 +254,7 @@ _pager_do_write_request (struct pager *p,
>  
>  /* Implement pageout call back as described by . */
>  kern_return_t
> -_pager_seqnos_memory_object_data_return (struct pager *p,
> -  mach_port_seqno_t seqno,
> +_pager_S_memory_object_data_return (struct pager *p,
>mach_port_t control,
>vm_offset_t offset,
>pointer_t data,
> @@ -263,6 +262,6 @@ _pager_seqnos_memory_object_data_return (struct pager *p,
>int dirty,
>int kc

Re: [PATCH hurd 2/5] libpager: use libports notification functions

2014-12-10 Thread Samuel Thibault
Justus Winter, le Wed 10 Dec 2014 17:21:56 +0100, a écrit :
> Now that we do not use sequence numbers anymore, we can simply use
> libports notification server functions.
> 
> * libpager/Makefile (SRCS): Drop `no-senders.c', and `notify-stubs.c'.
> (OBJS): Drop `notifyServer.o'.
> * libpager/demuxer.c (pager_demuxer): Use libports server functions.
> * libpager/mig-mutate.h: Drop all notification mutators.
> * libpager/no-senders.c: Remove file.
> * libpager/notify-stubs.c: Likewise.

Ack.

> ---
>  libpager/Makefile   |  6 ++---
>  libpager/demuxer.c  |  4 ++--
>  libpager/mig-mutate.h   |  9 
>  libpager/no-senders.c   | 34 ---
>  libpager/notify-stubs.c | 61 
> -
>  5 files changed, 5 insertions(+), 109 deletions(-)
>  delete mode 100644 libpager/no-senders.c
>  delete mode 100644 libpager/notify-stubs.c
> 
> diff --git a/libpager/Makefile b/libpager/Makefile
> index 2bfd845..72b4bfd 100644
> --- a/libpager/Makefile
> +++ b/libpager/Makefile
> @@ -20,16 +20,16 @@ makemode := library
>  libname = libpager
>  SRCS = data-request.c data-return.c data-unlock.c pager-port.c \
>   inhibit-term.c lock-completed.c lock-object.c mark-error.c \
> - no-senders.c object-init.c object-terminate.c pagemap.c \
> + object-init.c object-terminate.c pagemap.c \
>   pager-create.c pager-flush.c pager-shutdown.c pager-sync.c \
>   stubs.c demuxer.c chg-compl.c pager-attr.c clean.c \
> - dropweak.c notify-stubs.c get-upi.c pager-memcpy.c pager-return.c \
> + dropweak.c get-upi.c pager-memcpy.c pager-return.c \
>   offer-page.c
>  installhdrs = pager.h
>  
>  HURDLIBS= ports
>  LDLIBS += -lpthread
> -OBJS = $(SRCS:.c=.o) memory_objectServer.o notifyServer.o
> +OBJS = $(SRCS:.c=.o) memory_objectServer.o
>  
>  MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
>  MIGCOMSFLAGS = -prefix _pager_
> diff --git a/libpager/demuxer.c b/libpager/demuxer.c
> index 57a6ccb..4dd3cd8 100644
> --- a/libpager/demuxer.c
> +++ b/libpager/demuxer.c
> @@ -22,7 +22,7 @@
>  
>  #include "priv.h"
>  #include "memory_object_S.h"
> -#include "notify_S.h"
> +#include "libports/notify_S.h"
>  #include "queue.h"
>  
>  /*
> @@ -89,7 +89,7 @@ pager_demuxer (struct requests *requests,
>  
>mig_routine_t routine;
>if (! ((routine = _pager_memory_object_server_routine (inp)) ||
> -  (routine = _pager_notify_server_routine (inp
> +  (routine = ports_notify_server_routine (inp
>  return FALSE;
>  
>  #define MASK (8u - 1u)
> diff --git a/libpager/mig-mutate.h b/libpager/mig-mutate.h
> index c4f30ce..66d37cd 100644
> --- a/libpager/mig-mutate.h
> +++ b/libpager/mig-mutate.h
> @@ -21,12 +21,3 @@
>  #define MEMORY_OBJECT_INTRAN_PAYLOAD pager_t begin_using_pager_payload
>  #define MEMORY_OBJECT_DESTRUCTOR end_using_pager (pager_t)
>  #define MEMORY_OBJECT_IMPORTS import "mig-decls.h";
> -
> -#define NOTIFY_INTRAN\
> -  port_info_t begin_using_port_info_port (mach_port_t)
> -#define NOTIFY_INTRAN_PAYLOAD\
> -  port_info_t begin_using_port_info_payload
> -#define NOTIFY_DESTRUCTOR\
> -  end_using_port_info (port_info_t)
> -#define NOTIFY_IMPORTS   \
> -  import "libports/mig-decls.h";
> diff --git a/libpager/no-senders.c b/libpager/no-senders.c
> deleted file mode 100644
> index b750101..000
> --- a/libpager/no-senders.c
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -/* Called when a nosenders notification happens
> -   Copyright (C) 1994, 1995 Free Software Foundation
> -
> -   This program is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU General Public License as
> -   published by the Free Software Foundation; either version 2, or (at
> -   your option) any later version.
> -
> -   This program is distributed in the hope that it will be useful, but
> -   WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   General Public License for more details.
> -
> -   You should have received a copy of the GNU General Public License
> -   along with this program; if not, write to the Free Software
> -   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
> -
> -
> -#include "priv.h"
> -#include 
> -#include "notify_S.h"
> -
> -error_t
> -_pager_do_mach_notify_no_senders (struct port_info *pi,
> -  mach_port_mscount_t mscount)
> -{
> -  if (!pi ||
> -  pi->class != _pager_class)
> -return EOPNOTSUPP;
> -
> -  ports_no_senders (pi, mscount);
> -
> -  return 0;
> -}
> diff --git a/libpager/notify-stubs.c b/libpager/notify-stubs.c
> deleted file mode 100644
> index 6440815..000
> --- a/libpager/notify-stubs.c
> +++ /dev/null
> @@ -1,61 +0,0 @@
> -/* 
> -   Copyright (C) 1995, 2011 Free Software Fo

Re: FOSDEM talk?

2014-12-10 Thread Thomas Schwinge
Hi!

On Thu, 13 Nov 2014 15:07:11 +0100, Román  wrote:
> > [Hurd talk in microkernel devroom at FOSDEM 2015]
> 
> I would like a hurd talk about how to contribute. For example, how to fix a 
> simple bug, create a patch... I mean the steps the developers doing when need 
> to fix a bug. Or how to prepare an environment to test and fix bugs. How 
> developers works. Something like Kroah-Hartman talk about creating your first 
> Linux kernel module.

Good idea, and here we go:
.  :-)


Grüße,
 Thomas


signature.asc
Description: PGP signature