From: Andrew Morton Date: Wed, 26 Sep 2012 01:33:18 +0000 (+1000) Subject: mm-mmu_notifier-fix-inconsistent-memory-between-secondary-mmu-and-host-fix X-Git-Tag: next-20120926~2^2~338 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=caf95a68bd271146f8045e192f4176cd6e1627ca;p=karo-tx-linux.git mm-mmu_notifier-fix-inconsistent-memory-between-secondary-mmu-and-host-fix add comment from Andrea Cc: Andrea Arcangeli Cc: Avi Kivity Cc: Hugh Dickins Cc: Marcelo Tosatti Cc: Xiao Guangrong Signed-off-by: Andrew Morton --- diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 8c7435a0d2c6..6f32b2b1f76b 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -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; \