The patch titled Subject: mm/hmm: clarify fault logic for device private memory has been removed from the -mm tree. Its filename was mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2.patch This patch was dropped because it was folded into mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2.patch ------------------------------------------------------ From: Ralph Campbell <rcampbell@xxxxxxxxxx> Subject: mm/hmm: clarify fault logic for device private memory For device private memory caller of hmm_vma_fault() want to be able to carefully control fault behavior. Update logic to only fault on device private entry if explicitly requested. Before this patch a read only device private CPU page table entry would fault if caller requested write permission without the device private flag set (in caller's flag fault request). After this patch it will only fault if the device private flag is also set. Link: http://lkml.kernel.org/r/20180326213009.2460-3-jglisse@xxxxxxxxxx Signed-off-by: Ralph Campbell <rcampbell@xxxxxxxxxx> Signed-off-by: Jérôme Glisse <jglisse@xxxxxxxxxx> Cc: Evgeny Baskakov <ebaskakov@xxxxxxxxxx> Cc: Mark Hairgrove <mhairgrove@xxxxxxxxxx> Cc: John Hubbard <jhubbard@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- diff -puN mm/hmm.c~mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2 mm/hmm.c --- a/mm/hmm.c~mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2 +++ a/mm/hmm.c @@ -390,18 +390,22 @@ static inline void hmm_pte_need_fault(co /* We aren't ask to do anything ... */ if (!(pfns & range->flags[HMM_PFN_VALID])) return; + /* If this is device memory than only fault if explicitly requested */ + if ((cpu_flags & range->flags[HMM_PFN_DEVICE_PRIVATE])) { + /* Do we fault on device memory ? */ + if (pfns & range->flags[HMM_PFN_DEVICE_PRIVATE]) { + *write_fault = pfns & range->flags[HMM_PFN_WRITE]; + *fault = true; + } + return; + } + /* If CPU page table is not valid then we need to fault */ - *fault = cpu_flags & range->flags[HMM_PFN_VALID]; + *fault = !(cpu_flags & range->flags[HMM_PFN_VALID]); /* Need to write fault ? */ if ((pfns & range->flags[HMM_PFN_WRITE]) && !(cpu_flags & range->flags[HMM_PFN_WRITE])) { - *fault = *write_fault = false; - return; - } - /* Do we fault on device memory ? */ - if ((pfns & range->flags[HMM_PFN_DEVICE_PRIVATE]) && - (cpu_flags & range->flags[HMM_PFN_DEVICE_PRIVATE])) { - *write_fault = pfns & range->flags[HMM_PFN_WRITE]; + *write_fault = true; *fault = true; } } _ Patches currently in -mm which might be from rcampbell@xxxxxxxxxx are mm-hmm-documentation-editorial-update-to-hmm-documentation.patch mm-hmm-hmm-should-have-a-callback-before-mm-is-destroyed-v3.patch mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2.patch mm-migrate-properly-preserve-write-attribute-in-special-migrate-entry.patch ��.n��������+%������w��{.n����������ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f