From: Zachary Amsden <zach@vmware.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Arjan van de Ven <arjan@infradead.org>,
Linus Torvalds <torvalds@osdl.org>, Ingo Molnar <mingo@elte.hu>,
Andi Kleen <ak@suse.de>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: Assignment of GDT entries
Date: Wed, 13 Sep 2006 13:59:07 -0700 [thread overview]
Message-ID: <4508711B.6060905@vmware.com> (raw)
In-Reply-To: <4508681E.3070708@goop.org>
Jeremy Fitzhardinge wrote:
> Arjan van de Ven wrote:
>> I don't know the exact details on these; I do know that several GDT
>> entries tend to be used by BIOSes in their APM implementations and thus
>> are better of not being used. That might be the underlying reason
>> here....
>>
>
> Hm, I see.
>
> Also, thinking about this a bit more, it would be most helpful to move
> the PDA descriptor onto the same cache line as the other descriptors
> used in the kernel - ie, somewhere in the range of 8-15 (assuming 64
> byte line size):
>
> * 8 - TLS segment #3
> * 9 - reserved
> * 10 - reserved
> * 11 - reserved
> *
> * ------- start of kernel segments:
> *
> * 12 - kernel code segment
> * 13 - kernel data segment
> * 14 - default user CS
> * 15 - default user DS
>
> This seems pretty wasteful of the GDT cache line, since the
> kernel+user cs/ds are shared a cache line with 3 reserved entries and
> the never-used TLS #3 descriptor. If it were OK to put the PDA in
> one of 9,10,11, then that would be
TLS #3 overlaps BIOS 0x40, but code which calls borken APM / PnP BIOS
and sets up protected mode 0x40 GDT segment does so by swapping out the
TLS segment with the identity simulation of physical 0x400 offset,
swapping it back afterwards. Short of bugs in that code (which there
are, btw), you shouldn't need to be concerned with it.
I believe 9,10,11 are reserved for future users like yourself or
expanded TLS segments. I think a bank of 3 TLS segments in the GDT is
working fine now (does NPTL even use more than one?).
> good. Unfortunately the next cache line is clogged up with PNP and
> APM stuff, which I presume not movable.
Totally movable, actually, just means breaking module dependencies.
>
> In fact, if we assume that "reserved" means "unusable", it looks like
> none of the GDT's cache lines can be freed up to lay out the most
> commonly used descriptors into a single cache line:
>
> line 0: NULL descriptor, 3 reserved, 2 unused, 2 TLS
> line 1: 1 TLS, 3 reserved, kernel+user code+data
> line 2: TSS, LDT, PNPBIOS, APMBIOS
> line 3: APMBIOS, ESPFIX, 4 unused, doublefault TSS
>
> Otherwise line 1 would be ideal for putting 3 TLS, kernel+user
> code+data and PDA into, thereby making 99.999% of GDT descriptor uses
> come from one cache line.
That change is visible to userspace, unfortunately.
>
> But anyway, what breaks if I put the PDA in 11?
Nothing.
Zach
next prev parent reply other threads:[~2006-09-13 20:59 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-13 18:58 Assignment of GDT entries Jeremy Fitzhardinge
2006-09-13 19:16 ` Arjan van de Ven
2006-09-13 20:00 ` Alan Cox
2006-09-13 20:02 ` Jeremy Fitzhardinge
2006-09-13 20:20 ` Jeremy Fitzhardinge
2006-09-13 20:59 ` Zachary Amsden [this message]
2006-09-13 21:15 ` Jeremy Fitzhardinge
2006-09-13 21:35 ` Alan Cox
2006-09-14 0:25 ` Zachary Amsden
2006-09-14 1:40 ` Stephen Rothwell
2006-09-14 13:03 ` Alan Cox
2006-09-13 19:55 ` linux-os (Dick Johnson)
2006-09-13 20:08 ` Jeremy Fitzhardinge
2006-09-13 20:32 ` linux-os (Dick Johnson)
2006-09-13 21:21 ` Linus Torvalds
2006-09-13 21:47 ` Jeremy Fitzhardinge
2006-09-13 22:05 ` Linus Torvalds
2006-09-13 22:22 ` Jeremy Fitzhardinge
2006-09-14 6:00 ` Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2006-09-14 3:23 Albert Cahalan
2006-09-14 6:11 ` Jeremy Fitzhardinge
2006-09-14 4:06 Albert Cahalan
2006-09-14 4:44 ` Eric W. Biederman
2006-09-14 6:19 ` Albert Cahalan
2006-09-14 6:28 ` Zachary Amsden
2006-09-14 7:12 ` Albert Cahalan
2006-09-14 7:24 ` Zachary Amsden
2006-09-14 6:29 ` Jeremy Fitzhardinge
2006-09-15 7:55 Mikael Pettersson
2006-09-15 8:20 ` Jeremy Fitzhardinge
2006-09-15 8:58 ` Mikael Pettersson
2006-09-15 18:27 ` Jeremy Fitzhardinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4508711B.6060905@vmware.com \
--to=zach@vmware.com \
--cc=Michael.Fetterman@cl.cam.ac.uk \
--cc=ak@suse.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arjan@infradead.org \
--cc=ebiederm@xmission.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox