public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Brian Gerst <brgerst@gmail.com>,
	linux-kernel@vger.kernel.org,
	Christoph Lameter <cl@linux-foundation.org>,
	Mike Travis <travis@sgi.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Alexander van Heukelum <heukelum@mailshack.com>
Subject: Re: [PATCH 2/3] x86-64: Unify x86_*_percpu() functions.
Date: Sat, 27 Dec 2008 22:20:47 +1100	[thread overview]
Message-ID: <49560F8F.9020901@goop.org> (raw)
In-Reply-To: <20081227110909.GA15377@elte.hu>

Ingo Molnar wrote:
> * Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>   
>> Brian Gerst wrote:
>>     
>>> Merge the 32-bit and 64-bit versions of these functions.  Unlike 32-bit,
>>> the segment base is the current cpu's PDA instead of the offset from the
>>> original per-cpu area.  This is because GCC hardcodes the stackprotector
>>> canary at %gs:40.  Since the assembler is incapable of relocating against
>>> multiple symbols, the code ends up looking like:
>>>
>>> 	movq $per_cpu__var, reg
>>> 	subq $per_cpu__pda, reg
>>> 	movq %gs:(reg), reg
>>>
>>> This is still atomic since the offset is a constant (just calculated at
>>> runtime) and not dependant on the cpu number.
>>>   
>>>       
>> Yeah, it's a real pity we can't convince the linker to do this simple 
>> computation as a single %gs:ADDR addressing mode.  On the other hand, if 
>> the compiler can reuse the computation of %reg 2-3 times, then the 
>> generated code could well end up being denser.
>>     
>
> There's a nice project for linker hackers?
>
> I'd like to see some kernel image size measurements done on x86 defconfig 
> to see how much real impact this has on code density. Unless the impact is 
> horribly unacceptable, removing ~200 lines of weird x86-specific APIs is a 
> definitive plus.

Yep, I'm all for it.  I don't think there'll be much of a size impact at 
all.

    J


  reply	other threads:[~2008-12-27 11:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-23 17:15 [PATCH 1/3] x86-64: Convert the PDA to percpu Brian Gerst
2008-12-23 17:15 ` [PATCH 2/3] x86-64: Unify x86_*_percpu() functions Brian Gerst
2008-12-23 17:15   ` [PATCH 3/3] x86-64: Move cpu number from PDA to per-cpu and consolidate with 32-bit Brian Gerst
2008-12-27 11:03   ` [PATCH 2/3] x86-64: Unify x86_*_percpu() functions Jeremy Fitzhardinge
2008-12-27 11:09     ` Ingo Molnar
2008-12-27 11:20       ` Jeremy Fitzhardinge [this message]
2008-12-27 10:41 ` [PATCH 1/3] x86-64: Convert the PDA to percpu Ingo Molnar
2008-12-27 15:30   ` Brian Gerst
2008-12-27 15:53     ` Ingo Molnar
2008-12-27 17:16       ` Brian Gerst

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=49560F8F.9020901@goop.org \
    --to=jeremy@goop.org \
    --cc=brgerst@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=heukelum@mailshack.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=travis@sgi.com \
    /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