[PATCH v11 05/14] HMM: handle HMM device page table entry on mirror page table fault and update.

From: JÃrÃme Glisse
Date: Wed Oct 21 2015 - 16:14:50 EST


When faulting or updating the device page table properly handle the case of
device memory entry.

Signed-off-by: JÃrÃme Glisse <jglisse@xxxxxxxxxx>
---
mm/hmm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/mm/hmm.c b/mm/hmm.c
index 1c81c68..6224131 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -607,6 +607,13 @@ static void hmm_mirror_update_pte(struct hmm_mirror *mirror,
goto out;
}

+ if (hmm_pte_test_valid_dev(hmm_pte)) {
+ *hmm_pte &= event->pte_mask;
+ if (!hmm_pte_test_valid_dev(hmm_pte))
+ hmm_pt_iter_directory_unref(iter);
+ return;
+ }
+
if (!hmm_pte_test_valid_dma(hmm_pte))
return;

@@ -804,6 +811,12 @@ static int hmm_mirror_fault_pmd(pmd_t *pmdp,
ptep = pte_offset_map(pmdp, start);
hmm_pt_iter_directory_lock(iter);
do {
+ if (hmm_pte_test_valid_dev(&hmm_pte[i])) {
+ if (write)
+ hmm_pte_set_write(&hmm_pte[i]);
+ continue;
+ }
+
if (!pte_present(*ptep) ||
(write && !pte_write(*ptep)) ||
pte_protnone(*ptep)) {
--
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/