Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Stop panic()ing on a UP system.



details:   https://anonhg.NetBSD.org/src/rev/86ffb408266e
branches:  trunk
changeset: 446417:86ffb408266e
user:      cherry <cherry%NetBSD.org@localhost>
date:      Tue Dec 04 19:22:42 2018 +0000

description:
Stop panic()ing on a UP system.

The reason for the panic is that the cpu_attach() doesn't run to
completion because it thinks it's run past maxcpus (which in the case
of UP), is 1.

This is because on x86 at least, mi_cpu_attach() is called *before*
configure() (and thus the cpu_match()/cpu_attach() pair). Thus ncpu
has already been incremented by the time MD cpu_attach() is called.

Fix this.

diffstat:

 sys/arch/x86/x86/cpu.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 175b76005e20 -r 86ffb408266e sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Tue Dec 04 18:39:03 2018 +0000
+++ b/sys/arch/x86/x86/cpu.c    Tue Dec 04 19:22:42 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $   */
+/*     $NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $ */
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.162 2018/11/12 18:10:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.163 2018/12/04 19:22:42 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"                /* for MPDEBUG */
@@ -320,7 +320,7 @@
 
        sc->sc_dev = self;
 
-       if (ncpu == maxcpus) {
+       if (ncpu > maxcpus) {
 #ifndef _LP64
                aprint_error(": too many CPUs, please use NetBSD/amd64\n");
 #else



Home | Main Index | Thread Index | Old Index