All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mm: hugetlb: Add missing cache flushing in hugetlb_unshare_all_pmds()
@ 2022-04-26  7:03 Baolin Wang
  0 siblings, 0 replies; only message in thread
From: Baolin Wang @ 2022-04-26  7:03 UTC (permalink / raw)
  To: akpm, mike.kravetz
  Cc: peterx, songmuchun, baolin.wang, linux-mm, linux-kernel

Missed calling flush_cache_range() before removing the sharing PMD entrires,
otherwise data consistence issue may be occurred on some architectures whose
caches are strict and require a virtual–>physical translation to exist for
a virtual address. Thus add it.

Now no architectures enabling PMD sharing will be affected, since they do
not have a VIVT cache. That means this issue can not be happened in practice
so far.

Fixes: 6dfeaff93be1 ("hugetlb/userfaultfd: unshare all pmds for hugetlbfs when register wp")
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
---
Changes from v1:
 - Add more comments in commit message suggested by Muchun.
 - Add reviewed-by tag from Muchun.
---
 mm/hugetlb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 74c9964..1945dfb 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -7058,6 +7058,7 @@ void hugetlb_unshare_all_pmds(struct vm_area_struct *vma)
 	if (start >= end)
 		return;
 
+	flush_cache_range(vma, start, end);
 	/*
 	 * No need to call adjust_range_if_pmd_sharing_possible(), because
 	 * we have already done the PUD_SIZE alignment.
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-26  7:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26  7:03 [PATCH v2] mm: hugetlb: Add missing cache flushing in hugetlb_unshare_all_pmds() Baolin Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.