From owner-freebsd-threads@FreeBSD.ORG Mon May 5 19:14:18 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 DF94937B401; Mon, 5 May 2003 19:14:18 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64B6F43F85; Mon, 5 May 2003 19:14:18 -0700 (PDT) (envelope-from davidxu@freebsd.org) Received: from davidw2k (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with SMTP id h462EFUp031675; Mon, 5 May 2003 19:14:16 -0700 (PDT) (envelope-from davidxu@freebsd.org) Message-ID: <019f01c31375$7dcec4b0$f001a8c0@davidw2k> From: "David Xu" To: "Daniel Eischen" , "Julian Elischer" References: Date: Tue, 6 May 2003 10:16:20 +0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 cc: threads@freebsd.org 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 02:14:19 -0000 ----- Original Message -----=20 From: "Daniel Eischen" To: "Julian Elischer" Cc: Sent: Tuesday, May 06, 2003 8:49 AM Subject: Re: kern_threads.c.. upcall question.. > On Mon, 5 May 2003, Julian Elischer wrote: > > On Mon, 5 May 2003, Daniel Eischen wrote: > >=20 > > > On Mon, 5 May 2003, Julian Elischer wrote: > > >=20 > > > >=20 > > > > In kern_threads.c, in function thread_export_context() > > > > it first does a copyin() of the > > > > context storage area. I think this is un-needed (and a complete = waste of > > > > cycles) but I am not sure if there is some strange condition > > > > regarding floating point registers or something that may want = this.. > > > >=20 > > > > Dan, Jon, David? > > > > do any of you have a good reason why I shouldn't remove the = copyin().?? > > >=20 > > > Yeah, the threads library keeps the thread's active signal > > > mask in the context area. The stack and flags may also > > > be used in the context. > > >=20 > > > You should be able to safely copy out the mcontext without > > > a copyin(). Is that what you're currently doing? Or is > > > the entire context (ucontext) being exported? > >=20 > > it does: > >=20 > > *) copyin the ucontext_t > >=20 > > *) load context into it using thread_getcontext() which uses > > get_mcontext() and adds the kernel thread sigmask (this must have > > been added by jeff in some way) (note it doesn't OR, just writes) >=20 > Eek. That could cause problems for libpthread. We > don't want the kernel thread signal mask being copied > to the exported context. >=20 > > *) copyout of the ucontext_t > >=20 > > The ucontext is: > >=20 > > sigset_t uc_sigmask; <-- gets over-written (!) > > mcontext_t uc_mcontext; <-- gets over-written > > struct __ucontext *uc_link; <-- one in userland MAY be > > valuable > > stack_t uc_stack; <-- probably worth saving.. > > int uc_flags; <-- probably worth saving > > int __spare__[4]; > >=20 > >=20 > >=20 > >=20 > > It seems to me that just copying out the sigset_t and mcontext_t > > may be all that is needed. (and I'm not so sure about the sigset_t > > at that.. >=20 > Yes, please don't copyout the sigset. >=20 > --=20 > Dan Eischen Yes, I think only copying out mcontext is enough, we needn't copying in. David Xu