Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Apr 2003 00:53:00 -0400
From:      Jake Burkholder <jake@locore.ca>
To:        Julian Elischer <julian@elischer.org>
Cc:        Daniel Eischen <eischen@pcnet1.pcnet.com>
Subject:   Re: KSE signals broken by 1:1 commit.
Message-ID:  <20030407045300.GB67830@locore.ca>
In-Reply-To: <Pine.BSF.4.21.0304062017540.55025-100000@InterJet.elischer.org>
References:  <003b01c2fca3$95050c40$f001a8c0@davidw2k> <Pine.BSF.4.21.0304062017540.55025-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <pthread.h>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030407045300.GB67830>