From owner-freebsd-threads@FreeBSD.ORG Thu Jul 24 16:07:59 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 04ADE37B401; Thu, 24 Jul 2003 16:07:59 -0700 (PDT) Received: from sledge.freebsd.org (sledge.freebsd.org [216.136.204.103]) by mx1.FreeBSD.org (Postfix) with ESMTP id 798EC43F3F; Thu, 24 Jul 2003 16:07:58 -0700 (PDT) (envelope-from davidxu@freebsd.org) Received: from tiger (localhost [127.0.0.1]) by sledge.freebsd.org (8.12.9/8.12.9) with SMTP id h6ON7uv8034293; Thu, 24 Jul 2003 16:07:57 -0700 (PDT) (envelope-from davidxu@freebsd.org) Message-ID: <005701c35238$dc713a00$0701a8c0@tiger> From: "David Xu" To: "Julian Elischer" References: Date: Fri, 25 Jul 2003 07:11:04 +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 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 cc: deischen@freebsd.org cc: threads@freebsd.org cc: marcel@xcllnt.net Subject: Re: KSD/TSD take 2 (was: KSE critical regions) 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, 24 Jul 2003 23:07:59 -0000 ----- Original Message -----=20 From: "Julian Elischer" To: "David Xu" Cc: ; ; Sent: Friday, July 25, 2003 6:34 AM Subject: Re: KSD/TSD take 2 (was: KSE critical regions) >=20 >=20 > On Fri, 25 Jul 2003, David Xu wrote: >=20 > >=20 > > ----- Original Message -----=20 > > From: "Julian Elischer" > > To: > > Cc: ; "David Xu" ; = > > Sent: Friday, July 25, 2003 4:59 AM > > Subject: Re: KSD/TSD take 2 (was: KSE critical regions) > > to the kernel. > > >=20 > > > In the i386 case, (and only the i386 case (unless the amd-64 case = is the > > > same)) the KSE MAILBOX is what we are pointing %gs:0 at, and in = that > > > case, the pointer to the TCB (not the thread mailbox) is stored = there. > > > (and set there by the UTS when scheduling a thread). > > >=20 > > > Thus the struct kse_mailbox would have: > > >=20 > > > struct kse_mailbox {=20 > > > #ifdef __i386__ > > > void *TLS_tcb; /* current TCB for = TLS */ > > > #endif > > > 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 */ > > > [...] > > >=20 > >=20 > > userland can always adapt the layout by: > >=20 > > struct lib_kse_mailbox { > > void *TLS_tcb; > > struct kse_mailbox kmbx; > > }; > >=20 > > and set base address to lib_kse_mailbox, userland can > > do whatever it wants to do. same thing can be done for > > thread mailbox. > >=20 > > I don't think too many fields not related to interaction > > between kernel and userland should be pushed into mailbox, > > it is too ugly. >=20 > I was hoping to optimise by making the kse_create(mboxaddr) > call allocate the LDT entry and set the gs register to point to the=20 > mailbox. making the two things differnt makes it less likely that > making that optimisation makes sense. >=20 Dan has two fields in kse_mailbox: void *km_ksdaddr; /* KSE specific data address */ uint32_t km_ksdsize; /* KSE specific data size */ I think it is used to tell kernel to map start address=20 of libkse's kse mailbox like above lib_kse_mailbox. > presently it requires special code to do the segments.. > (in teh library) >=20 >=20 Did you make some progresses in this area ?