Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 Fix uvmexp.ncolors for some big.LIT...



details:   https://anonhg.NetBSD.org/src/rev/5b3f27ff220f
branches:  trunk
changeset: 935498:5b3f27ff220f
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Jul 04 04:39:20 2020 +0000

description:
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@.

diffstat:

 sys/arch/aarch64/aarch64/cpufunc.c |  21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diffs (59 lines):

diff -r 23a8b38a6193 -r 5b3f27ff220f sys/arch/aarch64/aarch64/cpufunc.c
--- a/sys/arch/aarch64/aarch64/cpufunc.c        Sat Jul 04 03:08:20 2020 +0000
+++ b/sys/arch/aarch64/aarch64/cpufunc.c        Sat Jul 04 04:39:20 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.c,v 1.21 2020/07/01 07:59:16 ryo Exp $ */
+/*     $NetBSD: cpufunc.c,v 1.22 2020/07/04 04:39:20 rin Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -30,13 +30,15 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.21 2020/07/01 07:59:16 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.22 2020/07/04 04:39:20 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/kmem.h>
 #include <sys/cpu.h>
 
+#include <uvm/uvm_page.h>
+
 #include <aarch64/cpufunc.h>
 
 u_int cputype;                 /* compat arm */
@@ -102,6 +104,7 @@
 {
        struct cpu_info * const ci = curcpu();
        uint32_t clidr, ctr;
+       u_int vindexsize;
        int level, cachetype;
        struct aarch64_cache_info *cinfo = NULL;
 
@@ -215,14 +218,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);
        }
 }
 



Home | Main Index | Thread Index | Old Index