LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
@ 2021-08-28 1:04 Li Zhijian
2021-08-30 7:32 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Li Zhijian @ 2021-08-28 1:04 UTC (permalink / raw)
To: linux-mm, linux-rdma, akpm, jglisse, jgg, hch
Cc: yishaih, linux-kernel, Li Zhijian, stable
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@vger.kernel.org
Fixes: 405506274922 ("mm/hmm: add missing call to hmm_pte_need_fault in HMM_PFN_SPECIAL handling")
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
---
mm/hmm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/hmm.c b/mm/hmm.c
index fad6be2bf072..d324fb1a5352 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -295,10 +295,13 @@ static int hmm_vma_handle_pte(struct mm_walk *walk, unsigned long addr,
goto fault;
/*
+ * Bypass devmap pte such as DAX page when all pfn requested
+ * flags(pfn_req_flags) are fulfilled.
* Since each architecture defines a struct page for the zero page, just
* fall through and treat it like a normal page.
*/
- if (pte_special(pte) && !is_zero_pfn(pte_pfn(pte))) {
+ if (!pte_devmap(pte) && pte_special(pte) &&
+ !is_zero_pfn(pte_pfn(pte))) {
if (hmm_pte_need_fault(hmm_vma_walk, pfn_req_flags, 0)) {
pte_unmap(ptep);
return -EFAULT;
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
2021-08-28 1:04 [PATCH v2] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled Li Zhijian
@ 2021-08-30 7:32 ` Christoph Hellwig
2021-08-30 9:30 ` lizhijian
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2021-08-30 7:32 UTC (permalink / raw)
To: Li Zhijian
Cc: linux-mm, linux-rdma, akpm, jglisse, jgg, hch, yishaih,
linux-kernel, stable
On Sat, Aug 28, 2021 at 09:04:41AM +0800, Li Zhijian wrote:
> + if (!pte_devmap(pte) && pte_special(pte) &&
> + !is_zero_pfn(pte_pfn(pte))) {
Maybe this is a little too superficial and nitpicky, but I find the
ordering of the checks a little strange. Why not do the pte_special
first and then the exlusions from it later?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled
2021-08-30 7:32 ` Christoph Hellwig
@ 2021-08-30 9:30 ` lizhijian
0 siblings, 0 replies; 3+ messages in thread
From: lizhijian @ 2021-08-30 9:30 UTC (permalink / raw)
To: Christoph Hellwig, lizhijian
Cc: linux-mm, linux-rdma, akpm, jglisse, jgg, yishaih, linux-kernel, stable
On 30/08/2021 15:32, Christoph Hellwig wrote:
> On Sat, Aug 28, 2021 at 09:04:41AM +0800, Li Zhijian wrote:
>> + if (!pte_devmap(pte) && pte_special(pte) &&
>> + !is_zero_pfn(pte_pfn(pte))) {
> Maybe this is a little too superficial and nitpicky, but I find the
> ordering of the checks a little strange. Why not do the pte_special
> first and then the exlusions from it later?
>
It sounds good to me, let's update it
Thanks
Zhijian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-30 9:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28 1:04 [PATCH v2] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled Li Zhijian
2021-08-30 7:32 ` Christoph Hellwig
2021-08-30 9:30 ` lizhijian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).