Subject: Re: kern/30689 exit_lwps: lwp_wait1 failed with error 11
To: Anil Gopinath <anil_public@yahoo.com>
From: Rui Paulo <rpaulo@NetBSD.org>
List: tech-kern
Date: 08/09/2005 04:14:07
On 2005.08.09 04:12:44 +0000, Rui Paulo wrote:
| On 2005.08.08 20:03:29 +0000, Anil Gopinath wrote:
| | 
| | Is it possible to safely recover and not panic if
| | lwp_wait1() returned error 11?
| 
| I don't think so, because:
| 
| int
| lwp_wait1(struct lwp *l, lwpid_t lid, lwpid_t *departed, int flags)
| {
| 	...
|         if (lid == l->l_lid)
|                 return (EDEADLK); /* Waiting for ourselves makes no sense. */
| 	...
| }
| 
| EDEADLK is error number 11.

Also:
	...
                } else if (l2->l_stat == LSSLEEP ||
                           l2->l_stat == LSSUSPENDED) {
                        /* Deadlock checks.
                         * 1. If all other LWPs are waiting for exits
                         *    or suspended, we would deadlock.
                         */

                        LIST_FOREACH(l3, &p->p_lwps, l_sibling) {
                                if (l3 != l && (l3->l_stat != LSSUSPENDED) &&
                                    !(l3->l_stat == LSSLEEP &&
                                        l3->l_wchan == (caddr_t) &p->p_nlwps))
                                        break;
                        } 
                        if (l3 == NULL) /* Everyone else is waiting. */
                                return (EDEADLK);
	...

		-- Rui Paulo