Author: andrew
Date: Mon Jan  8 11:08:45 2018
New Revision: 327691
URL: https://svnweb.freebsd.org/changeset/base/327691

Log:
  Only install the new pagetable pointer into ttbr0_el1 when it differs from
  the existing value.
  
  MFC after:    1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c Mon Jan  8 10:23:31 2018        (r327690)
+++ head/sys/arm64/arm64/pmap.c Mon Jan  8 11:08:45 2018        (r327691)
@@ -4677,17 +4677,20 @@ pmap_switch(struct thread *old, struct thread *new)
         * to a user process.
         */
 
-       __asm __volatile(
-           /* Switch to the new pmap */
-           "msr        ttbr0_el1, %0   \n"
-           "isb                        \n"
+       if (old == NULL ||
+           old->td_proc->p_md.md_l0addr != new->td_proc->p_md.md_l0addr) {
+               __asm __volatile(
+                   /* Switch to the new pmap */
+                   "msr        ttbr0_el1, %0   \n"
+                   "isb                        \n"
 
-           /* Invalidate the TLB */
-           "dsb        ishst           \n"
-           "tlbi       vmalle1is       \n"
-           "dsb        ish             \n"
-           "isb                        \n"
-           : : "r"(new->td_proc->p_md.md_l0addr));
+                   /* Invalidate the TLB */
+                   "dsb        ishst           \n"
+                   "tlbi       vmalle1is       \n"
+                   "dsb        ish             \n"
+                   "isb                        \n"
+                   : : "r"(new->td_proc->p_md.md_l0addr));
+       }
 
        return (pcb);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to