Date: Sun, 8 May 2016 09:06:52 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r299231 - stable/10/sys/vm Message-ID: <201605080906.u4896qsi065177@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sun May 8 09:06:52 2016 New Revision: 299231 URL: https://svnweb.freebsd.org/changeset/base/299231 Log: MFC r298891: Avoid duplicated calls to pmap_page_get_memattr(). Avoid logging inconsistency for the /dev/mem device. Modified: stable/10/sys/vm/device_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/device_pager.c ============================================================================== --- stable/10/sys/vm/device_pager.c Sun May 8 09:02:51 2016 (r299230) +++ stable/10/sys/vm/device_pager.c Sun May 8 09:06:52 2016 (r299231) @@ -299,7 +299,7 @@ old_dev_pager_fault(vm_object_t object, struct cdevsw *csw; struct file *fpop; struct thread *td; - vm_memattr_t memattr; + vm_memattr_t memattr, memattr1; int ref, ret; pidx = OFF_TO_IDX(offset); @@ -328,10 +328,18 @@ old_dev_pager_fault(vm_object_t object, /* If "paddr" is a real page, perform a sanity check on "memattr". */ if ((m_paddr = vm_phys_paddr_to_vm_page(paddr)) != NULL && - pmap_page_get_memattr(m_paddr) != memattr) { - memattr = pmap_page_get_memattr(m_paddr); - printf( - "WARNING: A device driver has set \"memattr\" inconsistently.\n"); + (memattr1 = pmap_page_get_memattr(m_paddr)) != memattr) { + /* + * For the /dev/mem d_mmap routine to return the + * correct memattr, pmap_page_get_memattr() needs to + * be called, which we do there. + */ + if ((csw->d_flags & D_MEM) == 0) { + printf("WARNING: Device driver %s has set " + "\"memattr\" inconsistently (drv %u pmap %u).\n", + csw->d_name, memattr, memattr1); + } + memattr = memattr1; } if (((*mres)->flags & PG_FICTITIOUS) != 0) { /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605080906.u4896qsi065177>