Subject: Re: lib/35969 (ghc-6.4.2 from pkgsrc fails to compile)
To: None <ad@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: netbsd-bugs
Date: 03/13/2007 02:55:02
The following reply was made to PR lib/35969; it has been noted by GNATS.

From: yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
To: gnats-bugs@NetBSD.org
Cc: ad@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
	ad@netbsd.org
Subject: Re: lib/35969 (ghc-6.4.2 from pkgsrc fails to compile)
Date: Tue, 13 Mar 2007 11:48:54 +0900 (JST)

 >  The thread is not sleeping and is not on a sleep queue, yet it's parked.
 >  pt_sleepq indicates that it was last waiting on the the CV from the
 >  stack trace. From the CV above, the mutex pointer is NULL meaning that
 >  a wake up has occurred - no more waiters on the CV so the mutex pointer
 >  has been cleared. So there is some synchronization failure occurring
 >  between removing the LWP from its sleep queue and unparking it.
 
 i guess _lwp_park is being restarted.
 
 YAMAMOTO Takashi
 
 Index: sys_lwp.c
 ===================================================================
 RCS file: /cvsroot/src/sys/kern/sys_lwp.c,v
 retrieving revision 1.12
 diff -u -p -r1.12 sys_lwp.c
 --- sys_lwp.c	9 Mar 2007 05:00:26 -0000	1.12
 +++ sys_lwp.c	13 Mar 2007 01:56:19 -0000
 @@ -508,7 +508,18 @@ sys__lwp_park(struct lwp *l, void *v, re
  	sleepq_block(sq, sched_kpri(l), wchan, "parked", timo, 1,
  	    &lwp_park_sobj);
  	error = sleepq_unblock(timo, 1);
 -	return error == EWOULDBLOCK ? ETIMEDOUT : error;
 +	switch (error) {
 +		case EWOULDBLOCK:
 +			error = ETIMEDOUT;
 +			break;
 +		case ERESTART:
 +			error = EINTR;
 +			break;
 +		default:
 +			/* nothing */
 +			break;
 +	}
 +	return error;
  }
  
  int