Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/mips Revert previous:



details:   https://anonhg.NetBSD.org/src/rev/6c4d7aba608b
branches:  trunk
changeset: 989890:6c4d7aba608b
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Oct 19 03:47:33 2021 +0000

description:
Revert previous:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/mips/mips/vm_machdep.c#rev1.163

> cpu_uarea_alloc: For ILP32, do not try to allocate physical memory above
> pmap_limits.avail_end.
>
> Fix NULL dereference in uvm_pglistalloc_contig_aggressive().

"high" argument larger than pmap_limits.avail_end is just legal for
uvm_pglistalloc(); uvm_pglistalloc_contig_aggressive() and friends
allocate memory between uvm_physseg_get_avail_start() and
uvm_physseg_get_avail_end().

It turned out that the NULL dereference took place as PHYS_TO_VM_PAGE()
aka uvm_phys_to_vm_page() returns NULL for a valid pa. I've not figured
out why...

Thanks chs@ for correcting my misunderstanding.

diffstat:

 sys/arch/mips/mips/vm_machdep.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 926ff2335870 -r 6c4d7aba608b sys/arch/mips/mips/vm_machdep.c
--- a/sys/arch/mips/mips/vm_machdep.c   Mon Oct 18 23:01:10 2021 +0000
+++ b/sys/arch/mips/mips/vm_machdep.c   Tue Oct 19 03:47:33 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.163 2021/10/14 02:22:25 rin Exp $     */
+/*     $NetBSD: vm_machdep.c,v 1.164 2021/10/19 03:47:33 rin Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.163 2021/10/14 02:22:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.164 2021/10/19 03:47:33 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_cputype.h"
@@ -176,13 +176,15 @@
 #ifdef PMAP_MAP_POOLPAGE
 
        struct pglist pglist;
+#ifdef _LP64
        const paddr_t high = pmap_limits.avail_end;
-#ifndef _LP64
+#else
+       const paddr_t high = MIPS_KSEG1_START - MIPS_KSEG0_START;
        /*
         * Don't allocate a direct mapped uarea if we aren't allocating for a
         * system lwp and we have memory that can't be mapped via KSEG0.
         */
-       if (!system && high > MIPS_KSEG1_START - MIPS_KSEG0_START)
+       if (!system && high < pmap_limits.avail_end)
                return NULL;
 #endif
        int error;



Home | Main Index | Thread Index | Old Index