From: Steve Capper <[email protected]>

ptep_clear_flush_young_notify and pmdp_clear_flush_young_notify both
call the notifiers *after* the pte/pmd has been made young.

This can cause problems with KVM that relies on being able to block
MMU notifiers when carrying out maintenance of second stage
descriptors.

This patch ensures that the MMU notifiers are called before ptes and
pmds are made old.

Signed-off-by: Steve Capper <[email protected]>
---
 include/linux/mmu_notifier.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 95243d2..c454c76 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -290,11 +290,11 @@ static inline void mmu_notifier_mm_destroy(struct 
mm_struct *mm)
        int __young;                                                    \
        struct vm_area_struct *___vma = __vma;                          \
        unsigned long ___address = __address;                           \
-       __young = ptep_clear_flush_young(___vma, ___address, __ptep);   \
-       __young |= mmu_notifier_clear_flush_young(___vma->vm_mm,        \
+       __young = mmu_notifier_clear_flush_young(___vma->vm_mm,         \
                                                  ___address,           \
                                                  ___address +          \
                                                        PAGE_SIZE);     \
+       __young |= ptep_clear_flush_young(___vma, ___address, __ptep);  \
        __young;                                                        \
 })
 
@@ -303,11 +303,11 @@ static inline void mmu_notifier_mm_destroy(struct 
mm_struct *mm)
        int __young;                                                    \
        struct vm_area_struct *___vma = __vma;                          \
        unsigned long ___address = __address;                           \
-       __young = pmdp_clear_flush_young(___vma, ___address, __pmdp);   \
-       __young |= mmu_notifier_clear_flush_young(___vma->vm_mm,        \
+       __young = mmu_notifier_clear_flush_young(___vma->vm_mm,         \
                                                  ___address,           \
                                                  ___address +          \
                                                        PMD_SIZE);      \
+       __young |= pmdp_clear_flush_young(___vma, ___address, __pmdp);  \
        __young;                                                        \
 })
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to