On Sun, Jan 23, 2011 at 09:04:46PM +0100, Stefan Sperling wrote:
> With this patch to libpthread, an OpenBSD guest in a qemu run with
> pthreads (not rthreads) has finished a cvs checkout and a kernel build.
> I'm starting a make build on it now.

The qemu instance run with this patch has finished make build and
also a xenocara build successfully.
There were a handful (less than 10) disk i/o soft errors:
  wd0f: device timeout writing fsbn 2096704 of 2096704-2096735 (wd0 bn 8209472; 
cn
   511 tn 4 sn 5), retrying
  wd0: soft error (corrected)
  wd0(pciide0:0:0): timeout
These were probably due to signals sent from qemu's i/o thread to 
the main thread being queued for a while. There were 2 additional
qemu instances running in parallel doing heavy i/o so the host system
was under heavy load the whole time.

The soft i/o errors didn't show in the rthreads qemu instance (which has
also finished make build + xenocara). As expected, performance of this
instance was better than with pthreads. It finished a couple of hours earlier.

For further testing and review the updated diff at
http://marc.info/?l=openbsd-ports&m=129590196005318&w=2
should be used.

> Index: uthread/pthread_private.h
> ===================================================================
> RCS file: /cvs/src/lib/libpthread/uthread/pthread_private.h,v
> retrieving revision 1.76
> diff -u -p -r1.76 pthread_private.h
> --- uthread/pthread_private.h 28 Oct 2010 15:02:41 -0000      1.76
> +++ uthread/pthread_private.h 22 Jan 2011 17:07:45 -0000
> @@ -761,7 +761,7 @@ struct pthread {
>        * Set to non-zero when this thread has deferred signals.
>        * We allow for recursive deferral.
>        */
> -     int             sig_defer_count;
> +     volatile sig_atomic_t   sig_defer_count;
>  
>       /*
>        * Set to TRUE if this thread should yield after undeferring
> Index: uthread/uthread_kern.c
> ===================================================================
> RCS file: /cvs/src/lib/libpthread/uthread/uthread_kern.c,v
> retrieving revision 1.36
> diff -u -p -r1.36 uthread_kern.c
> --- uthread/uthread_kern.c    21 May 2007 16:50:36 -0000      1.36
> +++ uthread/uthread_kern.c    23 Jan 2011 15:18:03 -0000
> @@ -440,6 +440,12 @@ _thread_kern_sched(struct sigcontext * s
>                               _queue_signals = 0;
>                       }
>  
> +                     /*
> +                      * Prevent the signal handler from fiddling with this
> +                      * thread before its state is set.
> +                      */
> +                     _queue_signals = 1;
> +
>                       /* Make the selected thread the current thread: */
>                       _set_curthread(pthread_h);
>                       curthread = pthread_h;
> @@ -481,6 +487,9 @@ _thread_kern_sched(struct sigcontext * s
>                        */
>                       curthread = _get_curthread();
>                       _thread_kern_in_sched = 0;
> +
> +                     /* Allow signals again. */
> +                     _queue_signals = 0;
>  
>                       /* run any installed switch-hooks */
>                       if ((_sched_switch_hook != NULL) &&

Reply via email to