Module Name:    src
Committed By:   riz
Date:           Wed Nov  4 18:00:34 UTC 2015

Modified Files:
        src/sys/kern [netbsd-7]: kern_cpu.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #965):
        sys/kern/kern_cpu.c: revision 1.71
Don't decrement the number of offline cpus if we fail to shut down one.
ok christos@, via tech-kern@


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.66.2.1 src/sys/kern/kern_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/kern/kern_cpu.c
diff -u src/sys/kern/kern_cpu.c:1.66 src/sys/kern/kern_cpu.c:1.66.2.1
--- src/sys/kern/kern_cpu.c:1.66	Fri Jul 25 08:10:40 2014
+++ src/sys/kern/kern_cpu.c	Wed Nov  4 18:00:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_cpu.c,v 1.66 2014/07/25 08:10:40 dholland Exp $	*/
+/*	$NetBSD: kern_cpu.c,v 1.66.2.1 2015/11/04 18:00:34 riz Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010, 2012 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.66 2014/07/25 08:10:40 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.66.2.1 2015/11/04 18:00:34 riz Exp $");
 
 #include "opt_cpu_ucode.h"
 #include "opt_compat_netbsd.h"
@@ -444,7 +444,6 @@ cpu_setstate(struct cpu_info *ci, bool o
 		if ((spc->spc_flags & SPCF_OFFLINE) == 0)
 			return 0;
 		func = (xcfunc_t)cpu_xc_online;
-		ncpuonline++;
 	} else {
 		if ((spc->spc_flags & SPCF_OFFLINE) != 0)
 			return 0;
@@ -463,16 +462,19 @@ cpu_setstate(struct cpu_info *ci, bool o
 		if (nonline == 1)
 			return EBUSY;
 		func = (xcfunc_t)cpu_xc_offline;
-		ncpuonline--;
 	}
 
 	where = xc_unicast(0, func, ci, NULL, ci);
 	xc_wait(where);
 	if (online) {
 		KASSERT((spc->spc_flags & SPCF_OFFLINE) == 0);
-	} else if ((spc->spc_flags & SPCF_OFFLINE) == 0) {
-		/* If was not set offline, then it is busy */
-		return EBUSY;
+		ncpuonline++;
+	} else {
+		if ((spc->spc_flags & SPCF_OFFLINE) == 0) {
+			/* If was not set offline, then it is busy */
+			return EBUSY;
+		}
+		ncpuonline--;
 	}
 
 	spc->spc_lastmod = time_second;

Reply via email to