Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2018 10:52:31 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328115 - head/sys/arm64/arm64
Message-ID:  <201801181052.w0IAqVto037404@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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