public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Brian Gerst <brgerst@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] x86-64: Unify x86_*_percpu() functions.
Date: Sat, 27 Dec 2008 22:03:35 +1100	[thread overview]
Message-ID: <49560B87.8090407@goop.org> (raw)
In-Reply-To: <1230052506-5041-2-git-send-email-brgerst@gmail.com>

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.

    J

  parent reply	other threads:[~2008-12-27 11:03 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   ` Jeremy Fitzhardinge [this message]
2008-12-27 11:09     ` [PATCH 2/3] x86-64: Unify x86_*_percpu() functions Ingo Molnar
2008-12-27 11:20       ` Jeremy Fitzhardinge
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=49560B87.8090407@goop.org \
    --to=jeremy@goop.org \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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