linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Andi Kleen <ak@suse.de>, Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Better CLONE_SETTLS support for Hammer
Date: Thu, 6 Mar 2003 11:27:20 +0100	[thread overview]
Message-ID: <20030306102720.GA23747@wotan.suse.de> (raw)
In-Reply-To: <3E66CB1A.6020107@redhat.com>

On Wed, Mar 05, 2003 at 08:14:18PM -0800, Ulrich Drepper wrote:
> 
> > It should already work on the current kernel, modulo clone.
> > (but arch_prctl, set_thread_area in 2.5, ldt in 2.4 etc.)
> 
> I cannot confirm this.  I wasted a lot of time on getting it to work.
> Without avail.

We're using %fs enabled glibc (currently with arch_prctl, but I would
like to change that because it's slow) 

> And the problem is?  Nobody must mug around with the segment registers
> without knowing what s/he does.

It's hardcoding the magic fs register in the kernel for once.

> You don't need two interface.  Make prctl() do it automatically.  It has
> all the info it needs.  Forget about the set_thread_area syscall in
> 64-bit mode and simply use one fixed GDT entry in case the address
> passed to pcrtl() is small enough.  Same for clone(): the SETTLS
> parameter shole be a simple address.  Treat it as passed to prctl() and
> use a segment or the MSR.

I had some code like this for some time - not in prctl, but in set_thread_area,
but I removed it because the selector messing looked too ugly.

But that was before prctl reloaded the selector forcefully to zero.
That was later changed to fix another bug.

Now with it getting reloaded it would make sense to set it in the GDT
too if possible, I agree. I'll implement that.

It will also transparent speed up the glibcs already using arch_prctl.
I like that.

I can do a similar thing in clone. It unfortuately also hardcodes fs there,
but I guess that ugly hack will be needed to get the broken NPTL design for this
to work.

You just have to guarantee from user space that you don't do nasty
things with the selector.

> 
> - - have prctl() return the index and expect the user to load it.  This is
>   slightly binary incompatible (existing code depends on no such
>   requirement).  It could be solved by introducing ARCH_SET_FS_AUTO or
>   so;
> 
> - - automatically load the %fs or %gs register with the correct value
>   before returning from prctl().  This introduces no binary
>   incompatibilities and it's really the expected behavior.

It's already done (set to zero) to not confuse the lazy switch logic.

> 
> 
> If you don't want to do the work help me to get 2.5 running on my
> machine and I'll come up with a patch.

2.5.64 currently doesn't boot (known issue); 2.5.63 works however.
I'll look into the .64 problems later today and put a fix onto the
usual place when done (ftp://ftp.x86-64.org/pub/linux/v2.5/) 

-Andi

  reply	other threads:[~2003-03-06 10:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-05 18:55 Better CLONE_SETTLS support for Hammer Ulrich Drepper
2003-03-05 19:06 ` Andi Kleen
2003-03-05 19:25   ` Ulrich Drepper
2003-03-05 21:19     ` Andi Kleen
2003-03-05 19:32   ` Ulrich Drepper
2003-03-05 21:21     ` Andi Kleen
2003-03-05 23:04       ` Ulrich Drepper
2003-03-06  1:05         ` Andi Kleen
2003-03-06  3:53           ` Ulrich Drepper
2003-03-06  4:14           ` Ulrich Drepper
2003-03-06 10:27             ` Andi Kleen [this message]
2003-03-06 18:58               ` Ulrich Drepper
2003-03-06 19:09                 ` Andi Kleen
2003-03-06  2:08         ` Benjamin LaHaise
2003-03-06  3:52           ` Ulrich Drepper
2003-03-06  5:29             ` Benjamin LaHaise
2003-03-06  5:47               ` Ulrich Drepper
2003-03-06  5:33   ` H. Peter Anvin

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=20030306102720.GA23747@wotan.suse.de \
    --to=ak@suse.de \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).