Date: Tue, 18 Sep 2001 21:29:28 -0700 From: Peter Wemm <peter@wemm.org> To: John Baldwin <jhb@FreeBSD.ORG> Cc: hackers@FreeBSD.ORG Subject: Re: JKH Project: x86: pcb_ext Message-ID: <20010919042928.F229F380A@overcee.netplex.com.au> In-Reply-To: <XFMail.010918150213.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote: > Here's a Junior Kernel Hacker project for someone: > > - Move pcb_ext and pcb_ldt out of the pcb of struct thread and into > struct mdproc; I.e., you probably want to do something like this: > - Rename struct pcb_ext to struct proc_tss and struct pcb_ldt to > struct proc_ldt. (Fixup pcb_ext member names to use a tss_ > prefix instead of ext_) > - Have a struct mdproc as so: > > struct mdproc { > struct proc_tss *md_tss; > struct proc_ldt *md_ldt; > } > > Prior to KSE this was just annoyance but wasn't an actual problem. With KSE > threads are temporary, whereas the ldt and tss are per-process properties > that need to stick around. Just so that somebody doesn't get a nasty suprise.. this is not as simple as it sounds.. There are several configurations of "extended" pcb, including having a seperate i386tss.. The nasty part is that some of this is per-thread because there is a per-thread kernel stack pointer embedded in it. The upshot of this is that there probably needs to be a "master" pcb extension that gets propagated to thread children. In particular, look at these fragmets of swtch.s: movl PCB_EXT(%edx), %edi /* new tss descriptor */ [..] movl %edx, PCPU(COMMON_TSS) + TSS_ESP0 /* stack is below pcb */ [..] movl PCPU(TSS_GDT), %ebx /* entry in GDT */ movl 0(%edi), %eax movl %eax, 0(%ebx) movl 4(%edi), %eax movl %eax, 4(%ebx) movl $GPROC0_SEL*8, %esi /* GSEL(entry, SEL_KPL) */ ltr %si I think this is actually broken right now since the tss_esp0 is pointing to the wrong location.. It's actually pointing to an unmapped page. And note how we install the per-thread tss extension pointer into the per-cpu tss slot in the gdt. And, sys_machdep.c: ext->ext_tss.tss_esp0 = td->td_kstack + ctob(KSTACK_PAGES) - sizeof(struct pcb) - 16; We cannot entirely move the extended tss into into a mdproc since td_kstack is different in each thread. The more I think about it, the right place may be the kse, since that outlives the threads and is per-cpu unlike the process. Or, we just say "no pcb extensions for kse processes". Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010919042928.F229F380A>