From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751786AbcCHTsy (ORCPT ); Tue, 8 Mar 2016 14:48:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51135 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751459AbcCHTrb (ORCPT ); Tue, 8 Mar 2016 14:47:31 -0500 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= To: akpm@linux-foundation.org, , linux-mm@kvack.org Cc: Linus Torvalds , , Mel Gorman , "H. Peter Anvin" , Peter Zijlstra , Andrea Arcangeli , Johannes Weiner , Larry Woodman , Rik van Riel , Dave Airlie , Brendan Conoboy , Joe Donohue , Christophe Harle , Duncan Poole , Sherry Cheung , Subhash Gutti , John Hubbard , Mark Hairgrove , Lucien Dunning , Cameron Buschardt , Arvind Gopalakrishnan , Haggai Eran , Shachar Raindel , Liran Liss , Roland Dreier , Ben Sander , Greg Stoner , John Bridgman , Michael Mantor , Paul Blinzer , Leonid Shamis , Laurent Morichetti , Alexander Deucher , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= Subject: [PATCH v12 20/29] HMM: handle HMM device page table entry on mirror page table fault and update. Date: Tue, 8 Mar 2016 15:43:13 -0500 Message-Id: <1457469802-11850-21-git-send-email-jglisse@redhat.com> In-Reply-To: <1457469802-11850-1-git-send-email-jglisse@redhat.com> References: <1457469802-11850-1-git-send-email-jglisse@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When faulting or updating the device page table properly handle the case of device memory entry. Signed-off-by: Jérôme Glisse --- mm/hmm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/hmm.c b/mm/hmm.c index a5706d2..9455443 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -616,6 +616,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; @@ -808,6 +815,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