public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Zou Nan hai <nanhai.zou@intel.com>
To: linux-ia64@vger.kernel.org
Subject: [RFC Patch]Use ar.kr2 for smp_processor_id
Date: Thu, 08 Feb 2007 03:28:44 +0000	[thread overview]
Message-ID: <1170905324.3230.7.camel@linux-znh> (raw)

Pin ar.kr2 of each CPU, so that smp_processor_id can use it.
This will save some memory foot-print when smp_procerror_id() 
is called.

This is also useful for implement sys_getcpu in fast path.

I have simply tested the patch by boot on a 16p system then try 
offline and online some CPUs through /sys/.
 

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>


diff -Nraup linux-2.6.20/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
--- linux-2.6.20/arch/ia64/kernel/setup.c	2007-02-04 13:44:54.000000000 -0500
+++ b/arch/ia64/kernel/setup.c	2007-02-07 23:30:03.000000000 -0500
@@ -458,6 +458,9 @@ early_param("elfcorehdr", parse_elfcoreh
 void __init
 setup_arch (char **cmdline_p)
 {
+	/* setup SMP processor id */
+	ia64_set_kr(IA64_KR_CPU_ID, (current_thread_info()->cpu));
+
 	unw_init();
 
 	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
diff -Nraup linux-2.6.20/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
--- linux-2.6.20/arch/ia64/kernel/smpboot.c	2007-02-04 13:44:54.000000000 -0500
+++ b/arch/ia64/kernel/smpboot.c	2007-02-07 23:29:44.000000000 -0500
@@ -445,8 +445,12 @@ smp_callin (void)
 int __devinit
 start_secondary (void *unused)
 {
+	/* setup SMP processor id */
+	ia64_set_kr(IA64_KR_CPU_ID, (current_thread_info()->cpu));
+	
 	/* Early console may use I/O ports */
 	ia64_set_kr(IA64_KR_IO_BASE, __pa(ia64_iobase));
+
 	Dprintk("start_secondary: starting CPU 0x%x\n", hard_smp_processor_id());
 	efi_map_pal_code();
 	cpu_init();
diff -Nraup linux-2.6.20/include/asm-ia64/kregs.h b/include/asm-ia64/kregs.h
--- linux-2.6.20/include/asm-ia64/kregs.h	2007-02-04 13:44:54.000000000 -0500
+++ b/include/asm-ia64/kregs.h	2007-02-07 23:28:21.000000000 -0500
@@ -14,6 +14,7 @@
  */
 #define IA64_KR_IO_BASE		0	/* ar.k0: legacy I/O base address */
 #define IA64_KR_TSSD		1	/* ar.k1: IVE uses this as the TSSD */
+#define IA64_KR_CPU_ID		2	/* ar.k2: Processor ID */
 #define IA64_KR_PER_CPU_DATA	3	/* ar.k3: physical per-CPU base */
 #define IA64_KR_CURRENT_STACK	4	/* ar.k4: what's mapped in IA64_TR_CURRENT_STACK */
 #define IA64_KR_FPU_OWNER	5	/* ar.k5: fpu-owner (UP only, at the moment) */
diff -Nraup linux-2.6.20/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
--- linux-2.6.20/include/asm-ia64/smp.h	2007-02-04 13:44:54.000000000 -0500
+++ b/include/asm-ia64/smp.h	2007-02-08 00:53:58.000000000 -0500
@@ -45,7 +45,7 @@ ia64_get_lid (void)
 #define SMP_IRQ_REDIRECTION	(1 << 0)
 #define SMP_IPI_REDIRECTION	(1 << 1)
 
-#define raw_smp_processor_id() (current_thread_info()->cpu)
+#define raw_smp_processor_id() (ia64_get_kr(IA64_KR_CPU_ID))
 
 extern struct smp_boot_data {
 	int cpu_count;




  

             reply	other threads:[~2007-02-08  3:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08  3:28 Zou Nan hai [this message]
2007-02-08  4:27 ` [RFC Patch]Use ar.kr2 for smp_processor_id Zou Nan hai
2007-02-08  4:59 ` Zou Nan hai
2007-02-08  5:11 ` Zou Nan hai
2007-02-08  6:04 ` Keith Owens
2007-02-08  6:37 ` Keith Owens
2007-02-08  6:55 ` Keith Owens
2007-02-08  7:14 ` Zou Nan hai
2007-02-08  7:38 ` Zou Nan hai
2007-02-08  8:28 ` peterc
2007-02-08  8:40 ` Keith Owens
2007-02-08 18:03 ` Luck, Tony
2007-02-08 23:59 ` Keith Owens

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=1170905324.3230.7.camel@linux-znh \
    --to=nanhai.zou@intel.com \
    --cc=linux-ia64@vger.kernel.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