Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Jan 2014 10:47:06 -0800
From:      Sean Bruno <sean_bruno@yahoo.com>
To:        sbruno@freebsd.org
Cc:        Konstantin Belousov <kostikbel@gmail.com>, "freebsd-stable@freebsd.org" <freebsd-stable@freebsd.org>, decke <decke@FreeBSD.org>, Peter Wemm <peter@wemm.org>
Subject:   Re: 10.0 BETA 3 with redports kernel panic
Message-ID:  <1389293226.48122.7.camel@powernoodle.corp.yahoo.com>
In-Reply-To: <1389230030.6589.1.camel@powernoodle.corp.yahoo.com>
References:  <CAGE5yCqhmRSM6oyw=FRZq59LniLsYaN%2BEog=GEPn3-ruuQk9EQ@mail.gmail.com> <CAGE5yCp9msPAy4HZ4TGRXws%2BxjLQ8iChbPQGj539qHJKhq2UJQ@mail.gmail.com> <1387492541.27693.5.camel@powernoodle.corp.yahoo.com> <20131220094835.GR59496@kib.kiev.ua> <1387554355.1491.4.camel@powernoodle.corp.yahoo.com> <20131220162254.GT59496@kib.kiev.ua> <CAGE5yCos5xGu7w24A6QSRDEPbfRNsjmHSvnpUE2Dvr1PUW2T8w@mail.gmail.com> <20131221145534.GY59496@kib.kiev.ua> <1387818681.2431.0.camel@powernoodle.corp.yahoo.com> <1388170732.1530.2.camel@powernoodle.corp.yahoo.com> <20131228140843.GT59496@kib.kiev.ua> <1389230030.6589.1.camel@powernoodle.corp.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2014-01-08 at 17:13 -0800, Sean Bruno wrote:
> On Sat, 2013-12-28 at 16:08 +0200, Konstantin Belousov wrote:
> > diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
> > index abbbb21..fd9c5df 100644
> > --- a/sys/amd64/amd64/mem.c
> > +++ b/sys/amd64/amd64/mem.c
> > @@ -98,7 +98,13 @@ memrw(struct cdev *dev, struct uio *uio, int flags)
> >  kmemphys:
> >                         o = v & PAGE_MASK;
> >                         c = min(uio->uio_resid, (u_int)(PAGE_SIZE -
> > o));
> > -                       error = uiomove((void *)PHYS_TO_DMAP(v),
> > (int)c, uio);
> > +                       v = PHYS_TO_DMAP(v);
> > +                       if (v < DMAP_MIN_ADDRESS ||
> > +                           (v > DMAP_MIN_ADDRESS + dmaplimit &&
> > +                           v <= DMAP_MAX_ADDRESS) ||
> > +                           pmap_kextract(v) == 0)
> > +                               return (EFAULT);
> > +                       error = uiomove((void *)v, (int)c, uio);
> >                         continue;
> >                 }
> >                 else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
> > diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
> > index 014020b..85be1f2 100644
> > --- a/sys/amd64/amd64/pmap.c
> > +++ b/sys/amd64/amd64/pmap.c
> > @@ -321,7 +321,7 @@ SYSCTL_INT(_machdep, OID_AUTO, nkpt, CTLFLAG_RD,
> > &nkpt, 0,
> >      "Number of kernel page table pages allocated on bootup");
> >  
> >  static int ndmpdp;
> > -static vm_paddr_t dmaplimit;
> > +vm_paddr_t dmaplimit;
> >  vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS;
> >  pt_entry_t pg_nx;
> >  
> > diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
> > index 3918282..e83e07e 100644
> > --- a/sys/amd64/include/pmap.h
> > +++ b/sys/amd64/include/pmap.h
> > @@ -369,6 +369,7 @@ extern vm_paddr_t phys_avail[];
> >  extern vm_paddr_t dump_avail[];
> >  extern vm_offset_t virtual_avail;
> >  extern vm_offset_t virtual_end;
> > +extern vm_paddr_t dmaplimit;
> >  
> >  #define        pmap_page_get_memattr(m)        ((vm_memattr_t)(m)->md.pat_mode)
> >  #define        pmap_page_is_write_mapped(m)    (((m)->aflags &
> > PGA_WRITEABLE) != 0) 
> 
> 
> 
> I've updated 2/4 redbuild machines to stable/10 and applied this patch.
> I will monitor them for the rest of the week for stability.
> 
> sean
> 
> p.s. redbuild 03/04
> 
> __________

rebuild03 deadlocked or something odd today.  I dropped to debugger and
got a crashdump.  This should be fun.

core.txt --> http://people.freebsd.org/~sbruno/redbuild_10_lockup.txt

confirming diff here:

root@redbuild03:/usr/src # svn diff
Index: sys/amd64/amd64/mem.c
===================================================================
--- sys/amd64/amd64/mem.c	(revision 260456)
+++ sys/amd64/amd64/mem.c	(working copy)
@@ -98,7 +98,12 @@
 kmemphys:
 			o = v & PAGE_MASK;
 			c = min(uio->uio_resid, (u_int)(PAGE_SIZE - o));
-			error = uiomove((void *)PHYS_TO_DMAP(v), (int)c, uio);
+			v = PHYS_TO_DMAP(v);
+			if (v < DMAP_MIN_ADDRESS ||
+			    (v > DMAP_MIN_ADDRESS + dmaplimit &&
+			    v <= DMAP_MAX_ADDRESS) ||
+			    pmap_kextract(v) == 0)
+				return (EFAULT);
 			continue;
 		}
 		else if (dev2unit(dev) == CDEV_MINOR_KMEM) {
Index: sys/amd64/amd64/pmap.c
===================================================================
--- sys/amd64/amd64/pmap.c	(revision 260456)
+++ sys/amd64/amd64/pmap.c	(working copy)
@@ -321,7 +321,7 @@
     "Number of kernel page table pages allocated on bootup");
 
 static int ndmpdp;
-static vm_paddr_t dmaplimit;
+vm_paddr_t dmaplimit;
 vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS;
 pt_entry_t pg_nx;
 
Index: sys/amd64/include/pmap.h
===================================================================
--- sys/amd64/include/pmap.h	(revision 260456)
+++ sys/amd64/include/pmap.h	(working copy)
@@ -368,6 +368,7 @@
 extern vm_paddr_t dump_avail[];
 extern vm_offset_t virtual_avail;
 extern vm_offset_t virtual_end;
+extern vm_paddr_t dmaplimit;
 
 #define	pmap_page_get_memattr(m)	((vm_memattr_t)(m)->md.pat_mode)
 #define	pmap_page_is_write_mapped(m)	(((m)->aflags & PGA_WRITEABLE) !=
0)





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1389293226.48122.7.camel>