From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [musl] Re: Thread pointer changes
Date: Sat, 28 Jun 2014 00:35:05 +0100 [thread overview]
Message-ID: <20140627233505.GA32514@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CALCETrVFvYNPHMozB2E2L0LWSPv=o6JHfmoz4_pBC2gQwRLpug@mail.gmail.com>
On Fri, Jun 27, 2014 at 04:17:52PM -0700, Andy Lutomirski wrote:
> On Fri, Jun 27, 2014 at 4:07 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > The kuser helpers can NOT be removed unless the CPU is v6k+. Let me
> > put that a different way: the kuser helpers can not be removed unless
> > the ELF HWCAPs indicate TLS support.
>
> Why? (This is an honest question -- there may be an excellent
> answer.) I understand why they're needed in the first place, but I
> don't understand why they need to live at a fixed address.
Just very briefly - and this will be my last reply on this until Monday,
especially so as I've spent a solid 1h30 replying to the emails in this
thread, and it's past midnight here.
I referred to the problems in an earlier reply (maybe in a different
sub-thread of this thread.)
To answer your "why" (which I'll take as "why can't they be removed")
the reason for that is the lack of TLS support. If the kuser page
is removed _and_ there is no hardware TLS support, then there is no way
for userspace to have TLS.
As for your second bit (about why they need to live at a fixed address)
we could have randomised it on v6 and later CPUs, but there are some
v6 CPUs which suffer from data cache aliasing, just like all the previous
CPUs. With the data cache aliasing, it would make the TLS implementation
a lot more complex.
As part of the TLS implementation for older CPUs, the TLS value is stored
right at the top of that page, and on every context switch, we have to
update that value. If the page was at a randomised address, the kernel
would either have to poke directly into userspace and flush it from the
caches (which is error prone - what if userspace unmaps the page) or it
has to do cache flushing to ensure that the value is visible via the
user alias of the page.
If it wasn't for this need, we would have probably gone for a VDSO from
the start.
--
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
next prev parent reply other threads:[~2014-06-27 23:35 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140610072835.GA8466@brightrain.aerifal.cx>
[not found] ` <20140611145533.GT179@brightrain.aerifal.cx>
2014-06-27 19:27 ` Thread pointer changes Andy Lutomirski
2014-06-27 20:09 ` Russell King - ARM Linux
2014-06-27 21:09 ` [musl] " Szabolcs Nagy
2014-06-27 21:30 ` Russell King - ARM Linux
2014-06-27 21:47 ` Andy Lutomirski
2014-06-27 21:58 ` Rich Felker
2014-06-27 21:55 ` Rich Felker
2014-06-27 22:17 ` Russell King - ARM Linux
2014-06-27 22:25 ` Andy Lutomirski
2014-06-27 22:54 ` Russell King - ARM Linux
2014-06-28 0:11 ` Rich Felker
2014-06-27 22:33 ` Rich Felker
2014-06-27 23:07 ` Russell King - ARM Linux
2014-06-27 23:17 ` Andy Lutomirski
2014-06-27 23:35 ` Russell King - ARM Linux [this message]
2014-06-27 23:40 ` Andy Lutomirski
2014-06-30 15:38 ` Christopher Covington
2014-07-02 21:16 ` Rich Felker
2014-06-28 0:20 ` Rich Felker
2014-06-27 22:40 ` Szabolcs Nagy
2014-06-27 22:51 ` Andy Lutomirski
2014-06-27 23:12 ` Russell King - ARM Linux
2014-06-28 16:37 ` Szabolcs Nagy
2014-06-27 21:37 ` Rich Felker
2014-06-27 22:04 ` Russell King - ARM Linux
2014-06-27 22:26 ` Rich Felker
2014-06-27 23:03 ` Russell King - ARM Linux
2014-06-28 7:09 ` u-igbb at aetey.se
2014-06-27 23:20 ` Russell King - ARM Linux
2014-06-28 0:38 ` [musl] " Rich Felker
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=20140627233505.GA32514@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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).