]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mm: Always set _PAGE_ACCESSED on L4e updates
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 17 Jan 2018 16:30:05 +0000 (17:30 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 17 Jan 2018 16:30:05 +0000 (17:30 +0100)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: bd61fe94bee0556bc2f64999a4a8315b93f90f21
master date: 2018-01-15 13:53:16 +0000

xen/arch/x86/mm.c

index a79a0ab77555e74b39c02c68a572dd1ce0071678..2fb9f4f86e54c72b92fcb75566f5870dfe805745 100644 (file)
@@ -1201,11 +1201,23 @@ get_page_from_l4e(
                                          _PAGE_USER|_PAGE_RW);      \
     } while ( 0 )
 
+/*
+ * When shadowing an L4 behind the guests back (e.g. for per-pcpu
+ * purposes), we cannot efficiently sync access bit updates from hardware
+ * (on the shadow tables) back into the guest view.
+ *
+ * We therefore unconditionally set _PAGE_ACCESSED even in the guests
+ * view.  This will appear to the guest as a CPU which proactively pulls
+ * all valid L4e's into its TLB, which is compatible with the x86 ABI.
+ *
+ * At the time of writing, all PV guests set the access bit anyway, so
+ * this is no actual change in their behaviour.
+ */
 #define adjust_guest_l4e(pl4e, d)                               \
     do {                                                        \
         if ( likely(l4e_get_flags((pl4e)) & _PAGE_PRESENT) &&   \
              likely(!is_pv_32bit_domain(d)) )                   \
-            l4e_add_flags((pl4e), _PAGE_USER);                  \
+            l4e_add_flags((pl4e), _PAGE_USER | _PAGE_ACCESSED); \
     } while ( 0 )
 
 #define unadjust_guest_l3e(pl3e, d)                                         \