changeset 6749:22c537726e3e

6657646 diskless mp system hangs during mp_startup(), with device interrupts masked
author sherrym
date Thu, 29 May 2008 10:54:39 -0700
parents 6c7adefd809e
children bd49b8b8d6f3
files usr/src/uts/i86pc/io/pcplusmp/apic.c usr/src/uts/i86pc/os/mp_startup.c usr/src/uts/i86xpv/io/psm/xpv_psm.c
diffstat 3 files changed, 17 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/io/pcplusmp/apic.c	Thu May 29 00:08:40 2008 -0700
+++ b/usr/src/uts/i86pc/io/pcplusmp/apic.c	Thu May 29 10:54:39 2008 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1119,9 +1119,7 @@
 static int
 apic_post_cpu_start()
 {
-	int i, cpun;
-	ulong_t iflag;
-	apic_irq_t *irq_ptr;
+	int cpun;
 
 	splx(ipltospl(LOCK_LEVEL));
 	apic_init_intr();
@@ -1136,27 +1134,7 @@
 		apic_ret();
 
 	cpun = psm_get_cpu_id();
-	apic_cpus[cpun].aci_status = APIC_CPU_ONLINE | APIC_CPU_INTR_ENABLE;
-
-	for (i = apic_min_device_irq; i <= apic_max_device_irq; i++) {
-		irq_ptr = apic_irq_table[i];
-		if ((irq_ptr == NULL) ||
-		    ((irq_ptr->airq_cpu & ~IRQ_USER_BOUND) != cpun))
-			continue;
-
-		while (irq_ptr) {
-			if (irq_ptr->airq_temp_cpu != IRQ_UNINIT) {
-				iflag = intr_clear();
-				lock_set(&apic_ioapic_lock);
-
-				(void) apic_rebind(irq_ptr, cpun, NULL);
-
-				lock_clear(&apic_ioapic_lock);
-				intr_restore(iflag);
-			}
-			irq_ptr = irq_ptr->airq_next;
-		}
-	}
+	apic_cpus[cpun].aci_status = APIC_CPU_ONLINE;
 
 	apicadr[APIC_DIVIDE_REG] = apic_divide_reg_init;
 	return (PSM_SUCCESS);
--- a/usr/src/uts/i86pc/os/mp_startup.c	Thu May 29 00:08:40 2008 -0700
+++ b/usr/src/uts/i86pc/os/mp_startup.c	Thu May 29 10:54:39 2008 -0700
@@ -1477,7 +1477,6 @@
 	 * since we get here by calling t_pc, we need to do that call
 	 * before swtch() overwrites it.
 	 */
-
 	(void) (*ap_mlsetup)();
 
 	new_x86_feature = cpuid_pass1(cp);
@@ -1560,8 +1559,7 @@
 	pg_cpu_init(cp);
 	pg_cmt_cpu_startup(cp);
 
-	cp->cpu_flags |= CPU_RUNNING | CPU_READY | CPU_ENABLE | CPU_EXISTS;
-	cpu_add_active(cp);
+	cp->cpu_flags |= CPU_RUNNING | CPU_READY | CPU_EXISTS;
 
 	if (dtrace_cpu_init != NULL) {
 		(*dtrace_cpu_init)(cp->cpu_id);
@@ -1586,13 +1584,18 @@
 	 */
 	curthread->t_preempt = 0;
 
-	add_cpunode2devtree(cp->cpu_id, cp->cpu_m.mcpu_cpi);
-
 	/* The base spl should still be at LOCK LEVEL here */
 	ASSERT(cp->cpu_base_spl == ipltospl(LOCK_LEVEL));
 	set_base_spl();		/* Restore the spl to its proper value */
 
-	(void) spl0();				/* enable interrupts */
+	/* Enable interrupts */
+	(void) spl0();
+	mutex_enter(&cpu_lock);
+	cpu_enable_intr(cp);
+	cpu_add_active(cp);
+	mutex_exit(&cpu_lock);
+
+	add_cpunode2devtree(cp->cpu_id, cp->cpu_m.mcpu_cpi);
 
 #ifndef __xpv
 	{
--- a/usr/src/uts/i86xpv/io/psm/xpv_psm.c	Thu May 29 00:08:40 2008 -0700
+++ b/usr/src/uts/i86xpv/io/psm/xpv_psm.c	Thu May 29 10:54:39 2008 -0700
@@ -826,6 +826,10 @@
 			continue;
 		xen_psm_rebind_irq(irq);
 	}
+
+	if (DOMAIN_IS_INITDOMAIN(xen_info)) {
+		apic_cpus[cpun].aci_status |= APIC_CPU_INTR_ENABLE;
+	}
 }
 
 static int
@@ -835,13 +839,8 @@
 
 	cpun = psm_get_cpu_id();
 	if (DOMAIN_IS_INITDOMAIN(xen_info)) {
-		apic_cpus[cpun].aci_status =
-		    APIC_CPU_ONLINE | APIC_CPU_INTR_ENABLE;
+		apic_cpus[cpun].aci_status = APIC_CPU_ONLINE;
 	}
-	/*
-	 * Re-distribute interrupts to include the newly added cpu.
-	 */
-	xen_psm_enable_intr(cpun);
 	return (PSM_SUCCESS);
 }