Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2584196yba; Mon, 22 Apr 2019 09:19:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsIVnjggHmWD7aHtzoy9nnaOsbpzhqJ3SBETX+b7LYHasO0pxdCJiedeHbdKWk4VUHHiQ6 X-Received: by 2002:aa7:8458:: with SMTP id r24mr2498139pfn.231.1555949949629; Mon, 22 Apr 2019 09:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555949949; cv=none; d=google.com; s=arc-20160816; b=THEMyJ7gQy4f3KAk2R46EpyQSglea2jiFt1Rss8irCIWPJ+BIt1qcXy0/N3IqpAcAx t8iM+MVMdwn0dZvTbSVTyJVrnpO5cSvdu5Ro+1HEnCXXCa3EH2c+ZBneDq7MMFyPG3BY tcrGMhjHSuckyfufFXh8wuy5tt/TzY32IqDf88PyWtC9nFmrOyoeby04QVK1n/YkQvLX IFjAdZjBhAtC6q7zalz3BIc0YAp45C3q2iVUh63pv8+j4+75uBQYlyVSGYLyaoaxAMLG IIsd6uGF0kesQP88lBouyRZQ9egoOci8YdpQQ2zvXCdZ/RL7OblA7zHkyVkSs6SSKFCF 0gLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=YBrjvnQnYPYeAwmo0xvknuKZqa8tuoNbw4Ef9y3Vo5U=; b=XUa4KjwCjgVgvyUACwojY/43mccB5kpkOb9Jy8aud5fhmSRVGsqfZL63KYoviQ4ZKD E1oQLqWF4pehMQVY6nZiS1ZeUDPAHxYGj6apnTIPu9p7DMf+IfKBNL5zdXCmGyJW1Ktc yNyAGzwvvw+31pzFlCwXfLHOawrIEM17TFYjPMU3jjJQdnUK59ocmgTEubM3rM0eZUhf wMO5Jmu6bShG2O8zN3JM2SC2H1p5K/Upu76pAOiDdn8Yng40wGlmgR+nREv5nAhvgoBX AvLjWwJGmjWHAqz6bJ6xK9tmJRjFuca4kcxC8f3FJ4yRs0kWMkde+Fed7DFRvSsWQ43m XkxQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 192si1111240pgc.200.2019.04.22.09.18.53; Mon, 22 Apr 2019 09:19:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727927AbfDVOzw (ORCPT + 99 others); Mon, 22 Apr 2019 10:55:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35426 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVOzv (ORCPT ); Mon, 22 Apr 2019 10:55:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 704A881F0F; Mon, 22 Apr 2019 14:55:51 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.236]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 401B7608E4; Mon, 22 Apr 2019 14:55:50 +0000 (UTC) Date: Mon, 22 Apr 2019 10:55:48 -0400 From: Jerome Glisse To: rcampbell@nvidia.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ira Weiny , John Hubbard , Dan Williams , Arnd Bergmann , Balbir Singh , Dan Carpenter , Matthew Wilcox , Souptick Joarder , Andrew Morton Subject: Re: [RESEND PATCH] mm/hmm: Fix initial PFN for hugetlbfs pages Message-ID: <20190422145548.GC3450@redhat.com> References: <20190419233536.8080-1-rcampbell@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190419233536.8080-1-rcampbell@nvidia.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 22 Apr 2019 14:55:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 19, 2019 at 04:35:36PM -0700, rcampbell@nvidia.com wrote: > 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=linux-mm&m=155432003506068&w=2 > ("mm/hmm: mirror hugetlbfs (snapshoting, faulting and DMA mapping)") > [2] https://gitlab.freedesktop.org/glisse/svm-cl-tests > > Signed-off-by: Ralph Campbell Good catch. Reviewed-by: J?r?me Glisse > Cc: J?r?me 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, unsigned long hmask, > goto unlock; > } > > - pfn = pte_pfn(entry) + (start & mask); > + pfn = pte_pfn(entry) + ((start & mask) >> range->page_shift); > for (; addr < end; addr += size, i++, pfn += pfn_inc) > range->pfns[i] = hmm_device_entry_from_pfn(range, pfn) | > cpu_flags; > -- > 2.20.1 >