[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210827144500.2148-1-lizhijian@cn.fujitsu.com>
Date: Fri, 27 Aug 2021 22:45:00 +0800
From: Li Zhijian <lizhijian@...fujitsu.com>
To: <linux-mm@...ck.org>, <linux-rdma@...r.kernel.org>,
<akpm@...ux-foundation.org>, <jglisse@...hat.com>, <jgg@...pe.ca>
CC: <yishaih@...dia.com>, <linux-kernel@...r.kernel.org>,
Li Zhijian <lizhijian@...fujitsu.com>, <stable@...r.kernel.org>
Subject: [PATCH] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
Previously, we noticed the one rpma example was failed[1] since 36f30e486d,
where it will use ODP feature to do RDMA WRITE between fsdax files.
After digging into the code, we found hmm_vma_handle_pte() will still
return EFAULT even though all the its requesting flags has been
fulfilled. That's because a DAX page will be marked as
(_PAGE_SPECIAL | PAGE_DEVMAP) by pte_mkdevmap().
[1]: https://github.com/pmem/rpma/issues/1142
CC: stable@...r.kernel.org
Signed-off-by: Li Zhijian <lizhijian@...fujitsu.com>
---
mm/hmm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/hmm.c b/mm/hmm.c
index fad6be2bf072..4766bdefb6c3 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -294,6 +294,12 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
if (required_fault)
goto fault;
+ /*
+ * just bypass devmap pte such as DAX page when all pfn requested
+ * flags(pfn_req_flags) are fulfilled.
+ */
+ if (pte_devmap(pte))
+ goto out;
/*
* Since each architecture defines a struct page for the zero page, just
* fall through and treat it like a normal page.
@@ -307,6 +313,7 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
return 0;
}
+out:
*hmm_pfn = pte_pfn(pte) | cpu_flags;
return 0;
--
2.31.1
Powered by blists - more mailing lists