linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: Ralph Campbell <rcampbell@nvidia.com>
Cc: linux-mm@kvack.org, Felix Kuehling <felix.kuehling@amd.com>,
	Philip Yang <Philip.Yang@amd.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 2/2] mm/hmm: add a test for cross device private faults
Date: Tue, 26 Jul 2022 11:38:55 +1000	[thread overview]
Message-ID: <87ilnkabzn.fsf@nvdebian.thelocal> (raw)
In-Reply-To: <20220725183615.4118795-3-rcampbell@nvidia.com>


Reviewed-by: Alistair Popple <apopple@nvidia.com>

Ralph Campbell <rcampbell@nvidia.com> writes:

> Add a simple test case for when hmm_range_fault() is called with the
> HMM_PFN_REQ_FAULT flag and a device private PTE is found for a device
> other than the hmm_range::dev_private_owner. This should cause the
> page to be faulted back to system memory from the other device and the
> PFN returned in the output array.
>
> Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
> ---
>  tools/testing/selftests/vm/hmm-tests.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/vm/hmm-tests.c b/tools/testing/selftests/vm/hmm-tests.c
> index 203323967b50..a5ce7cc2e7aa 100644
> --- a/tools/testing/selftests/vm/hmm-tests.c
> +++ b/tools/testing/selftests/vm/hmm-tests.c
> @@ -1520,9 +1520,19 @@ TEST_F(hmm2, double_map)
>  	for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i)
>  		ASSERT_EQ(ptr[i], i);
>
> -	/* Punch a hole after the first page address. */
> -	ret = munmap(buffer->ptr + self->page_size, self->page_size);
> +	/* Migrate pages to device 1 and try to read from device 0. */
> +	ret = hmm_dmirror_cmd(self->fd1, HMM_DMIRROR_MIGRATE, buffer, npages);
> +	ASSERT_EQ(ret, 0);
> +	ASSERT_EQ(buffer->cpages, npages);
> +
> +	ret = hmm_dmirror_cmd(self->fd0, HMM_DMIRROR_READ, buffer, npages);
>  	ASSERT_EQ(ret, 0);
> +	ASSERT_EQ(buffer->cpages, npages);
> +	ASSERT_EQ(buffer->faults, 1);
> +
> +	/* Check what device 0 read. */
> +	for (i = 0, ptr = buffer->mirror; i < size / sizeof(*ptr); ++i)
> +		ASSERT_EQ(ptr[i], i);
>
>  	hmm_buffer_free(buffer);
>  }


  reply	other threads:[~2022-07-26  1:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 18:36 [PATCH v2 0/2] mm/hmm: fault non-owner device private entries Ralph Campbell
2022-07-25 18:36 ` [PATCH v2 1/2] " Ralph Campbell
2022-07-26  1:26   ` Alistair Popple
2022-07-26 16:51     ` Ralph Campbell
2022-07-26 19:06       ` Andrew Morton
2022-07-26 20:59   ` John Hubbard
2022-07-25 18:36 ` [PATCH v2 2/2] mm/hmm: add a test for cross device private faults Ralph Campbell
2022-07-26  1:38   ` Alistair Popple [this message]
2022-07-26 21:03   ` John Hubbard
2022-07-26 21:14     ` Ralph Campbell

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=87ilnkabzn.fsf@nvdebian.thelocal \
    --to=apopple@nvidia.com \
    --cc=Philip.Yang@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=felix.kuehling@amd.com \
    --cc=jgg@nvidia.com \
    --cc=linux-mm@kvack.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