From owner-freebsd-threads@FreeBSD.ORG Fri Jul 18 13:06:42 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 493B837B401 for ; Fri, 18 Jul 2003 13:06:42 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7DC2743FA3 for ; Fri, 18 Jul 2003 13:06:41 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h6IK6XAI023656; Fri, 18 Jul 2003 16:06:33 -0400 (EDT) Date: Fri, 18 Jul 2003 16:06:33 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Julian Elischer In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: Rearranging kse mailbox X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2003 20:06:42 -0000 On Fri, 18 Jul 2003, Julian Elischer wrote: > for TLS we need to ensure that the first few (actually, 1 but a couple > more can't hurt) entry in the KSE mailbox is available as a pointer to > the TLS. (on 386 at least). Marcel probablyt has more to say on the > topic. OK. We really want the version as the first field, but if it can't be that way, we'll have to move it down a tad. This also reminds me. We need to add the per-KSE storage and size to the KSE mailbox so the kernel can do the LDT allocation (for i386 and amd64). > Also, in the latest version I assume there is still a KSE mailbox for > 1:1 threads, as it'll be needed for TLS. (is there still a pair of > mailboxen for bound, NON-SA threads?) (even if not used..?) Yes, there is. Both the thread and KSE mailbox are used for bound threads. > > > > On Fri, 18 Jul 2003, Daniel Eischen wrote: > > > Before we switch from libkse to libpthread, let's take a look > > at the mailboxes and see if we want to reorder them for better > > alignment. > > > > I took a cut at it. I moved the context from the beginning > > of the thread mailbox to the end since it was the largest > > field and most likely to change (for non-i386 archs). > > > > struct kse_thr_mailbox { > > struct kse_thr_mailbox *tm_next; /* Next thread in list */ > > void *tm_udata; /* For use by the UTS */ > > uint32_t tm_flags; /* Thread flags */ > > uint32_t tm_uticks; > > uint32_t tm_sticks; > > uint32_t tm_spare2[9]; > > siginfo_t tm_syncsig; > > ucontext_t tm_context; /* User and machine context */ > > }; > > > > struct kse_mailbox { > > uint32_t km_version; /* Mailbox version */ > > uint32_t km_flags; /* KSE flags */ > > struct kse_thr_mailbox *km_curthread; /* Currently running thread */ > > struct kse_thr_mailbox *km_completed; /* Threads back from kernel */ > > sigset_t km_sigscaught; /* Caught signals */ > > kse_func_t *km_func; /* UTS function */ > > stack_t km_stack; /* UTS context */ > > void *km_udata; /* For use by the UTS */ > > struct timespec km_timeofday; /* Time of day */ > > int32_t km_quantum; /* Upcall quantum in msecs */ > > uint32_t km_spare[8]; > > }; struct kse_mailbox { void *km_spare1[4]; /* Allocated for TLS */ uint32_t km_version; /* Mailbox version */ uint32_t km_flags; /* KSE flags */ struct kse_thr_mailbox *km_curthread; /* Currently running thread */ struct kse_thr_mailbox *km_completed; /* Threads back from kernel */ sigset_t km_sigscaught; /* Caught signals */ kse_func_t *km_func; /* UTS function */ stack_t km_stack; /* UTS context */ void *km_udata; /* For use by the UTS */ struct timespec km_timeofday; /* Time of day */ void *km_ksdaddr; /* KSE specific data address */ uint32_t km_ksdsize; /* KSE specific data size */ int32_t km_quantum; /* Upcall quantum in msecs */ uint32_t km_spare[8]; }; -- Dan Eischen