Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/aarch64/aarch64 Pull up following revision(s) (r...



details:   https://anonhg.NetBSD.org/src/rev/0b0e303fdb23
branches:  netbsd-9
changeset: 948814:0b0e303fdb23
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jan 01 12:38:49 2021 +0000

description:
Pull up following revision(s) (requested by rin in ticket #1170):

        sys/arch/aarch64/aarch64/cpufunc.c: revision 1.22 (patch)
        sys/arch/aarch64/aarch64/cpufunc.c: revision 1.23 (patch)
        sys/arch/aarch64/aarch64/pmap.c: revision 1.81

Set uvmexp.ncolors appropriately, which is required for some CPU
models with VIPT icache.

Otherwise, alias in virtual address results in inconsistent results,
at least for applications that rewrite text of other process, e.g.,
GDB for arm32.

Also, this hopefully fixes other unexpected failures due to alias.
Confirmed that there's no observable regression in performance;
difference in ``time make -j8'' for GENERIC64 kernel on BCM2837
with and without setting uvmexp.ncolors is within 0.1%.

Thanks to ryo@ for discussion.


Fix uvmexp.ncolors for some big.LITTLE configuration; it is uncertain
which CPU is used as primary, and as a result, secondary CPUs can
require larger number of colors.

In order to solve this problem, update uvmexp.ncolors via
uvm_page_recolor(9) when secondary CPUs are attached, as done for
other ports like x86.

Pointed out by jmcneill@, and discussed on port-arm@:
http://mail-index.netbsd.org/port-arm/2020/07/03/msg006837.html
Tested and OK'd by ryo@.

Fix previous; add missing <uvm/uvm.h> include.

diffstat:

 sys/arch/aarch64/aarch64/cpufunc.c |  22 ++++++++++++++++------
 sys/arch/aarch64/aarch64/pmap.c    |   7 ++-----
 2 files changed, 18 insertions(+), 11 deletions(-)

diffs (88 lines):

diff -r 99fea32e2685 -r 0b0e303fdb23 sys/arch/aarch64/aarch64/cpufunc.c
--- a/sys/arch/aarch64/aarch64/cpufunc.c        Fri Jan 01 12:31:19 2021 +0000
+++ b/sys/arch/aarch64/aarch64/cpufunc.c        Fri Jan 01 12:38:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.c,v 1.5.4.1 2019/09/22 12:27:22 martin Exp $   */
+/*     $NetBSD: cpufunc.c,v 1.5.4.2 2021/01/01 12:38:49 martin Exp $   */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -29,12 +29,15 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.5.4.1 2019/09/22 12:27:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.5.4.2 2021/01/01 12:38:49 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/kmem.h>
 
+#include <uvm/uvm.h>
+#include <uvm/uvm_page.h>
+
 #include <aarch64/cpu.h>
 #include <aarch64/cpufunc.h>
 
@@ -91,6 +94,7 @@
 aarch64_getcacheinfo(void)
 {
        uint32_t clidr, ctr;
+       u_int vindexsize;
        int level, cachetype;
        struct aarch64_cache_info *cinfo;
 
@@ -201,14 +205,20 @@
            ((cinfo[0].cacheable == CACHE_CACHEABLE_ICACHE) ||
             (cinfo[0].cacheable == CACHE_CACHEABLE_IDCACHE))) {
 
-               aarch64_cache_vindexsize =
+               vindexsize =
                    cinfo[0].icache.cache_size /
                    cinfo[0].icache.cache_ways;
 
-               KASSERT(aarch64_cache_vindexsize != 0);
-               aarch64_cache_prefer_mask = aarch64_cache_vindexsize - 1;
+               KASSERT(vindexsize != 0);
        } else {
-               aarch64_cache_vindexsize = 0;
+               vindexsize = 0;
+       }
+
+       if (vindexsize > aarch64_cache_vindexsize) {
+               aarch64_cache_vindexsize = vindexsize;
+               aarch64_cache_prefer_mask = vindexsize - 1;
+               if (uvm.page_init_done)
+                       uvm_page_recolor(vindexsize / PAGE_SIZE);
        }
 }
 
diff -r 99fea32e2685 -r 0b0e303fdb23 sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c   Fri Jan 01 12:31:19 2021 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c   Fri Jan 01 12:38:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.41.2.6 2020/06/30 18:39:37 martin Exp $     */
+/*     $NetBSD: pmap.c,v 1.41.2.7 2021/01/01 12:38:49 martin 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.41.2.6 2020/06/30 18:39:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.41.2.7 2021/01/01 12:38:49 martin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -418,10 +418,7 @@
        UVMHIST_FUNC(__func__);
        UVMHIST_CALLED(pmaphist);
 
-#if 0
-       /* uvmexp.ncolors = icachesize / icacheways / PAGE_SIZE; */
        uvmexp.ncolors = aarch64_cache_vindexsize / PAGE_SIZE;
-#endif
 
        /* devmap already uses last of va? */
        if ((virtual_devmap_addr != 0) && (virtual_devmap_addr < vend))



Home | Main Index | Thread Index | Old Index