linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@mellanox.com>
To: Ralph Campbell <rcampbell@nvidia.com>
Cc: Jerome Glisse <jglisse@redhat.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Christoph Hellwig <hch@lst.de>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH v2 1/3] mm/hmm: make full use of walk_page_range()
Date: Mon, 21 Oct 2019 18:32:24 +0000	[thread overview]
Message-ID: <20191021183220.GF6285@mellanox.com> (raw)
In-Reply-To: <20191015204814.30099-2-rcampbell@nvidia.com>

On Tue, Oct 15, 2019 at 01:48:12PM -0700, Ralph Campbell wrote:

> +static bool hmm_range_needs_fault(unsigned long addr, unsigned long end,
> +				  const struct hmm_vma_walk *hmm_vma_walk)

This has a very similar name to hmm_range_need_fault(), and seems like
it does the same thing?

> +static int hmm_vma_walk_test(unsigned long start, unsigned long end,
> +			     struct mm_walk *walk)
> +{
> +	struct hmm_vma_walk *hmm_vma_walk = walk->private;
> +	struct hmm_range *range = hmm_vma_walk->range;
> +	struct vm_area_struct *vma = walk->vma;
> +
> +	/* If range is no longer valid, force retry. */
> +	if (!range->valid)
> +		return -EBUSY;
> +
> +	/*
> +	 * Skip vma ranges that don't have struct page backing them or
> +	 * map I/O devices directly.
> +	 */
> +	if (vma->vm_flags & (VM_IO | VM_PFNMAP | VM_MIXEDMAP))
> +		return -EFAULT;
> +
> +	/*
> +	 * If the vma does not allow read access, then assume that it does not
> +	 * allow write access either. HMM does not support architectures
> +	 * that allow write without read.
> +	 */
> +	if (!(vma->vm_flags & VM_READ)) {
> +		/*
> +		 * Check to see if a fault is requested for any page in the
> +		 * range.
> +		 */
> +		if (hmm_range_needs_fault(start, end, hmm_vma_walk))
> +			return -EFAULT;

Is this change to call hmm_range_needs_fault another bug fix?

Jason


  reply	other threads:[~2019-10-21 18:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 20:48 [PATCH v2 0/3] HMM tests and minor fixes Ralph Campbell
2019-10-15 20:48 ` [PATCH v2 1/3] mm/hmm: make full use of walk_page_range() Ralph Campbell
2019-10-21 18:32   ` Jason Gunthorpe [this message]
2019-10-21 20:32     ` Ralph Campbell
2019-10-15 20:48 ` [PATCH v2 2/3] mm/hmm: allow snapshot of the special zero page Ralph Campbell
2019-10-21 18:08   ` Jason Gunthorpe
2019-10-21 20:08     ` Ralph Campbell
2019-10-21 18:49   ` Jerome Glisse
2019-10-21 20:54     ` Ralph Campbell
2019-10-22  2:45       ` Jerome Glisse
2019-10-22 15:05         ` Jason Gunthorpe
2019-10-22 17:06           ` Jerome Glisse
2019-10-22 17:09             ` Jason Gunthorpe
2019-10-22 17:30               ` Jerome Glisse
2019-10-22 17:41                 ` Jason Gunthorpe
2019-10-22 17:52                   ` Jerome Glisse
2019-10-15 20:48 ` [PATCH v2 3/3] mm/hmm/test: add self tests for HMM Ralph Campbell
2019-10-21 18:50   ` Jerome Glisse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191021183220.GF6285@mellanox.com \
    --to=jgg@mellanox.com \
    --cc=hch@lst.de \
    --cc=jglisse@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rcampbell@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox