Port-xen archive

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

Re: LOCKDEBUG kernel option crashes if vcpu > 1



On Fri, Nov 21, 2014 at 08:59:57PM +0530, Cherry G. Mathew wrote:
> >>>>> "Emmanuel" == Emmanuel Dreyfus <manu%netbsd.org@localhost> writes:
> 
>     Emmanuel> On Tue, Nov 18, 2014 at 10:30:28PM +0530, Cherry G. Mathew wrote:
>     >> Does the following patch work for you ?
> 
>     Emmanuel> It does.
> 
> 
> Cool - I'll check it in unless anyone has reasonable objections.

Hello,
it looks like your patch cause Xen (at last i386/PAE) to panic at boot:
http://www-soc.lip6.fr/~bouyer/NetBSD-tests/xen/HEAD/

reverting this commit:
http://mail-index.netbsd.org/source-changes/2014/11/22/msg060804.html

fixes the problem for me.

At first glance, I'd say this is because the non-boot CPUs are not properly
xen_kpm_sync()'ed in this case. Waiting for mp_online is probably way too
late to call xen_kpm_sync().

Sorry, but I didn't clearly understand what the problem is with the initial
code. It looks like it's using a cpu_info before it's fully initialised
(especially the lock), right ? If so, what's the problem with initialising
the lock before it's made available to CPU_INFO_FOREACH() ?

The attached patch reverts your change, and moves pmap-related initialisations
to cpu_attach_common() where ci_pmap and ci_tlbstate are already set.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: sys/arch/xen/x86/cpu.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/x86/cpu.c,v
retrieving revision 1.99
diff -u -p -u -r1.99 cpu.c
--- sys/arch/xen/x86/cpu.c	18 Oct 2014 08:33:27 -0000	1.99
+++ sys/arch/xen/x86/cpu.c	27 Nov 2014 12:32:03 -0000
@@ -425,6 +425,13 @@ cpu_attach_common(device_t parent, devic
 	}
 
 	KASSERT(ci->ci_cpuid == ci->ci_index);
+#ifdef __x86_64__
+	/* No user PGD mapped for this CPU yet */
+	ci->ci_xen_current_user_pgd = 0;
+#endif
+#if defined(__x86_64__) || defined(PAE)
+	mutex_init(&ci->ci_kpm_mtx, MUTEX_DEFAULT, IPL_VM);
+#endif
 	pmap_reference(pmap_kernel());
 	ci->ci_pmap = pmap_kernel();
 	ci->ci_tlbstate = TLBSTATE_STALE;
@@ -543,14 +550,6 @@ cpu_init(struct cpu_info *ci)
 			lcr4(rcr4() | CR4_OSXMMEXCPT);
 	}
 
-#ifdef __x86_64__
-	/* No user PGD mapped for this CPU yet */
-	ci->ci_xen_current_user_pgd = 0;
-#endif
-#if defined(__x86_64__) || defined(PAE)
-	mutex_init(&ci->ci_kpm_mtx, MUTEX_DEFAULT, IPL_VM);
-#endif
-
 	atomic_or_32(&ci->ci_flags, CPUF_RUNNING);
 }
 


Home | Main Index | Thread Index | Old Index