Module Name:    src
Committed By:   chs
Date:           Mon Jul  2 01:05:49 UTC 2012

Modified Files:
        src/sys/arch/x86/x86: cpu.c

Log Message:
in cpu_boot_secondary_processors(), wait until all the other CPUs
have registered themselves in kcpuset_running before returning.
recent changes to the TLB invalidation xcall code assume that
any CPU which will receive a broadcast IPI is registered in
kcpuset_running, so ensure that is true by waiting here.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/x86/x86/cpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.99 src/sys/arch/x86/x86/cpu.c:1.100
--- src/sys/arch/x86/x86/cpu.c:1.99	Tue Jun 12 17:14:19 2012
+++ src/sys/arch/x86/x86/cpu.c	Mon Jul  2 01:05:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.99 2012/06/12 17:14:19 yamt Exp $	*/
+/*	$NetBSD: cpu.c,v 1.100 2012/07/02 01:05:48 chs Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.99 2012/06/12 17:14:19 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.100 2012/07/02 01:05:48 chs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -589,12 +589,15 @@ void
 cpu_boot_secondary_processors(void)
 {
 	struct cpu_info *ci;
+	kcpuset_t *cpus;
 	u_long i;
 
 	/* Now that we know the number of CPUs, patch the text segment. */
 	x86_patch(false);
 
-	for (i=0; i < maxcpus; i++) {
+	kcpuset_create(&cpus, true);
+	kcpuset_set(cpus, cpu_index(curcpu()));
+	for (i = 0; i < maxcpus; i++) {
 		ci = cpu_lookup(i);
 		if (ci == NULL)
 			continue;
@@ -605,7 +608,11 @@ cpu_boot_secondary_processors(void)
 		if (ci->ci_flags & (CPUF_BSP|CPUF_SP|CPUF_PRIMARY))
 			continue;
 		cpu_boot_secondary(ci);
+		kcpuset_set(cpus, cpu_index(ci));
 	}
+	while (!kcpuset_match(cpus, kcpuset_running))
+		;
+	kcpuset_destroy(cpus);
 
 	x86_mp_online = true;
 

Reply via email to