From owner-freebsd-threads@FreeBSD.ORG Wed Nov 26 22:40:21 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 9669E16A4CE for ; Wed, 26 Nov 2003 22:40:21 -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 1815943FDD for ; Wed, 26 Nov 2003 22:40:20 -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 hAR6eJEG047575; Wed, 26 Nov 2003 22:40:19 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) hAR6eJWx012892; Wed, 26 Nov 2003 22:40:19 -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 hAR6eJIB012891; Wed, 26 Nov 2003 22:40:19 -0800 (PST) (envelope-from marcel) Date: Wed, 26 Nov 2003 22:40:19 -0800 From: Marcel Moolenaar To: Daniel Eischen Message-ID: <20031127064019.GA12853@dhcp01.pn.xcllnt.net> References: <20031127055545.GB12712@dhcp01.pn.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i cc: threads@freebsd.org Subject: Re: KSE/ia64 & thr_spinlock.c:1.18: problem identified 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, 27 Nov 2003 06:40:21 -0000 On Thu, Nov 27, 2003 at 01:22:30AM -0500, Daniel Eischen wrote: > On Wed, 26 Nov 2003, Marcel Moolenaar wrote: > > > Ok, > > > > I found what the problem is. Syscalls that got interrupted were not > > restarted when they should be. This is the result of using the KSE > > internal context functions, when we should be going through the > > kernel. So, the end result is that we do in fact need a syscall to > > switch KSE contexts. Attached a patch to add such syscall. Please > > review (ia64 specific changes to make use of the syscall are not > > included). > > We don't need this for x86 or amd64, at least AFAICT, correct? Correct. There's no difference between a synchronous context and an asynchronous context. The context that the kernel creates for syscalls either point to the interrupt instruction or immediately after it. In all cases, the way you enter the kernel is the same. On ia64 we use the normal call/return mechanism to enter the kernel for syscalls. Restarting a syscall is therefore slightly more complex. Enter kse_switchin(). > How does a context get marked so one knows that you need to use > kse_switchin()? I currently mark it as synchronous with valid scratch registers. Userland contexts are synchronous, but don't have valid scratch registers. I plan rename flags after the dust has settled to make it more explicit. > BTW, why do we have to go through the kernel for ia64 in this > case? Only the kernel can restart a syscall because the arguments can get clobbered (and are). Also, since we're using a call/return machanism, there's no safe way to construct a context that calls the kernel again. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net