Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2296188yba; Fri, 19 Apr 2019 16:37:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7kGi/BXKdXik8ksP6IXjpTHqWWaOFVgcrBYgONaVe/BqVzcEnn3cfrD+uQYoq4IStU674 X-Received: by 2002:a63:7988:: with SMTP id u130mr6457460pgc.289.1555717030518; Fri, 19 Apr 2019 16:37:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555717030; cv=none; d=google.com; s=arc-20160816; b=LBRSArLNNfh+XP2isOWMTxxiyuZ2LdcTSL5FjiaB9+p5fkOjnnexEclnxkfr8n80hY GJff5fQH2+Xe4DVFPkKgMN2Xe71/KRnA+fwytW2Gm58Iwh/sB1ruOEm4Ykkt+oXM9ep8 NTS3RwyhW/kMyuMI5HPZoHSVZizCLu3w1HIwPQajIjYnsrJeI3OAFypkVamuOWLKNBll XIIUqfjWXT8sYxswo/WBRaOmoC304QMniCanu5HFTMHZW1Bnp86hd9nr88SOCn95S2u7 m3TJ8poFxdg+elNSrGLHKFhBgxqqYMh7+/Uk9j3Xoqhdls7jl/gOnR1zgFUj5z3COJaX V1XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=CfvcO8vti3twykYANcJx0ucggxeHBxOuIW3oPk1HmoU=; b=smZaz4T7IroZaHVtjJaO0Ms9IGMiZh4BmLNGlWstjSreJRJ2cRRfZug3XmGA4BqZBW wrFGQSHURPnHGZw0wiYGY0LoL/GIp45Wv20CdJFdPlt5XTQgJVfsYirWsP3NTnHIiV6P s8zwwx938T0EmIW9UprBi9pSd9Pogxp9NUv0xOpFbcsunMf07uWVhEKoSSodL/npPn47 zUPzYSdyXZ52GIcGXuUuWeLz0Mngv9AEVfiJCHbS49UoFb+G5rRixEgn80G1O1SQrU6/ 3wZaUH2Rhj/ebnyyDshrUDrZ0tv3eyO9RVhaIJxGnhLnpSliAQiE7uQkQ+FyQuEj5r2n frtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=BCXKlsgU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14si6259295plo.287.2019.04.19.16.36.54; Fri, 19 Apr 2019 16:37:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=BCXKlsgU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726138AbfDSXf4 (ORCPT + 99 others); Fri, 19 Apr 2019 19:35:56 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:3553 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725817AbfDSXf4 (ORCPT ); Fri, 19 Apr 2019 19:35:56 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 19 Apr 2019 16:35:33 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Fri, 19 Apr 2019 16:35:55 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Fri, 19 Apr 2019 16:35:55 -0700 Received: from rcampbell-dev.nvidia.com (10.124.1.5) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 19 Apr 2019 23:35:55 +0000 From: To: CC: , Ralph Campbell , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Ira Weiny , John Hubbard , Dan Williams , Arnd Bergmann , Balbir Singh , Dan Carpenter , Matthew Wilcox , Souptick Joarder , Andrew Morton Subject: [RESEND PATCH] mm/hmm: Fix initial PFN for hugetlbfs pages Date: Fri, 19 Apr 2019 16:35:36 -0700 Message-ID: <20190419233536.8080-1-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1555716933; bh=CfvcO8vti3twykYANcJx0ucggxeHBxOuIW3oPk1HmoU=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Transfer-Encoding; b=BCXKlsgUqrl6trofbhM0tSZXI9Ex3bUSnmbrWJ+XWphmX85PVCYhlL1oVgW0dUltN o4+MmXNhN9EzOrChpQlAA3PbPw8tCZD7hRClEFkwkRbylXBAqJWM7qszyPzEtQCGNp iY00x/VC0wPz5SiEJJ1WYeaxqCfqaxg9axv7An8eLSc2NBSzFuVje14hz7IZjMQHxL QrMjth1ijfqVB66nUMiyqDSKeERIdu2zHdtuceWHJIGPcqR66Hzxjs0aiVZn0T+I4/ uDsg1SDx+WwlhGrbNF3Xuy9lzqg5VIK0FbZcM/Pnm6c9K+v14Ji0+vTELzx4CbHzdw zKsp12F92dSpw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ralph Campbell The mmotm patch [1] adds hugetlbfs support for HMM but the initial PFN used to fill the HMM range->pfns[] array doesn't properly compute the starting PFN offset. This can be tested by running test-hugetlbfs-read from [2]. Fix the PFN offset by adjusting the page offset by the device's page size. Andrew, this should probably be squashed into Jerome's patch. [1] https://marc.info/?l=3Dlinux-mm&m=3D155432003506068&w=3D2 ("mm/hmm: mirror hugetlbfs (snapshoting, faulting and DMA mapping)") [2] https://gitlab.freedesktop.org/glisse/svm-cl-tests Signed-off-by: Ralph Campbell Cc: J=C3=A9r=C3=B4me Glisse Cc: Ira Weiny Cc: John Hubbard Cc: Dan Williams Cc: Arnd Bergmann Cc: Balbir Singh Cc: Dan Carpenter Cc: Matthew Wilcox Cc: Souptick Joarder Cc: Andrew Morton --- mm/hmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hmm.c b/mm/hmm.c index def451a56c3e..fcf8e4fb5770 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -868,7 +868,7 @@ static int hmm_vma_walk_hugetlb_entry(pte_t *pte, unsig= ned long hmask, goto unlock; } =20 - pfn =3D pte_pfn(entry) + (start & mask); + pfn =3D pte_pfn(entry) + ((start & mask) >> range->page_shift); for (; addr < end; addr +=3D size, i++, pfn +=3D pfn_inc) range->pfns[i] =3D hmm_device_entry_from_pfn(range, pfn) | cpu_flags; --=20 2.20.1