From: Rusty Russell <rusty@rustcorp.com.au>
To: Andi Kleen <andi@firstfloor.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
"Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>,
linux-kernel@vger.kernel.org
Subject: Re: _proxy_pda still makes linking modules fail
Date: Tue, 13 Mar 2007 17:23:52 +1100 [thread overview]
Message-ID: <1173767032.10618.43.camel@localhost.localdomain> (raw)
In-Reply-To: <1173736726.10618.1.camel@localhost.localdomain>
On Tue, 2007-03-13 at 08:59 +1100, Rusty Russell wrote:
> On Mon, 2007-03-12 at 10:48 +0100, Andi Kleen wrote:
> > > Rusty's pda->per_cpu patch will deal with this once and for all; have
> >
> > Not on x86-64.
>
> Indeed. Perhaps it's time I join the modern world and compile a 64-bit
> kernel...
>
> Will prepare patches,
No, I don't think I will. The PDA concept has gone too far in x86-64 to
be undone. In particular, it's been put in GCC 4.1 for
CONFIG_CC_STACKPROTECTOR, which assumes %gs:40 will give the stack
canary.
For the record: the PDA should never have existed, that's what percpu
vars were supposed to be for. Something went wrong here 8(
%gs is best set to the offset of the local cpu's area from the "master"
per-cpu area, not set to the local cpu area's address. In the former
case, booting with %gs at offset 0 works naturally, in the latter case,
hoops need to be jumped through to make it work. See how much nicer the
x86 code is post pda->percpu conversion.
So, even if we leave the PDA and place the per-cpu area immediately
after it, we still can't use "%gs:var" to access a per-cpu variable: we
need to do a subtract, so why bother using the segment reg?
The ideal solution has always been to use __thread, but no architecture
has yet managed it (I tried for i386, and it quickly caused unbearable
pain). On x86-64 that uses "%fs" on x86-64, not "%gs" as the kernel
does, but I might try that if I feel particularly masochistic soon...
In summary, containing the PDA infection to x86-64 is possible, but
curing that patient is non-trivial 8)
Rusty.
next prev parent reply other threads:[~2007-03-13 6:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 0:57 _proxy_pda still makes linking modules fail Marcin 'Qrczak' Kowalczyk
2007-03-10 15:03 ` Adrian Bunk
2007-03-11 14:06 ` Marcin 'Qrczak' Kowalczyk
2007-03-12 1:19 ` Andi Kleen
2007-03-12 0:25 ` Jeremy Fitzhardinge
2007-03-12 9:48 ` Andi Kleen
2007-03-12 14:45 ` Jeremy Fitzhardinge
2007-03-12 15:45 ` Andi Kleen
2007-03-12 21:58 ` Rusty Russell
2007-03-13 6:23 ` Rusty Russell [this message]
2007-03-13 9:04 ` Paul Mackerras
2007-03-13 15:31 ` Jeremy Fitzhardinge
2007-03-13 23:50 ` Paul Mackerras
2007-03-14 1:12 ` Rusty Russell
2007-03-13 15:57 ` Andi Kleen
2007-03-14 2:17 ` Rusty Russell
2007-03-12 18:47 ` Marcin 'Qrczak' Kowalczyk
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=1173767032.10618.43.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=andi@firstfloor.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qrczak@knm.org.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