changeset 12816:beea835429cd

6961910 active guest flag becomes '-t----' if a cpu is added after cpu0 was removed
author Alexandre Chartre <Alexandre.Chartre@oracle.com>
date Fri, 09 Jul 2010 15:27:23 -0700
parents f5ee6337750c
children 288ae711509e
files usr/src/uts/sun4v/os/mach_mp_startup.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/sun4v/os/mach_mp_startup.c	Fri Jul 09 12:35:26 2010 -0400
+++ b/usr/src/uts/sun4v/os/mach_mp_startup.c	Fri Jul 09 15:27:23 2010 -0700
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <sys/machsystm.h>
@@ -74,7 +73,16 @@
 	 * StarFire requires the signature block stuff setup here
 	 */
 	CPU_SGN_MAPIN(cpuid);
-	if (cpuid == cpu0.cpu_id) {
+
+	/*
+	 * cpu0 is always initialized at boot time, but it can be initialized
+	 * again if it is dynamically removed and then re-added. We check if
+	 * we are booting by verifying cpu_list. During boot, cpu0 is already
+	 * in cpu_list when this function is called. When a cpu is dynamically
+	 * added (after the boot) then it is added to cpu_list after this
+	 * function is called.
+	 */
+	if (cpuid == cpu0.cpu_id && ncpus == 1 && cpu_list[0].cpu_id == cpuid) {
 		/*
 		 * cpu0 starts out running.  Other cpus are
 		 * still in OBP land and we will leave them