KSD/TSD take 2 (was: KSE critical regions)
David Xu
davidxu at freebsd.org
Thu Jul 24 16:07:59 PDT 2003
----- Original Message -----
From: "Julian Elischer" <julian at elischer.org>
To: "David Xu" <davidxu at freebsd.org>
Cc: <deischen at freebsd.org>; <threads at freebsd.org>; <marcel at xcllnt.net>
Sent: Friday, July 25, 2003 6:34 AM
Subject: Re: KSD/TSD take 2 (was: KSE critical regions)
>
>
> On Fri, 25 Jul 2003, David Xu wrote:
>
> >
> > ----- Original Message -----
> > From: "Julian Elischer" <julian at elischer.org>
> > To: <deischen at freebsd.org>
> > Cc: <threads at freebsd.org>; "David Xu" <davidxu at freebsd.org>; <marcel at xcllnt.net>
> > Sent: Friday, July 25, 2003 4:59 AM
> > Subject: Re: KSD/TSD take 2 (was: KSE critical regions)
> > to the kernel.
> > >
> > > 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).
> > >
> > > Thus the struct kse_mailbox would have:
> > >
> > > struct kse_mailbox {
> > > #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 */
> > > [...]
> > >
> >
> > userland can always adapt the layout by:
> >
> > struct lib_kse_mailbox {
> > void *TLS_tcb;
> > struct kse_mailbox kmbx;
> > };
> >
> > and set base address to lib_kse_mailbox, userland can
> > do whatever it wants to do. same thing can be done for
> > thread mailbox.
> >
> > I don't think too many fields not related to interaction
> > between kernel and userland should be pushed into mailbox,
> > it is too ugly.
>
> 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
> mailbox. making the two things differnt makes it less likely that
> making that optimisation makes sense.
>
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
of libkse's kse mailbox like above lib_kse_mailbox.
> presently it requires special code to do the segments..
> (in teh library)
>
>
Did you make some progresses in this area ?
More information about the freebsd-threads
mailing list