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 Two fixes for loading free pages in...



details:   https://anonhg.NetBSD.org/src/rev/2c4e7e50476e
branches:  trunk
changeset: 379492:2c4e7e50476e
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Jun 03 07:02:59 2021 +0000

description:
Two fixes for loading free pages into UVM

- Only consider a boot_physmem (inner loop) range that has its end
  (bp_end) after the bootconfig.dram (outer loop) range start (start).
  This was harmless as a later condition correctly checks there is only
  something to do if start < bp_end.

- Stop processing boot_physmem ranges if all the bootconfig.dram range has
  been passed to UVM.  This fixes a boot problem for simon@

diffstat:

 sys/arch/aarch64/aarch64/aarch64_machdep.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 96155b60ee0d -r 2c4e7e50476e sys/arch/aarch64/aarch64/aarch64_machdep.c
--- a/sys/arch/aarch64/aarch64/aarch64_machdep.c        Thu Jun 03 01:00:24 2021 +0000
+++ b/sys/arch/aarch64/aarch64/aarch64_machdep.c        Thu Jun 03 07:02:59 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.60 2021/03/25 07:31:56 skrll Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.61 2021/06/03 07:02:59 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.60 2021/03/25 07:31:56 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.61 2021/06/03 07:02:59 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_cpuoptions.h"
@@ -391,12 +391,15 @@ initarm_common(vaddr_t kvm_base, vsize_t
                 * order.
                 */
                paddr_t segend = end;
-               for (size_t j = 0; j < nbp; j++) {
+               for (size_t j = 0; j < nbp && start < end; j++) {
                        paddr_t bp_start = bp[j].bp_start;
                        paddr_t bp_end = bp_start + bp[j].bp_pages;
 
+                       VPRINTF("   bp %2zu start %08lx  end %08lx\n",
+                           j, ptoa(bp_start), ptoa(bp_end));
+
                        KASSERT(bp_start < bp_end);
-                       if (start > bp_end || segend < bp_start)
+                       if (start >= bp_end || segend < bp_start)
                                continue;
 
                        if (start < bp_start)
@@ -414,6 +417,7 @@ initarm_common(vaddr_t kvm_base, vsize_t
 
                                uvm_page_physload(start, segend, start, segend,
                                    vm_freelist);
+
                                memsize_total += ptoa(segend - start);
                                start = segend;
                                segend = end;



Home | Main Index | Thread Index | Old Index