public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: linux-ia64@vger.kernel.org
Subject: RE: [PATCH] long format VHPT
Date: Sun, 28 Sep 2003 23:44:02 +0000	[thread overview]
Message-ID: <marc-linux-ia64-106479289832205@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-106453902218848@msgid-missing>

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


Arun Sharma wrote:
> - Can we avoid allocating VHPTs for non-existent CPUs ?
> - How about calling alloc_bootmem on cpu0 and __get_free_pages
>   on secondary cpus ?

> I noticed that when we hit ia64_mmu_init() on a secondary
> processor, cpu0 has already made successful calls to 
> __get_free_pages(). But calls from the secondary cpus fail.
> Does anyone know why ?

I did some hacking over the weekend. VHPT allocation can be done
from boot processor in function do_boot_cpu() before waking up
secondary CPUs.  Allocation can be easily made numa friendly by
calling alloc_pages_node (didn't bother to do that for now).

- Ken

[-- Attachment #2: lvhpt_init.patch --]
[-- Type: application/octet-stream, Size: 2484 bytes --]

diff -Nurp 2.6.0-test5.v/arch/ia64/kernel/smpboot.c 2.6.0-test5.ken/arch/ia64/kernel/smpboot.c
--- 2.6.0-test5.v/arch/ia64/kernel/smpboot.c	Sun Sep 28 16:28:16 2003
+++ 2.6.0-test5.ken/arch/ia64/kernel/smpboot.c	Sun Sep 28 16:32:24 2003
@@ -358,11 +358,16 @@ fork_by_hand (void)
 	return copy_process(CLONE_VM|CLONE_IDLETASK, 0, 0, 0, NULL, NULL);
 }
 
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+extern unsigned long vhpt_base[NR_CPUS];
+#endif
+
 static int __init
 do_boot_cpu (int sapicid, int cpu)
 {
 	struct task_struct *idle;
 	int timeout;
+	struct page * vhpt_page;
 
 	/*
 	 * We can't use kernel_thread since we must avoid to reschedule the child.
@@ -382,6 +387,16 @@ do_boot_cpu (int sapicid, int cpu)
 
 	task_for_booting_cpu = idle;
 
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+	vhpt_page = alloc_pages(__GFP_HIGHMEM, LONG_VHPT_BITS - PAGE_SHIFT);
+	if (vhpt_page)
+		vhpt_base[cpu] = (unsigned long) page_address(vhpt_page);
+	else
+		return -EINVAL;
+	printk(KERN_INFO "CPU %d: Long format VHPT initialised at base address:"
+			 " 0x%lx\n", cpu, vhpt_base[cpu]);
+#endif
+
 	Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);
 
 	platform_send_ipi(cpu, ap_wakeup_vector, IA64_IPI_DM_INT, 0);
@@ -404,6 +419,7 @@ do_boot_cpu (int sapicid, int cpu)
 		printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);
 		ia64_cpu_to_sapicid[cpu] = -1;
 		cpu_clear(cpu, cpu_online_map);  /* was set in smp_callin() */
+		__free_pages(vhpt_page, LONG_VHPT_BITS - PAGE_SHIFT);
 		return -EINVAL;
 	}
 	return 0;
diff -Nurp 2.6.0-test5.v/arch/ia64/mm/init.c 2.6.0-test5.ken/arch/ia64/mm/init.c
--- 2.6.0-test5.v/arch/ia64/mm/init.c	Sun Sep 28 16:28:22 2003
+++ 2.6.0-test5.ken/arch/ia64/mm/init.c	Sun Sep 28 16:32:25 2003
@@ -344,11 +344,8 @@ ia64_mmu_init (void *my_cpu_data)
 	if (cpu == 0)
 	{
 		/* We allocate all VHPTs here as we may not have enough contiguous memory later */
-		/* Also, we cannot use __get_free_pages on the target processor (until after init_cpu) */
-		for (i = 0; i < NR_CPUS; i++){
-			vhpt_base[i] = (unsigned long)__alloc_bootmem(LONG_VHPT_SIZE, LONG_VHPT_SIZE, __pa(MAX_DMA_ADDRESS));
-			printk(KERN_INFO "CPU %d: Long format VHPT initialised at base address: 0x%lx\n", i, vhpt_base[i]);
-		}
+		vhpt_base[0] = (unsigned long)__alloc_bootmem(LONG_VHPT_SIZE, LONG_VHPT_SIZE, __pa(MAX_DMA_ADDRESS));
+		printk(KERN_INFO "CPU 0: Long format VHPT initialised at base address: 0x%lx\n", vhpt_base[0]);
 	}
 #endif
 

  parent reply	other threads:[~2003-09-28 23:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-26  1:12 [PATCH] long format VHPT Darren Williams
2003-09-26 22:24 ` Arun Sharma
2003-09-26 23:42 ` Darren Williams
2003-09-28 23:44 ` Chen, Kenneth W [this message]
2003-09-29 17:43 ` Arun Sharma
2003-09-29 23:48 ` Darren Williams
2003-09-30 18:25 ` Arun Sharma
2003-10-01  0:58 ` Arun Sharma
2003-10-02  1:30 ` Arun Sharma
2003-10-02  1:51 ` Peter Chubb
2003-10-02  2:10 ` Matt Chapman

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-106479289832205@msgid-missing \
    --to=kenneth.w.chen@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