Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64 PID_MAX is just an initial value (soft maxi...



details:   https://anonhg.NetBSD.org/src/rev/a7366ccc6bfc
branches:  trunk
changeset: 954972:a7366ccc6bfc
user:      ryo <ryo%NetBSD.org@localhost>
date:      Mon Sep 14 10:06:35 2020 +0000

description:
PID_MAX is just an initial value (soft maximum). Don't use it for CTASSERT.
defined __HAVE_CPU_MAXPROC to use function cpu_maxproc().

pointed out by mrg@, thanks.

diffstat:

 sys/arch/aarch64/aarch64/pmap.c  |  14 ++++++++++----
 sys/arch/aarch64/include/cpu.h   |   3 ++-
 sys/arch/aarch64/include/types.h |   3 ++-
 3 files changed, 14 insertions(+), 6 deletions(-)

diffs (76 lines):

diff -r b274b2fe23ce -r a7366ccc6bfc sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Mon Sep 14 09:47:43 2020 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Mon Sep 14 10:06:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $    */
+/*     $NetBSD: pmap.c,v 1.89 2020/09/14 10:06:35 ryo Exp $    */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.89 2020/09/14 10:06:35 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1413,6 +1413,13 @@
        pm_unlock(pm);
 }
 
+/* XXX: due to the current implementation of pmap depends on 16bit ASID */
+int
+cpu_maxproc(void)
+{
+       return 65535;
+}
+
 void
 pmap_activate(struct lwp *l)
 {
@@ -1436,8 +1443,7 @@
        reg_tcr_el1_write(tcr | TCR_EPD0);
        __asm __volatile("isb" ::: "memory");
 
-       /* XXX */
-       CTASSERT(PID_MAX <= 65535);     /* 16bit ASID */
+       /* XXX: allocate asid, and regenerate if needed */
        if (pm->pm_asid == -1)
                pm->pm_asid = l->l_proc->p_pid;
 
diff -r b274b2fe23ce -r a7366ccc6bfc sys/arch/aarch64/include/cpu.h
--- a/sys/arch/aarch64/include/cpu.h    Mon Sep 14 09:47:43 2020 +0000
+++ b/sys/arch/aarch64/include/cpu.h    Mon Sep 14 10:06:35 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.26 2020/08/12 13:19:35 skrll Exp $ */
+/* $NetBSD: cpu.h,v 1.27 2020/09/14 10:06:35 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -147,6 +147,7 @@
 #undef curlwp
 #define        curlwp                  (aarch64_curlwp())
 
+int    cpu_maxproc(void);
 void   cpu_signotify(struct lwp *l);
 void   cpu_need_proftick(struct lwp *l);
 
diff -r b274b2fe23ce -r a7366ccc6bfc sys/arch/aarch64/include/types.h
--- a/sys/arch/aarch64/include/types.h  Mon Sep 14 09:47:43 2020 +0000
+++ b/sys/arch/aarch64/include/types.h  Mon Sep 14 10:06:35 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.15 2020/08/03 06:30:00 ryo Exp $ */
+/* $NetBSD: types.h,v 1.16 2020/09/14 10:06:35 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -96,6 +96,7 @@
 #define __HAVE_COMMON___TLS_GET_ADDR
 #define __HAVE_CPU_COUNTER
 #define __HAVE_CPU_DATA_FIRST
+#define __HAVE_CPU_MAXPROC
 #define __HAVE_FAST_SOFTINTS
 #define __HAVE_MINIMAL_EMUL
 #define __HAVE_MM_MD_DIRECT_MAPPED_PHYS



Home | Main Index | Thread Index | Old Index