From owner-freebsd-threads@FreeBSD.ORG Tue May 6 00:10:34 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 521C137B415; Tue, 6 May 2003 00:10:29 -0700 (PDT) Received: from rwcrmhc53.attbi.com (rwcrmhc53.attbi.com [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id E9F9343F93; Tue, 6 May 2003 00:10:25 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org (12-232-168-4.client.attbi.com[12.232.168.4]) by attbi.com (rwcrmhc53) with ESMTP id <2003050607102505300puqibe>; Tue, 6 May 2003 07:10:25 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id AAA33151; Tue, 6 May 2003 00:10:25 -0700 (PDT) Date: Tue, 6 May 2003 00:10:24 -0700 (PDT) From: Julian Elischer To: David Xu In-Reply-To: <04ec01c3139a$579093d0$f001a8c0@davidw2k> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org cc: Daniel Eischen Subject: Re: kern_threads.c.. upcall question.. 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: Tue, 06 May 2003 07:10:34 -0000 On Tue, 6 May 2003, David Xu wrote: > I think the following patch is enough: I agree that this seems enough from what I was reading. (I like patches that have most lines starting with '-' :-) > > Index: kern_thread.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v > retrieving revision 1.129 > diff -u -r1.129 kern_thread.c > --- kern_thread.c 1 May 2003 12:16:06 -0000 1.129 > +++ kern_thread.c 6 May 2003 06:32:10 -0000 > @@ -721,41 +721,6 @@ [...] > void > @@ -962,27 +927,25 @@ > uintptr_t mbx; > void *addr; > int error,temp; > - ucontext_t uc; > + mcontext_t mc; > > p = td->td_proc; > kg = td->td_ksegrp; > > /* Export the user/machine context. */ > - addr = (void *)(&td->td_mailbox->tm_context); > - error = copyin(addr, &uc, sizeof(ucontext_t)); > - if (error) > - goto bad; > - > - thread_getcontext(td, &uc); > - error = copyout(&uc, addr, sizeof(ucontext_t)); > - if (error) > + get_mcontext(td, &mc, 0); I think this could be optimised even more. (why copy the FP regs if they are not valid) (etc). but it is an improvement.. > + addr = (void *)(&td->td_mailbox->tm_context.uc_mcontext); > + error = copyout(&mc, addr, sizeof(mcontext_t)); > + if (error) > goto bad; > > /* Exports clock ticks in kernel mode */ > addr = (caddr_t)(&td->td_mailbox->tm_sticks); > temp = fuword(addr) + td->td_usticks; > - if (suword(addr, temp)) > + if (suword(addr, temp)) { > + error = EFAULT; > goto bad; > + } > > /* Get address in latest mbox of list pointer */ > addr = (void *)(&td->td_mailbox->tm_next); > > > And should we disable single threading testing or do > double checking in thread_user_enter()? I think per-syscall > PROC_LOCK is too expensive for us. I am not sure which one you refer too.. Which single_threading test? BTW, I am a little unsure about the calling of thread_user_enter() from thread_userret(). > > David Xu > > >