public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Kimio Suganuma <k-suganuma@mvj.biglobe.ne.jp>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] quick ia64 patch for 2.5.44 (UP only)
Date: Sun, 27 Oct 2002 16:42:47 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590709805263@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590709805243@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

Hi Erich,

Here is the patch.
I changed cpu_init() in setup.c so that BSP prepares
per_cpu data for all CPUS.

Regards,
Kimi

On Sun, 27 Oct 2002 18:13:31 +0100
Erich Focht <efocht@ess.nec.de> wrote:

> Hi Kimi,
> 
> On Saturday 26 October 2002 03:09, Kimio Suganuma wrote:
> > I succeeded to boot the kernel on 8way ia64 box by
> > porting the generic percpu (i.e. i386's percpu) to ia64.
> > I think this should not right way to fix the problem.
> > I can show the patch if there is a requirement.
> 
> yes, please send the patch. I'd like to test something on 2.5.44
> on Azusa on Monday.

-- 
Kimio Suganuma <k-suganuma@mvj.biglobe.ne.jp>

[-- Attachment #2: smp_fix-2.5.44.patch --]
[-- Type: application/octet-stream, Size: 3822 bytes --]

diff -Nur linux-2.5.44/arch/ia64/kernel/setup.c linux-2.5.44-new/arch/ia64/kernel/setup.c
--- linux-2.5.44/arch/ia64/kernel/setup.c	Fri Oct 25 18:22:51 2002
+++ linux-2.5.44-new/arch/ia64/kernel/setup.c	Fri Oct 25 19:17:49 2002
@@ -618,53 +618,40 @@
 	unsigned long num_phys_stacked;
 	pal_vm_info_2_u_t vmi;
 	unsigned int max_ctx;
-	struct cpuinfo_ia64 *my_cpu_info;
-	void *my_cpu_data;
+	struct cpuinfo_ia64 *cpu_info;
+	void *cpu_data;
 
 #ifdef CONFIG_SMP
 	extern char __per_cpu_end[];
-	int cpu = smp_processor_id();
+	int cpu;
 
 	if (__per_cpu_end - __per_cpu_start > PAGE_SIZE)
 		panic("Per-cpu data area too big! (%Zu > %Zu)",
 		      __per_cpu_end - __per_cpu_start, PAGE_SIZE);
 
-# ifdef CONFIG_NUMA
-	{
-		static unsigned long boot_cpu_data;
-
-		/*
-		 * get_free_pages() cannot be used before cpu_init() done.  BSP allocates
-		 * "NR_CPUS" pages for all CPUs to avoid that AP calls get_zeroed_page().
-		 */
-		if (cpu == 0)
-			boot_cpu_data = (unsigned long)alloc_bootmem_pages(PAGE_SIZE * NR_CPUS);
-		my_cpu_data = (void *)(boot_cpu_data + (cpu * PAGE_SIZE));
-
-		memcpy(my_cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start);
-		__per_cpu_offset[cpu] = (char *) my_cpu_data - __per_cpu_start;
-		my_cpu_info = my_cpu_data + ((char *) &__get_cpu_var(cpu_info) - __per_cpu_start);
 
-		my_cpu_info->node_data = get_node_data_ptr();
-		my_cpu_info->nodeid = boot_get_local_nodeid();
-	}
-# else /* !CONFIG_NUMA */
 	/*
-	 * On the BSP, the page allocator isn't initialized by the time we get here.  On
-	 * the APs, the bootmem allocator is no longer available...
+	 * get_free_pages() cannot be used before cpu_init() done.  BSP allocates
+	 * "NR_CPUS" pages for all CPUs to avoid that AP calls get_zeroed_page().
 	 */
-	if (cpu == 0)
-		my_cpu_data = alloc_bootmem_pages(__per_cpu_end - __per_cpu_start);
-	else
-		my_cpu_data = (void *) get_zeroed_page(GFP_KERNEL);
-	memcpy(my_cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start);
-	__per_cpu_offset[cpu] = (char *) my_cpu_data - __per_cpu_start;
-	my_cpu_info = my_cpu_data + ((char *) &__get_cpu_var(cpu_info) - __per_cpu_start);
-# endif /* !CONFIG_NUMA */
+	if (smp_processor_id() == 0) {
+		cpu_data = (unsigned long)alloc_bootmem_pages(PAGE_SIZE * NR_CPUS);
+		for (cpu = 0; cpu < NR_CPUS; cpu++) {
+			memcpy(cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start);
+			__per_cpu_offset[cpu] = (char *) cpu_data - __per_cpu_start;
+			cpu_data += PAGE_SIZE;
+		}
+	}
+	cpu_data = __per_cpu_start + __per_cpu_offset[smp_processor_id()];
 #else /* !CONFIG_SMP */
-	my_cpu_data = __phys_per_cpu_start;
+	cpu_data = __phys_per_cpu_start;
 #endif /* !CONFIG_SMP */
-	my_cpu_info = my_cpu_data + ((char *) &__get_cpu_var(cpu_info) - __per_cpu_start);
+
+	cpu_info = cpu_data + ((char *) &__get_cpu_var(cpu_info) - __per_cpu_start);
+#ifdef CONFIG_NUMA
+	cpu_info->node_data = get_node_data_ptr();
+	cpu_info->nodeid = boot_get_local_nodeid();
+#endif
 
 	/*
 	 * We can't pass "local_cpu_data" to identify_cpu() because we haven't called
@@ -672,14 +659,14 @@
 	 * depends on the data returned by identify_cpu().  We break the dependency by
 	 * accessing cpu_data() the old way, through identity mapped space.
 	 */
-	identify_cpu(my_cpu_info);
+	identify_cpu(cpu_info);
 
 #ifdef CONFIG_MCKINLEY
 	{
 #		define FEATURE_SET 16
 		struct ia64_pal_retval iprv;
 
-		if (my_cpu_info->family == 0x1f) {
+		if (cpu_info->family == 0x1f) {
 			PAL_CALL_PHYS(iprv, PAL_PROC_GET_FEATURES, 0, FEATURE_SET, 0);
 			if ((iprv.status == 0) && (iprv.v0 & 0x80) && (iprv.v2 & 0x80))
 				PAL_CALL_PHYS(iprv, PAL_PROC_SET_FEATURES,
@@ -710,7 +697,7 @@
 	if (current->mm)
 		BUG();
 
-	ia64_mmu_init(my_cpu_data);
+	ia64_mmu_init(cpu_data);
 
 #ifdef CONFIG_IA32_SUPPORT
 	/* initialize global ia32 state - CR0 and CR4 */

  parent reply	other threads:[~2002-10-27 16:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25  5:35 [Linux-ia64] quick ia64 patch for 2.5.44 (UP only) David Mosberger
2002-10-25 21:50 ` Kimio Suganuma
2002-10-25 23:23 ` Kimio Suganuma
2002-10-26  1:09 ` Kimio Suganuma
2002-10-27 16:42 ` Kimio Suganuma [this message]
2002-10-27 17:13 ` Erich Focht
2002-10-27 23:57 ` Peter Chubb
2002-10-28  0:51 ` Kimio Suganuma
2002-10-28  1:51 ` Peter Chubb
2002-10-28  3:02 ` David Mosberger
2002-10-28 17:12 ` Luck, Tony

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=marc-linux-ia64-105590709805263@msgid-missing \
    --to=k-suganuma@mvj.biglobe.ne.jp \
    --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