From owner-freebsd-threads@FreeBSD.ORG Sun Apr 6 21:53:01 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4DC5837B401; Sun, 6 Apr 2003 21:53:01 -0700 (PDT) Received: from k6.locore.ca (k6.locore.ca [198.96.117.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4432A43FA3; Sun, 6 Apr 2003 21:53:00 -0700 (PDT) (envelope-from jake@k6.locore.ca) Received: from k6.locore.ca (localhost.locore.ca [127.0.0.1]) by k6.locore.ca (8.12.8/8.12.8) with ESMTP id h374r0xS073434; Mon, 7 Apr 2003 00:53:01 -0400 (EDT) (envelope-from jake@k6.locore.ca) Received: (from jake@localhost) by k6.locore.ca (8.12.8/8.12.8/Submit) id h374r07k073433; Mon, 7 Apr 2003 00:53:00 -0400 (EDT) Date: Mon, 7 Apr 2003 00:53:00 -0400 From: Jake Burkholder To: Julian Elischer Message-ID: <20030407045300.GB67830@locore.ca> References: <003b01c2fca3$95050c40$f001a8c0@davidw2k> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i cc: freebsd-threads@freebsd.org cc: core@freebsd.org cc: David Xu cc: Daniel Eischen Subject: Re: KSE signals broken by 1:1 commit. X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2003 04:53:01 -0000 Apparently, On Sun, Apr 06, 2003 at 08:22:24PM -0700, Julian Elischer said words to the effect of; > I'm going to apply to core since jeff is absent, to have permission for > us to fix it and possibly break 1:1 (*). I specifically asked him to > ensure > that this didn't happen if he committed his changes and told him it > looked as if it would. > > (*) I don't WANT to break 1:1 but we can't test it at the moment as it > core-dumps so we have no way to see if we are breaking it :-( Are any of you running an up to date kernel from after the lazy switch changes? If you create a process with multiple threads you will get a kernel panic in cpu_throw when the first one exits because thread_exit and thr_exit both clear td_proc and cpu_throw uses td_proc now. A program like this provokes it: #include void *foo(void *); int main(void) { pthread_t thread; void *ret; if (pthread_create(&thread, NULL, foo, NULL) != 0) err(1, NULL); if (pthread_join(thread, &ret) != 0) err(1, NULL); return (0); } void * foo(void *v) { printf("foo\n"); return (NULL); } This patch will allow you to run libthr apps to ensure that you don't break them: Index: kern/kern_thr.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_thr.c,v retrieving revision 1.3 diff -u -r1.3 kern_thr.c --- kern/kern_thr.c 2 Apr 2003 23:53:29 -0000 1.3 +++ kern/kern_thr.c 6 Apr 2003 23:46:49 -0000 @@ -101,7 +101,9 @@ PROC_UNLOCK(p); td->td_kse = NULL; td->td_state = TDS_INACTIVE; +#ifdef nolonger td->td_proc = NULL; +#endif td->td_ksegrp = NULL; td->td_last_kse = NULL; thread_stash(td); Index: kern/kern_thread.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v retrieving revision 1.112 diff -u -r1.112 kern_thread.c --- kern/kern_thread.c 2 Apr 2003 23:53:29 -0000 1.112 +++ kern/kern_thread.c 6 Apr 2003 23:38:59 -0000 @@ -1242,7 +1242,9 @@ PROC_UNLOCK(p); td->td_kse = NULL; td->td_state = TDS_INACTIVE; +#ifdef nolonger td->td_proc = NULL; +#endif td->td_ksegrp = NULL; td->td_last_kse = NULL; PCPU_SET(deadthread, td); I think this issue can wait 3 days until jeff gets back. Jake