From: Andrew Morton Date: Fri, 21 Sep 2012 00:57:21 +0000 (+1000) Subject: mm-mmu_notifier-fix-inconsistent-memory-between-secondary-mmu-and-host-fix X-Git-Tag: next-20120925~1^2~309 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=06b0f993c778e922c0c12a0be09a24d39d8aa9c7;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; \