Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Fix a bug introduced in bus_space.c::r1.39....



details:   https://anonhg.NetBSD.org/src/rev/c687b4ac8aa8
branches:  trunk
changeset: 824676:c687b4ac8aa8
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Jun 14 08:12:22 2017 +0000

description:
Fix a bug introduced in bus_space.c::r1.39. This check too is hard-coded.
Might have had a cumulative effect on PR/52000.

diffstat:

 sys/arch/x86/x86/x86_machdep.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (51 lines):

diff -r dede55828bfe -r c687b4ac8aa8 sys/arch/x86/x86/x86_machdep.c
--- a/sys/arch/x86/x86/x86_machdep.c    Wed Jun 14 07:45:45 2017 +0000
+++ b/sys/arch/x86/x86/x86_machdep.c    Wed Jun 14 08:12:22 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_machdep.c,v 1.91 2017/04/14 04:43:47 kamil Exp $   */
+/*     $NetBSD: x86_machdep.c,v 1.92 2017/06/14 08:12:22 maxv Exp $    */
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.91 2017/04/14 04:43:47 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.92 2017/06/14 08:12:22 maxv Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -514,6 +514,7 @@
 x86_add_cluster(uint64_t seg_start, uint64_t seg_end, uint32_t type)
 {
        extern struct extent *iomem_ex;
+       const uint64_t endext = MAXIOMEM + 1;
        uint64_t new_physmem = 0;
        phys_ram_seg_t *cluster;
        int i;
@@ -556,15 +557,19 @@
        }
 
        /*
-        * Allocate the physical addresses used by RAM from the iomem extent
-        * map. This is done before the addresses are page rounded just to make
+        * This cluster is used by RAM. If it is included in the iomem extent,
+        * allocate it from there, so that we won't unintentionally reuse it
+        * later with extent_alloc_region. A way to avoid collision (with UVM
+        * for example).
+        *
+        * This is done before the addresses are page rounded just to make
         * sure we get them all.
         */
-       if (seg_start < 0x100000000ULL) {
+       if (seg_start < endext) {
                uint64_t io_end;
 
-               if (seg_end > 0x100000000ULL)
-                       io_end = 0x100000000ULL;
+               if (seg_end > endext)
+                       io_end = endext;
                else
                        io_end = seg_end;
 



Home | Main Index | Thread Index | Old Index