Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pae MP on cherry-xenmp



On Tue, 30 Aug 2011, Jeff Rizzo wrote:

On 8/30/11 12:49 PM, Cherry G. Mathew wrote:
Index: sys/arch/xen/x86/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/cpu.c,v
retrieving revision 1.56.2.9
diff -u -r1.56.2.9 cpu.c
--- sys/arch/xen/x86/cpu.c 30 Aug 2011 12:53:46 -0000 1.56.2.9
+++ sys/arch/xen/x86/cpu.c      30 Aug 2011 19:44:49 -0000
@@ -1334,7 +1334,7 @@
panic("%s: failed to allocate L3 pglist for CPU %d (ret %d)\n",
                            __func__, cpu_index(ci), ret);

-               ci->ci_pae_l3_pdirpa = vmap->phys_addr;
+ ci->ci_pae_l3_pdirpa = xen_pfn_to_cr3(x86_btop(VM_PAGE_TO_PHYS(vmap)));

ci->ci_pae_l3_pdir = (paddr_t *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
                    UVM_KMF_VAONLY | UVM_KMF_NOWAIT);


It wasn't clear to me whether this change (above) was supposed to be in addition to Michael's, or instead of it - but the change above does not get MP working for me, while Michael's does. (I haven't tried them together).

I'm not sure either, but I'm pretty sure it wouldn't work. The cpu context ctrlreg[3] needs to be a 'packed' xen machine address, and Cherry's patch looks like it's going to be packing the guest physical address, which would then be used to map into the machine address which would not be correct.

This is what I came up with using the accessor macro and manually converting the machine address to a machhine frame number (MFN) which is the proper arguement to xen_pfn_to_cr3 [the pfn is not really the correct terminology here as best I can tell]. I haven't had a chance to test it yet, but can later tonight.

Index: sys/arch/xen/x86/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/cpu.c,v
retrieving revision 1.56.2.8
diff -u -p -r1.56.2.8 cpu.c
--- sys/arch/xen/x86/cpu.c      26 Aug 2011 13:33:34 -0000      1.56.2.8
+++ sys/arch/xen/x86/cpu.c      30 Aug 2011 20:45:06 -0000
@@ -1023,7 +1023,7 @@ xen_init_i386_vcpuctxt(struct cpu_info *
         * per-cpu L4 PD in pmap_cpu_init_late()
         */
 #ifdef PAE
-       initctx->ctrlreg[3] = xpmap_ptom(ci->ci_pae_l3_pdirpa);
+       initctx->ctrlreg[3] = xen_pfn_to_cr3(xpmap_ptom(ci->ci_pae_l3_pdirpa) 
<< 12);
 #else /* PAE */
        initctx->ctrlreg[3] = xpmap_ptom(pcb->pcb_cr3);
 #endif /* PAE */


--
Michael L. Hitch                        mhitch%montana.edu@localhost
Computer Consultant
Information Technology Center
Montana State University        Bozeman, MT     USA


Home | Main Index | Thread Index | Old Index