From: "Kevin D. Kissell" <kevink@mips.com>
To: "Johannes Stezenbach" <js@convergence.de>, <linux-mips@linux-mips.org>
Subject: Re: Once again: test_and_set for CPUs w/o LL/SC
Date: Mon, 7 Oct 2002 18:21:52 +0200 [thread overview]
Message-ID: <01fd01c26e1d$add77240$10eca8c0@grendel> (raw)
In-Reply-To: 20021007144749.GB16641@convergence.de
> Hi all,
>
> On Mon, Sep 16, 2002 at 06:40:34PM +0200, I wrote:
> >
> > The NEC VR41xx CPU has no LL/SC instructions, so they must
> > be emulated by the kernel, which slows down the test-and-set
> > and compare-and-swap operations (used by linux-threads)
> > considerably. For the VR41xx (and other CPUs which have
> > branch-likely instructions), there exisits a workaround
> > which enables userspace-only atomic operations, with minor
> > help from the kernel: The kernel must guarantee that register
> > k1 is not equal to some magic value after every transition
> > to userspace.
> >
> > Two things were left open in July:
> > - find out the minimal amount of changes to the kernel
> > to guarantee k1 != MAGIC after eret
> > - determine how to tell glibc to use the branch-likely
> > workaround instead of emulated LL/SC
>
> Since there have been no follow-ups I must assume that
> this topic is no longer of interest. Is this so? Or
> is the way I approach it deemed inappropriate?
When I first proposed the branch-likely hack last winter,
I thought it might be worth while to do a through code
inspection to determine what set of values could never
be returned in k1 (or k0 for all I care) if an exception
was taken, such that there would be no mods to the
kernel required whatsoever. I spent a little time going
down that path, and it does look at first glance as if one
could guarantee that one will never come out of an exception
with k1 equal to 0xffdadaff in current oss/linux-mips cvs
sources, but the guys at Sony, who have a big interest in
this technique, given that the PS2 has no LL/SC,
prefered a more conservative approach which explicitly
clobbered the selective register on all exceptions,
even if it meant some small performance impact.
That's probably going to be a more reliable design,
though I would still consider leaving the TLB refill handler
untouched and counting on the fact that k1 must contain
a non-lethal EntryLo value on return from the exception.
As for glibc, the possibilities are numerous and I'm not
the guy who'd have to make it work.
Regards,
Kevin K.
WARNING: multiple messages have this Message-ID (diff)
From: "Kevin D. Kissell" <kevink@mips.com>
To: Johannes Stezenbach <js@convergence.de>, linux-mips@linux-mips.org
Subject: Re: Once again: test_and_set for CPUs w/o LL/SC
Date: Mon, 7 Oct 2002 18:21:52 +0200 [thread overview]
Message-ID: <01fd01c26e1d$add77240$10eca8c0@grendel> (raw)
Message-ID: <20021007162152.HRgdSJr5JXN2e-tTnSFZxexrQv0nNF_sh607ILYivSs@z> (raw)
In-Reply-To: 20021007144749.GB16641@convergence.de
> Hi all,
>
> On Mon, Sep 16, 2002 at 06:40:34PM +0200, I wrote:
> >
> > The NEC VR41xx CPU has no LL/SC instructions, so they must
> > be emulated by the kernel, which slows down the test-and-set
> > and compare-and-swap operations (used by linux-threads)
> > considerably. For the VR41xx (and other CPUs which have
> > branch-likely instructions), there exisits a workaround
> > which enables userspace-only atomic operations, with minor
> > help from the kernel: The kernel must guarantee that register
> > k1 is not equal to some magic value after every transition
> > to userspace.
> >
> > Two things were left open in July:
> > - find out the minimal amount of changes to the kernel
> > to guarantee k1 != MAGIC after eret
> > - determine how to tell glibc to use the branch-likely
> > workaround instead of emulated LL/SC
>
> Since there have been no follow-ups I must assume that
> this topic is no longer of interest. Is this so? Or
> is the way I approach it deemed inappropriate?
When I first proposed the branch-likely hack last winter,
I thought it might be worth while to do a through code
inspection to determine what set of values could never
be returned in k1 (or k0 for all I care) if an exception
was taken, such that there would be no mods to the
kernel required whatsoever. I spent a little time going
down that path, and it does look at first glance as if one
could guarantee that one will never come out of an exception
with k1 equal to 0xffdadaff in current oss/linux-mips cvs
sources, but the guys at Sony, who have a big interest in
this technique, given that the PS2 has no LL/SC,
prefered a more conservative approach which explicitly
clobbered the selective register on all exceptions,
even if it meant some small performance impact.
That's probably going to be a more reliable design,
though I would still consider leaving the TLB refill handler
untouched and counting on the fact that k1 must contain
a non-lethal EntryLo value on return from the exception.
As for glibc, the possibilities are numerous and I'm not
the guy who'd have to make it work.
Regards,
Kevin K.
next prev parent reply other threads:[~2002-10-07 16:20 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-16 16:40 Once again: test_and_set for CPUs w/o LL/SC Johannes Stezenbach
2002-10-07 14:47 ` Johannes Stezenbach
2002-10-07 16:21 ` Kevin D. Kissell [this message]
2002-10-07 16:21 ` Kevin D. Kissell
2002-10-07 18:43 ` Johannes Stezenbach
2002-10-07 18:51 ` Daniel Jacobowitz
2002-10-15 17:52 ` Johannes Stezenbach
2002-10-08 7:38 ` Kevin D. Kissell
2002-10-08 7:38 ` Kevin D. Kissell
2002-10-15 15:36 ` Maciej W. Rozycki
2002-10-15 17:21 ` Johannes Stezenbach
2002-10-16 12:20 ` Maciej W. Rozycki
2002-10-16 12:52 ` Johannes Stezenbach
2002-10-16 16:30 ` Johannes Stezenbach
2002-10-17 9:47 ` Gleb O. Raiko
2002-10-17 12:02 ` Maciej W. Rozycki
2002-10-17 13:11 ` Johannes Stezenbach
2002-10-17 13:32 ` Gleb O. Raiko
2002-10-17 14:13 ` Johannes Stezenbach
2002-10-16 18:11 ` Johannes Stezenbach
2002-10-16 18:23 ` Johannes Stezenbach
2002-10-17 11:57 ` Maciej W. Rozycki
2002-10-17 13:25 ` Johannes Stezenbach
2002-10-15 15:17 ` Maciej W. Rozycki
2002-10-15 16:50 ` Johannes Stezenbach
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='01fd01c26e1d$add77240$10eca8c0@grendel' \
--to=kevink@mips.com \
--cc=js@convergence.de \
--cc=linux-mips@linux-mips.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