From owner-freebsd-threads@FreeBSD.ORG Thu Nov 20 02:35:47 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 02D1616A4CF for ; Thu, 20 Nov 2003 02:35:47 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 32A4C43FBF for ; Thu, 20 Nov 2003 02:34:43 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id hAKAXebe079222; Thu, 20 Nov 2003 02:33:40 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) hAKAXdmK010482; Thu, 20 Nov 2003 02:33:39 -0800 (PST) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.10/8.12.10/Submit) id hAKAWO0k010463; Thu, 20 Nov 2003 02:32:24 -0800 (PST) (envelope-from marcel) Date: Thu, 20 Nov 2003 02:32:24 -0800 From: Marcel Moolenaar To: Daniel Eischen Message-ID: <20031120103224.GB10417@dhcp01.pn.xcllnt.net> References: <20031117014620.GB61716@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fUYQa+Pmc3FrFX/N" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i cc: David Xu cc: threads@freebsd.org Subject: Re: KSE/ia64 broken 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: Thu, 20 Nov 2003 10:35:47 -0000 --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--