From owner-svn-src-head@freebsd.org Thu Jan 18 10:52:32 2018 Return-Path: Delivered-To: svn-src-head@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 88BEDEC4B02; Thu, 18 Jan 2018 10:52:32 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62E942978; Thu, 18 Jan 2018 10:52:32 +0000 (UTC) (envelope-from andrew@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B41D21D87E; Thu, 18 Jan 2018 10:52:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w0IAqVKq037405; Thu, 18 Jan 2018 10:52:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w0IAqVto037404; Thu, 18 Jan 2018 10:52:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201801181052.w0IAqVto037404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 18 Jan 2018 10:52:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r328115 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 328115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jan 2018 10:52:32 -0000 Author: andrew Date: Thu Jan 18 10:52:31 2018 New Revision: 328115 URL: https://svnweb.freebsd.org/changeset/base/328115 Log: Add a pmap invalidate that doesn't call sched_pin. When demoting DMAP pages curthread may be pointing to data within the page we are demoting. Create a new invalidate that doesn't pin and use it in the demote case. As the demote has both interrupts disabled, and is within a critical section this is safe from having the scheduler from switching to another CPU. Reported by: loos Reviewed by: loos Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D13955 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Jan 18 09:17:06 2018 (r328114) +++ head/sys/arm64/arm64/pmap.c Thu Jan 18 10:52:31 2018 (r328115) @@ -908,11 +908,10 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va) } static __inline void -pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +pmap_invalidate_range_nopin(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { vm_offset_t addr; - sched_pin(); dsb(ishst); for (addr = sva; addr < eva; addr += PAGE_SIZE) { __asm __volatile( @@ -921,6 +920,14 @@ pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm __asm __volatile( "dsb ish \n" "isb \n"); +} + +static __inline void +pmap_invalidate_range(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +{ + + sched_pin(); + pmap_invalidate_range_nopin(pmap, sva, eva); sched_unpin(); } @@ -2667,7 +2674,7 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent /* Clear the old mapping */ pmap_load_clear(pte); - pmap_invalidate_range(pmap, va, va + size); + pmap_invalidate_range_nopin(pmap, va, va + size); /* Create the new mapping */ pmap_load_store(pte, newpte);