+ paravirt-update-pte-hook.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     paravirt: update pte hook

has been added to the -mm tree.  Its filename is

     paravirt-update-pte-hook.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: paravirt: update pte hook
From: Zachary Amsden <zach@xxxxxxxxxx>

Add a pte_update_hook which notifies about pte changes that have been made
without using the set_pte / clear_pte interfaces.  This allows shadow mode
hypervisors which do not trap on page table access to maintain synchronized
shadows.

It also turns out, there was one pte update in PAE mode that wasn't using any
accessor interface at all for setting NX protection.  Considering it is PAE
specific, and the accessor is i386 specific, I didn't want to add a generic
encapsulation of this behavior yet.

Signed-off-by: Zachary Amsden <zach@xxxxxxxxxx>
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/i386/mm/init.c        |    1 +
 include/asm-i386/pgtable.h |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff -puN arch/i386/mm/init.c~paravirt-update-pte-hook arch/i386/mm/init.c
--- a/arch/i386/mm/init.c~paravirt-update-pte-hook
+++ a/arch/i386/mm/init.c
@@ -493,6 +493,7 @@ int __init set_kernel_exec(unsigned long
 		pte->pte_high &= ~(1 << (_PAGE_BIT_NX - 32));
 	else
 		pte->pte_high |= 1 << (_PAGE_BIT_NX - 32);
+	pte_update_defer(&init_mm, vaddr, pte);
 	__flush_tlb_all();
 out:
 	return ret;
diff -puN include/asm-i386/pgtable.h~paravirt-update-pte-hook include/asm-i386/pgtable.h
--- a/include/asm-i386/pgtable.h~paravirt-update-pte-hook
+++ a/include/asm-i386/pgtable.h
@@ -247,6 +247,23 @@ static inline pte_t pte_mkhuge(pte_t pte
 #endif
 
 /*
+ * Rules for using pte_update - it must be called after any PTE update which
+ * has not been done using the set_pte / clear_pte interfaces.  It is used by
+ * shadow mode hypervisors to resynchronize the shadow page tables.  Kernel PTE
+ * updates should either be sets, clears, or set_pte_atomic for P->P
+ * transitions, which means this hook should only be called for user PTEs.
+ * This hook implies a P->P protection or access change has taken place, which
+ * requires a subsequent TLB flush.  The notification can optionally be delayed
+ * until the TLB flush event by using the pte_update_defer form of the
+ * interface, but care must be taken to assure that the flush happens while
+ * still holding the same page table lock so that the shadow and primary pages
+ * do not become out of sync on SMP.
+ */
+#define pte_update(mm, addr, ptep)		do { } while (0)
+#define pte_update_defer(mm, addr, ptep)	do { } while (0)
+
+
+/*
  * We only update the dirty/accessed state if we set
  * the dirty bit by hand in the kernel, since the hardware
  * will do the accessed bit for us, and we don't want to
@@ -258,6 +275,7 @@ static inline pte_t pte_mkhuge(pte_t pte
 do {									\
 	if (dirty) {							\
 		(ptep)->pte_low = (entry).pte_low;			\
+		pte_update_defer((vma)->vm_mm, (addr), (ptep));		\
 		flush_tlb_page(vma, address);				\
 	}								\
 } while (0)
@@ -287,6 +305,7 @@ do {									\
 	__dirty = pte_dirty(*(ptep));					\
 	if (__dirty) {							\
 		clear_bit(_PAGE_BIT_DIRTY, &(ptep)->pte_low);		\
+		pte_update_defer((vma)->vm_mm, (addr), (ptep));		\
 		flush_tlb_page(vma, address);				\
 	}								\
 	__dirty;							\
@@ -299,6 +318,7 @@ do {									\
 	__young = pte_young(*(ptep));					\
 	if (__young) {							\
 		clear_bit(_PAGE_BIT_ACCESSED, &(ptep)->pte_low);	\
+		pte_update_defer((vma)->vm_mm, (addr), (ptep));		\
 		flush_tlb_page(vma, address);				\
 	}								\
 	__young;							\
@@ -321,6 +341,7 @@ static inline pte_t ptep_get_and_clear_f
 static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	clear_bit(_PAGE_BIT_RW, &ptep->pte_low);
+	pte_update(mm, addr, ptep);
 }
 
 /*
_

Patches currently in -mm which might be from zach@xxxxxxxxxx are

split-i386-and-x86_64-ptraceh.patch
uml-use-ptrace-abih-instead-of-ptraceh.patch
x86-allow-a-kernel-to-not-be-in-ring-0.patch
x86-allow-a-kernel-to-not-be-in-ring-0-tidy.patch
x86-add-a-bootparameter-to-reserve-high-linear-address-space.patch
x86-trivial-pgtableh-__assembly__-move.patch
x86-trivial-move-of-__have-macros-in-i386-pagetable-headers.patch
x86-trivial-move-of-ptep_set_access_flags.patch
x86-remove-unused-include-from-efi_stubs.patch
paravirt-remove-read-hazard-from-cow.patch
paravirt-pte-clear-not-present.patch
paravirt-lazy-mmu-mode-hooks.patch
paravirt-combine-flush-accessed-dirty.patch
paravirt-kpte-flush.patch
paravirt-optimize-ptep-establish-for-pae.patch
paravirt-remove-set-pte-atomic.patch
paravirt-pae-compile-fix.patch
paravirt-update-pte-hook.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux