Source-Changes-HG archive

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

[src/netbsd-8]: src/sys Pull up following revision(s) (requested by skrll in ...



details:   https://anonhg.NetBSD.org/src/rev/0039fd035df8
branches:  netbsd-8
changeset: 434662:0039fd035df8
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Feb 26 00:19:44 2018 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #566):
        sys/arch/arm/include/cpu.h: 1.94
        sys/arch/mips/include/cpu.h: 1.122
        sys/arch/powerpc/include/cpu.h: 1.103
        sys/sys/cpu.h: 1.42
CPU_INFO_FOREACH() must always iterate at least the boot cpu.
document this in sys/cpu.h and fix the arm and mips versions
to check ncpu is non zero before using it as an iterator max.
this should fix the new assert in init_main.c.
--
apply the same change for powerpc as mrg did for arm and mips:
CPU_INFO_FOREACH() must always iterate at least the boot cpu.
document this in sys/cpu.h and fix the arm and mips versions
to check ncpu is non zero before using it as an iterator max.
this should fix the new assert in init_main.c.

diffstat:

 sys/arch/arm/include/cpu.h     |   4 ++--
 sys/arch/mips/include/cpu.h    |   4 ++--
 sys/arch/powerpc/include/cpu.h |   7 +++++--
 sys/sys/cpu.h                  |  10 +++++++++-
 4 files changed, 18 insertions(+), 7 deletions(-)

diffs (95 lines):

diff -r 2b7441205c4d -r 0039fd035df8 sys/arch/arm/include/cpu.h
--- a/sys/arch/arm/include/cpu.h        Mon Feb 26 00:05:04 2018 +0000
+++ b/sys/arch/arm/include/cpu.h        Mon Feb 26 00:19:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.93 2017/04/04 09:26:32 sevan Exp $   */
+/*     $NetBSD: cpu.h,v 1.93.6.1 2018/02/26 00:19:44 snj Exp $ */
 
 /*
  * Copyright (c) 1994-1996 Mark Brinicombe.
@@ -235,7 +235,7 @@
 #define cpu_number()           (curcpu()->ci_index)
 #define CPU_IS_PRIMARY(ci)     ((ci)->ci_index == 0)
 #define CPU_INFO_FOREACH(cii, ci)                      \
-       cii = 0, ci = cpu_info[0]; cii < ncpu && (ci = cpu_info[cii]) != NULL; cii++
+       cii = 0, ci = cpu_info[0]; cii < (ncpu ? ncpu : 1) && (ci = cpu_info[cii]) != NULL; cii++
 #else
 #define cpu_number()            0
 
diff -r 2b7441205c4d -r 0039fd035df8 sys/arch/mips/include/cpu.h
--- a/sys/arch/mips/include/cpu.h       Mon Feb 26 00:05:04 2018 +0000
+++ b/sys/arch/mips/include/cpu.h       Mon Feb 26 00:19:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.121 2016/10/31 12:49:04 skrll Exp $  */
+/*     $NetBSD: cpu.h,v 1.121.8.1 2018/02/26 00:19:44 snj Exp $        */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -160,7 +160,7 @@
 #ifdef MULTIPROCESSOR
 #define        CPU_INFO_ITERATOR               int
 #define        CPU_INFO_FOREACH(cii, ci)       \
-    cii = 0, ci = cpu_infos[0]; cii < ncpu && (ci = cpu_infos[cii]) != NULL; cii++
+    cii = 0, ci = cpu_infos[0]; cii < (ncpu ? ncpu : 1) && (ci = cpu_infos[cii]) != NULL; cii++
 #else
 #define        CPU_INFO_ITERATOR               int __unused
 #define        CPU_INFO_FOREACH(cii, ci)       \
diff -r 2b7441205c4d -r 0039fd035df8 sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Mon Feb 26 00:05:04 2018 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Mon Feb 26 00:19:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.102 2016/10/19 00:08:42 nonaka Exp $ */
+/*     $NetBSD: cpu.h,v 1.102.8.1 2018/02/26 00:19:44 snj Exp $        */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -32,6 +32,7 @@
  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #ifndef        _POWERPC_CPU_H_
 #define        _POWERPC_CPU_H_
 
@@ -54,6 +55,8 @@
 #include <sys/intr.h>
 #include <sys/device_if.h>
 #include <sys/evcnt.h>
+#include <sys/param.h>
+#include <sys/kernel.h>
 #endif
 
 #include <sys/cpu_data.h>
@@ -191,7 +194,7 @@
 #define CPU_IS_PRIMARY(ci)     ((ci)->ci_cpuid == 0)
 #define CPU_INFO_ITERATOR      int
 #define CPU_INFO_FOREACH(cii, ci)                              \
-       cii = 0, ci = &cpu_info[0]; cii < ncpu; cii++, ci++
+       cii = 0, ci = &cpu_info[0]; cii < (ncpu ? ncpu : 1); cii++, ci++
 
 #else
 #define cpu_number()           0
diff -r 2b7441205c4d -r 0039fd035df8 sys/sys/cpu.h
--- a/sys/sys/cpu.h     Mon Feb 26 00:05:04 2018 +0000
+++ b/sys/sys/cpu.h     Mon Feb 26 00:19:44 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.41 2014/05/19 20:39:23 rmind Exp $   */
+/*     $NetBSD: cpu.h,v 1.41.20.1 2018/02/26 00:19:44 snj Exp $        */
 
 /*-
  * Copyright (c) 2007 YAMAMOTO Takashi,
@@ -63,6 +63,14 @@
 #define        cpu_did_resched(l)      /* nothing */
 #endif
 
+/*
+ * CPU_INFO_ITERATOR() may be supplied by machine dependent code as it
+ * controls how the cpu_info structures are allocated.
+ * 
+ * This macro must always iterate just the boot-CPU when the system has
+ * not attached any cpus via mi_cpu_attach() yet, and the "ncpu" variable
+ * is zero.
+ */
 #ifndef CPU_INFO_ITERATOR
 #define        CPU_INFO_ITERATOR               int
 #define        CPU_INFO_FOREACH(cii, ci)       \



Home | Main Index | Thread Index | Old Index