From: "Kevin D. Kissell" <kevink@mips.com>
To: "Daniel Jacobowitz" <dan@debian.org>, "H . J . Lu" <hjl@lucon.org>
Cc: "Ulrich Drepper" <drepper@redhat.com>,
"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
"Machida Hiroyuki" <machida@sm.sony.co.jp>,
"GNU C Library" <libc-alpha@sources.redhat.com>,
<linux-mips@oss.sgi.com>
Subject: Re: thread-ready ABIs
Date: Mon, 21 Jan 2002 22:04:47 +0100 [thread overview]
Message-ID: <012501c1a2bf$4c832180$0deca8c0@Ulysses> (raw)
In-Reply-To: 20020121135910.A26790@nevyn.them.org
From: "Daniel Jacobowitz" <dan@debian.org>
> On Mon, Jan 21, 2002 at 10:52:53AM -0800, H . J . Lu wrote:
> > On Mon, Jan 21, 2002 at 10:36:26AM -0800, Ulrich Drepper wrote:
> > > "H . J . Lu" <hjl@lucon.org> writes:
> > >
> > > > Ulrich, should applciations have access to thread register directly?
> > >
> > > It doesn't matter. The value isn't changed in the lifetime of a
> > > thread. So the overhead of a syscall wouldn't be too much. And
> > > protection against programs overwriting the register isn't necessary.
> > > It's the program's fault if that happens.
> >
> > Thq question is if we should reserve $23 outside of glibc. $23 is
> > a saved register in the MIPS ABI. It doesn't change across function
> > calls. If applications outside of glibc don't need to access the
> > thread register directly, that means $23 can be used as a saved
> > register. We don't have to change anything when compiling applications.
> > We only need to compile glibc with $23 reserved as the thread register.
>
> That's not right. If it is call-saved in the application, that means
> the application can use it. Main may have to restore it before it
> returns to __libc_start_main, but that doesn't do you any good.
>
> It doesn't change across function calls, but it does change inside
> function calls.
You are quite correct, and you have stated the problem very
succinctly. We cannot, as I had hoped, simply superimpose
a thread pointer on a static register and keep it otherwise
invisible to the code generator. So it's not the "easy way
out".
That does not necessarily mean that it's the wrong
solution. As Maciej has pointed out, from the standpoint
of performance, making the kernel do gymnastics to
preserve or set up a "k" register on each trap may
well be worse for overall performance than having
one fewer "s" register. Stealing the "s" register
would involve a change to the ABI and the compiler,
but would make it invisible to the kernel. Using
(or abusing) a "k" register would techncially also
require a change to the ABI (though one that would
be more perfectly backward compatible), a smaller
perturbation of the compiler (thread pointer stuff
gets added, but the s-register compliment is unchanged),
and a kernel hack that may or may not conflict with
other people's work (e.g. Sony). I've been kicking this
around with my colleagues at MIPS, and as I say,
I hope to be back with a semi-official recommendation
shortly. Meanwhile, I'm very interested in other's views
of the pros, cons, and alternatives.
Regards,
Kevin K.
WARNING: multiple messages have this Message-ID (diff)
From: "Kevin D. Kissell" <kevink@mips.com>
To: Daniel Jacobowitz <dan@debian.org>, "H . J . Lu" <hjl@lucon.org>
Cc: Ulrich Drepper <drepper@redhat.com>,
"Maciej W. Rozycki" <macro@ds2.pg.gda.pl>,
Machida Hiroyuki <machida@sm.sony.co.jp>,
GNU C Library <libc-alpha@sources.redhat.com>,
linux-mips@oss.sgi.com
Subject: Re: thread-ready ABIs
Date: Mon, 21 Jan 2002 22:04:47 +0100 [thread overview]
Message-ID: <012501c1a2bf$4c832180$0deca8c0@Ulysses> (raw)
Message-ID: <20020121210447.tAOmpFVyahHGKiaEHDD7ZZXxV66dnGKwKqT_hTRxSWU@z> (raw)
In-Reply-To: 20020121135910.A26790@nevyn.them.org
From: "Daniel Jacobowitz" <dan@debian.org>
> On Mon, Jan 21, 2002 at 10:52:53AM -0800, H . J . Lu wrote:
> > On Mon, Jan 21, 2002 at 10:36:26AM -0800, Ulrich Drepper wrote:
> > > "H . J . Lu" <hjl@lucon.org> writes:
> > >
> > > > Ulrich, should applciations have access to thread register directly?
> > >
> > > It doesn't matter. The value isn't changed in the lifetime of a
> > > thread. So the overhead of a syscall wouldn't be too much. And
> > > protection against programs overwriting the register isn't necessary.
> > > It's the program's fault if that happens.
> >
> > Thq question is if we should reserve $23 outside of glibc. $23 is
> > a saved register in the MIPS ABI. It doesn't change across function
> > calls. If applications outside of glibc don't need to access the
> > thread register directly, that means $23 can be used as a saved
> > register. We don't have to change anything when compiling applications.
> > We only need to compile glibc with $23 reserved as the thread register.
>
> That's not right. If it is call-saved in the application, that means
> the application can use it. Main may have to restore it before it
> returns to __libc_start_main, but that doesn't do you any good.
>
> It doesn't change across function calls, but it does change inside
> function calls.
You are quite correct, and you have stated the problem very
succinctly. We cannot, as I had hoped, simply superimpose
a thread pointer on a static register and keep it otherwise
invisible to the code generator. So it's not the "easy way
out".
That does not necessarily mean that it's the wrong
solution. As Maciej has pointed out, from the standpoint
of performance, making the kernel do gymnastics to
preserve or set up a "k" register on each trap may
well be worse for overall performance than having
one fewer "s" register. Stealing the "s" register
would involve a change to the ABI and the compiler,
but would make it invisible to the kernel. Using
(or abusing) a "k" register would techncially also
require a change to the ABI (though one that would
be more perfectly backward compatible), a smaller
perturbation of the compiler (thread pointer stuff
gets added, but the s-register compliment is unchanged),
and a kernel hack that may or may not conflict with
other people's work (e.g. Sony). I've been kicking this
around with my colleagues at MIPS, and as I say,
I hope to be back with a semi-official recommendation
shortly. Meanwhile, I'm very interested in other's views
of the pros, cons, and alternatives.
Regards,
Kevin K.
next prev parent reply other threads:[~2002-01-21 22:04 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m3elkoa5dw.fsf@myware.mynet>
2002-01-18 18:19 ` thread-ready ABIs H . J . Lu
2002-01-18 18:31 ` Ulrich Drepper
2002-01-18 19:08 ` H . J . Lu
2002-01-18 19:20 ` Ulrich Drepper
2002-01-19 12:14 ` Dominic Sweetman
2002-01-19 12:14 ` Dominic Sweetman
2002-01-20 0:14 ` Ralf Baechle
2002-01-18 20:03 ` Maciej W. Rozycki
2002-01-18 20:20 ` Ulrich Drepper
2002-01-18 20:50 ` Maciej W. Rozycki
2002-01-18 21:02 ` Ulrich Drepper
2002-01-18 21:35 ` Maciej W. Rozycki
2002-01-18 21:44 ` Ulrich Drepper
2002-01-18 22:17 ` Maciej W. Rozycki
2002-01-18 21:23 ` Daniel Jacobowitz
2002-01-19 0:35 ` Kevin D. Kissell
2002-01-19 0:35 ` Kevin D. Kissell
2002-01-19 4:11 ` H . J . Lu
2002-01-19 12:27 ` Dominic Sweetman
2002-01-19 19:42 ` H . J . Lu
2002-01-21 13:27 ` Maciej W. Rozycki
2002-01-19 22:21 ` Kevin D. Kissell
2002-01-19 22:21 ` Kevin D. Kissell
2002-01-20 10:38 ` Machida Hiroyuki
2002-01-20 11:58 ` Kevin D. Kissell
2002-01-20 11:58 ` Kevin D. Kissell
2002-01-20 13:16 ` Machida Hiroyuki
2002-01-22 6:27 ` patches for test-and-set without ll/sc (Re: thread-ready ABIs) Machida Hiroyuki
2002-01-22 6:37 ` Ulrich Drepper
2002-01-22 6:46 ` Machida Hiroyuki
2002-01-22 6:56 ` Ulrich Drepper
2002-01-24 9:56 ` Andreas Jaeger
2002-01-24 9:56 ` Andreas Jaeger
2002-01-20 19:19 ` thread-ready ABIs H . J . Lu
2002-01-21 9:39 ` Kevin D. Kissell
2002-01-21 9:39 ` Kevin D. Kissell
2002-01-21 13:56 ` Maciej W. Rozycki
2002-01-21 18:24 ` H . J . Lu
2002-01-21 18:36 ` Ulrich Drepper
2002-01-21 18:52 ` H . J . Lu
2002-01-21 18:58 ` H . J . Lu
2002-01-21 18:59 ` Daniel Jacobowitz
2002-01-21 19:05 ` H . J . Lu
2002-01-21 19:09 ` Daniel Jacobowitz
2002-01-21 19:18 ` H . J . Lu
2002-01-21 21:04 ` Kevin D. Kissell [this message]
2002-01-21 21:04 ` Kevin D. Kissell
2002-01-21 19:30 ` Geoff Keating
2002-01-21 21:07 ` Ulrich Drepper
2002-01-21 13:43 ` Maciej W. Rozycki
2002-01-20 0:24 ` Ralf Baechle
2002-01-21 23:22 ` Ulrich Drepper
2002-01-21 23:57 ` Kevin D. Kissell
2002-01-21 23:57 ` Kevin D. Kissell
2002-01-22 0:16 ` Ulrich Drepper
2002-01-22 0:16 ` Ulrich Drepper
2002-01-22 9:37 ` Dominic Sweetman
2002-01-22 9:37 ` Dominic Sweetman
2002-01-22 17:41 ` Ulrich Drepper
2002-01-22 17:41 ` Ulrich Drepper
2002-01-22 9:59 ` Dominic Sweetman
2002-01-22 9:59 ` Dominic Sweetman
2002-01-22 12:18 ` Kevin D. Kissell
2002-01-22 12:18 ` Kevin D. Kissell
2002-01-22 15:21 ` Daniel Jacobowitz
2002-01-22 15:44 ` Dominic Sweetman
2002-01-22 21:44 ` Tommy S. Christensen
2002-01-22 21:53 ` Kevin D. Kissell
2002-01-22 21:53 ` Kevin D. Kissell
2002-01-22 23:13 ` Kevin D. Kissell
2002-01-22 23:13 ` Kevin D. Kissell
2002-01-23 1:12 ` Jason Gunthorpe
2002-01-22 16:05 ` Kevin D. Kissell
2002-01-22 16:05 ` Kevin D. Kissell
2002-01-22 16:34 ` Daniel Jacobowitz
2002-01-22 17:08 ` Kevin D. Kissell
2002-01-22 17:08 ` Kevin D. Kissell
2002-01-22 17:13 ` Daniel Jacobowitz
2002-01-22 17:34 ` Kevin D. Kissell
2002-01-22 17:34 ` Kevin D. Kissell
2002-01-22 17:37 ` Daniel Jacobowitz
2002-01-22 17:47 ` Kevin D. Kissell
2002-01-22 17:47 ` Kevin D. Kissell
2002-01-22 17:57 ` Daniel Jacobowitz
2002-01-22 18:18 ` Kevin D. Kissell
2002-01-22 18:18 ` Kevin D. Kissell
2002-01-27 20:24 ` Alan Cox
2002-01-27 20:24 ` Alan Cox
2002-01-28 8:50 ` Kevin D. Kissell
2002-01-28 8:50 ` Kevin D. Kissell
2002-01-22 1:39 ` Richard Henderson
2002-01-18 21:24 Justin Carlson
2002-01-18 21:31 ` Ulrich Drepper
2002-01-18 21:42 ` Maciej W. Rozycki
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='012501c1a2bf$4c832180$0deca8c0@Ulysses' \
--to=kevink@mips.com \
--cc=dan@debian.org \
--cc=drepper@redhat.com \
--cc=hjl@lucon.org \
--cc=libc-alpha@sources.redhat.com \
--cc=linux-mips@oss.sgi.com \
--cc=machida@sm.sony.co.jp \
--cc=macro@ds2.pg.gda.pl \
/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