+ mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/hmm: clarify fault logic for device private memory
has been added to the -mm tree.  Its filename is
     mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
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>
---

 mm/hmm.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

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-fix.patch
mm-hmm-use-device-driver-encoding-for-hmm-pfn-v2-fix-2.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux