]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm-mmu_notifier-fix-inconsistent-memory-between-secondary-mmu-and-host-fix
authorAndrew Morton <akpm@linux-foundation.org>
Fri, 21 Sep 2012 00:57:21 +0000 (10:57 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 21 Sep 2012 05:58:41 +0000 (15:58 +1000)
add comment from Andrea

Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/mmu_notifier.h

index 8c7435a0d2c661a8da6b98f9aab2e8398da70303..6f32b2b1f76b115f2f6ce6b0a9e373354b921cae 100644 (file)
@@ -311,6 +311,16 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
        __young;                                                        \
 })
 
+/*
+ * set_pte_at_notify() sets the pte _after_ running the notifier.
+ * This is safe to start by updating the secondary MMUs, because the primary MMU
+ * pte invalidate must have already happened with a ptep_clear_flush() before
+ * set_pte_at_notify() has been invoked.  Updating the secondary MMUs first is
+ * required when we change both the protection of the mapping from read-only to
+ * read-write and the pfn (like during copy on write page faults). Otherwise the
+ * old page would remain mapped readonly in the secondary MMUs after the new
+ * page is already writable by some CPU through the primary MMU.
+ */
 #define set_pte_at_notify(__mm, __address, __ptep, __pte)              \
 ({                                                                     \
        struct mm_struct *___mm = __mm;                                 \