From owner-svn-src-stable-10@freebsd.org Sun May 8 09:06:53 2016 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8F62B31A5F; Sun, 8 May 2016 09:06:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA21D131E; Sun, 8 May 2016 09:06:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4896q3v065178; Sun, 8 May 2016 09:06:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4896qsi065177; Sun, 8 May 2016 09:06:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201605080906.u4896qsi065177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 8 May 2016 09:06:52 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2016 09:06:54 -0000 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) { /*