Module Name: src
Committed By: maxv
Date: Sat Aug 29 12:24:00 UTC 2015
Modified Files:
src/sys/kern: kern_cpu.c
Log Message:
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.70 -r1.71 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.70 src/sys/kern/kern_cpu.c:1.71
--- src/sys/kern/kern_cpu.c:1.70 Thu Aug 20 09:45:45 2015
+++ src/sys/kern/kern_cpu.c Sat Aug 29 12:24:00 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_cpu.c,v 1.70 2015/08/20 09:45:45 christos Exp $ */
+/* $NetBSD: kern_cpu.c,v 1.71 2015/08/29 12:24:00 maxv 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.70 2015/08/20 09:45:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.71 2015/08/29 12:24:00 maxv 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;