LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Andi Kleen <ak@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	virtualization@lists.osdl.org,
	lkml <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: [patch 5/6] cleanups to help using per-cpu variables from asm
Date: Fri, 30 Mar 2007 19:00:47 -0700	[thread overview]
Message-ID: <20070331020055.235511601@goop.org> (raw)
In-Reply-To: <20070331020042.003398870@goop.org>

[-- Attachment #1: i386-cleanups-to-help-using-per-cpu-variables-from-asm.patch --]
[-- Type: text/plain, Size: 1209 bytes --]

This patch does a few small cleanups:
 - use PER_CPU_NAME to generate the names of per-cpu variables
 - use lea to add the per_cpu offset in PER_CPU(), because it doesn't
   affect condition flags
 - add PER_CPU_VAR which allows direct access to pre-cpu variables
   with the %fs: prefix on SMP.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@suse.de>

---
 include/asm-i386/percpu.h |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

===================================================================
--- a/include/asm-i386/percpu.h
+++ b/include/asm-i386/percpu.h
@@ -16,12 +16,14 @@
  *    PER_CPU(cpu_gdt_descr, %ebx)
  */
 #ifdef CONFIG_SMP
+#define PER_CPU(var, reg)				\
+	movl %fs:per_cpu__##this_cpu_off, reg;		\
+	lea per_cpu__##var(reg), reg
+#define PER_CPU_VAR(var)	%fs:per_cpu__##var
+#else /* ! SMP */
 #define PER_CPU(var, reg)			\
-	movl %fs:per_cpu__this_cpu_off, reg;		\
-	addl $per_cpu__##var, reg
-#else /* ! SMP */
-#define PER_CPU(var, reg) \
-	movl $per_cpu__##var, reg;
+	movl $per_cpu__##var, reg
+#define PER_CPU_VAR(var)	per_cpu__##var
 #endif	/* SMP */
 
 #else /* ...!ASSEMBLY */

-- 


  parent reply	other threads:[~2007-03-31  4:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-31  2:00 [patch 0/6] i386 gdt and percpu cleanups Jeremy Fitzhardinge
2007-03-31  2:00 ` [patch 1/6] i386: Account for module percpu space separately from kernel percpu Jeremy Fitzhardinge
2007-03-31  2:00 ` [patch 2/6] Allow percpu variables to be page-aligned Jeremy Fitzhardinge
2007-03-31  2:00 ` [patch 3/6] Page-align the GDT Jeremy Fitzhardinge
2007-03-31  2:00 ` [patch 4/6] Convert PDA into the percpu section Jeremy Fitzhardinge
2007-03-31  2:35   ` Andi Kleen
2007-03-31  2:54     ` Rusty Russell
2007-03-31  3:00     ` Jeremy Fitzhardinge
2007-03-31  2:00 ` Jeremy Fitzhardinge [this message]
2007-03-31  2:00 ` [patch 6/6] Define per_cpu_offset Jeremy Fitzhardinge
2007-03-31  2:56 ` [patch 0/6] i386 gdt and percpu cleanups Rusty Russell
2007-03-31  3:05   ` Jeremy Fitzhardinge
2007-03-31  3:16 ` Jeremy Fitzhardinge

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=20070331020055.235511601@goop.org \
    --to=jeremy@goop.org \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.osdl.org \
    --subject='Re: [patch 5/6] cleanups to help using per-cpu variables from asm' \
    /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

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).