public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>, Andi Kleen <ak@suse.de>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Zachary Amsden <zach@vmware.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk>
Subject: Re: Assignment of GDT entries
Date: Wed, 13 Sep 2006 14:47:36 -0700	[thread overview]
Message-ID: <45087C78.20308@goop.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0609131358090.4388@g5.osdl.org>

Linus Torvalds wrote:
> These _used_ to be the "user CS/DS" respectively, but that got changed 
> around by me when did the "sysenter" support.
>   

So does this mean that moving the user-visible cs/ds isn't likely to 
break stuff, if it has been done before?

> The sysenter logic (or, more properly, the sysexit one) requires that the 
> user code segment number is the same as the kernel code segment +2 (ie 
> "+16" in actual selector term). And the user data segment needs to be +3.
>   

Yep, I'm aware of that constraint.

> And segment #8 (ie 0x40) is special (TLS segment #3), of course. 
> Anybody who wants to emulate windows or use the BIOS needs to use that for 
> their "common BIOS area" thing, iirc.
>   

Do you mean that something like dosemu/Wine needs to be able to use GDT 
#8?  Or is it only used in kernel code?

> See above. The kernel and user segments have to be moved as a block of 
> four, and obviously we'd like to keep them in the same cacheline too. 
> Also, the cacheline that contains segment #8/0x40 is not available,

Why's that?  That cacheline (assuming 64 byte line size) already 
contains the user/kernel/cs/ds descriptors.

I'm thinking of putting together a patch to change the descriptor use to:

    8  - TLS #1
    9  - TLS #2
    10 - TLS #3
    11 - Kernel PDA
    12 - Kernel CS
    13 - Kernel DS
    14 - User CS
    15 - User DS
      

This has the advantage of leaving the user cs/ds unchanged.  From what 
people had said so far, this should be OK, other than making the heavily 
used TLS #1 share the BIOS common area entry number.  If this needs to 
be usable by userspace for something special, then making it TLS #1 
won't fly...

Alternatively, maybe:

    0  - NULL
    1  - Kernel PDA
    2  - Kernel CS
    3  - Kernel DS
    4  - User CS
    5  - User DS
    6  - TLS #1
    7  - TLS #2
      

which moves the user cs/ds, but avoids #8.

    J

  reply	other threads:[~2006-09-13 21:47 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
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 [this message]
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=45087C78.20308@goop.org \
    --to=jeremy@goop.org \
    --cc=Michael.Fetterman@cl.cam.ac.uk \
    --cc=ak@suse.de \
    --cc=arjan@infradead.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@osdl.org \
    --cc=zach@vmware.com \
    /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