Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Nov 2003 02:32:24 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Daniel Eischen <eischen@vigrid.com>
Cc:        threads@freebsd.org
Subject:   Re: KSE/ia64 broken
Message-ID:  <20031120103224.GB10417@dhcp01.pn.xcllnt.net>
In-Reply-To: <Pine.GSO.4.10.10311191627050.15552-100000@pcnet5.pcnet.com>
References:  <20031117014620.GB61716@dhcp01.pn.xcllnt.net> <Pine.GSO.4.10.10311191627050.15552-100000@pcnet5.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Nov 19, 2003 at 04:27:51PM -0500, Daniel Eischen wrote:
> On Sun, 16 Nov 2003, Marcel Moolenaar wrote:
> 
> > The memory block is clobbered by a ucontext_t. This may be the result
> > of the kernel doing the upcall (though indirectly I would suspect).
> 
> Any more on this.  I haven't been able to find anything
> on our end.

Another piece of the puzzle. If you apply the attached patch, KSE
works with rev 1.18 of thr_spinlock.c. I have to analyze how this
makes a difference, but my first guess is that the syscall results
in an upcall and a context switch (be it to the same thread). This
sanitizes internal state and prevents corruption. More tomorrow...

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kse.diff"

Index: pthread_md.h
===================================================================
RCS file: /home/ncvs/src/lib/libpthread/arch/ia64/include/pthread_md.h,v
retrieving revision 1.11
diff -u -r1.11 pthread_md.h
--- pthread_md.h	19 Sep 2003 23:28:13 -0000	1.11
+++ pthread_md.h	20 Nov 2003 10:07:37 -0000
@@ -35,7 +35,10 @@
 
 #define	KSE_STACKSIZE		16384
 
-#define	THR_GETCONTEXT(ucp)	_ia64_save_context(&(ucp)->uc_mcontext)
+#define	THR_GETCONTEXT(ucp)	do {				\
+		__sys_write(1, "X\n", 2);			\
+		_ia64_save_context(&(ucp)->uc_mcontext);	\
+	} while (0)
 #define	THR_SETCONTEXT(ucp)	PANIC("THR_SETCONTEXT() now in use!\n")
 
 #define	PER_THREAD

--fUYQa+Pmc3FrFX/N--



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