Date: Tue, 6 May 2003 10:16:20 +0800 From: "David Xu" <davidxu@freebsd.org> To: "Daniel Eischen" <eischen@pcnet1.pcnet.com>, "Julian Elischer" <julian@elischer.org> Cc: threads@freebsd.org Subject: Re: kern_threads.c.. upcall question.. Message-ID: <019f01c31375$7dcec4b0$f001a8c0@davidw2k> References: <Pine.GSO.4.10.10305052046510.27321-100000@pcnet1.pcnet.com>
index | next in thread | previous in thread | raw e-mail
----- Original Message ----- From: "Daniel Eischen" <eischen@pcnet1.pcnet.com> To: "Julian Elischer" <julian@elischer.org> Cc: <threads@freebsd.org> 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: > > > > > On Mon, 5 May 2003, Julian Elischer wrote: > > > > > > > > > > > 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.. > > > > > > > > Dan, Jon, David? > > > > do any of you have a good reason why I shouldn't remove the copyin().?? > > > > > > 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. > > > > > > 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? > > > > it does: > > > > *) copyin the ucontext_t > > > > *) 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) > > Eek. That could cause problems for libpthread. We > don't want the kernel thread signal mask being copied > to the exported context. > > > *) copyout of the ucontext_t > > > > The ucontext is: > > > > 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]; > > > > > > > > > > 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.. > > Yes, please don't copyout the sigset. > > -- > Dan Eischen Yes, I think only copying out mcontext is enough, we needn't copying in. David Xuhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?019f01c31375$7dcec4b0$f001a8c0>
