[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b3c882d2-0135-430c-8179-784f78be0902@arm.com>
Date: Fri, 1 Dec 2023 09:29:23 +0000
From: Ryan Roberts <ryan.roberts@....com>
To: Suren Baghdasaryan <surenb@...gle.com>, akpm@...ux-foundation.org
Cc: viro@...iv.linux.org.uk, brauner@...nel.org, shuah@...nel.org,
aarcange@...hat.com, lokeshgidra@...gle.com, peterx@...hat.com,
david@...hat.com, hughd@...gle.com, mhocko@...e.com,
axelrasmussen@...gle.com, rppt@...nel.org, willy@...radead.org,
Liam.Howlett@...cle.com, jannh@...gle.com, zhangpeng362@...wei.com,
bgeffon@...gle.com, kaleshsingh@...gle.com, ngeoffray@...gle.com,
jdduke@...gle.com, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v5 5/5] selftests/mm: add UFFDIO_MOVE ioctl test
On 21/11/2023 17:16, Suren Baghdasaryan wrote:
> Add tests for new UFFDIO_MOVE ioctl which uses uffd to move source
> into destination buffer while checking the contents of both after
> the move. After the operation the content of the destination buffer
> should match the original source buffer's content while the source
> buffer should be zeroed. Separate tests are designed for PMD aligned and
> unaligned cases because they utilize different code paths in the kernel.
>
> Signed-off-by: Suren Baghdasaryan <surenb@...gle.com>
> ---
> tools/testing/selftests/mm/uffd-common.c | 24 +++
> tools/testing/selftests/mm/uffd-common.h | 1 +
> tools/testing/selftests/mm/uffd-unit-tests.c | 189 +++++++++++++++++++
> 3 files changed, 214 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/uffd-common.c b/tools/testing/selftests/mm/uffd-common.c
> index fb3bbc77fd00..b0ac0ec2356d 100644
> --- a/tools/testing/selftests/mm/uffd-common.c
> +++ b/tools/testing/selftests/mm/uffd-common.c
> @@ -631,6 +631,30 @@ int copy_page(int ufd, unsigned long offset, bool wp)
> return __copy_page(ufd, offset, false, wp);
> }
>
> +int move_page(int ufd, unsigned long offset, unsigned long len)
> +{
> + struct uffdio_move uffdio_move;
> +
> + if (offset + len > nr_pages * page_size)
> + err("unexpected offset %lu and length %lu\n", offset, len);
> + uffdio_move.dst = (unsigned long) area_dst + offset;
> + uffdio_move.src = (unsigned long) area_src + offset;
> + uffdio_move.len = len;
> + uffdio_move.mode = UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES;
> + uffdio_move.move = 0;
> + if (ioctl(ufd, UFFDIO_MOVE, &uffdio_move)) {
> + /* real retval in uffdio_move.move */
> + if (uffdio_move.move != -EEXIST)
> + err("UFFDIO_MOVE error: %"PRId64,
> + (int64_t)uffdio_move.move);
Hi Suren,
FYI this error is triggering in mm-unstable (715b67adf4c8):
Testing move-pmd on anon... ERROR: UFFDIO_MOVE error: -16 (errno=16,
@uffd-common.c:648)
I'm running in a VM on Apple M2 (arm64). I haven't debugged any further, but
happy to go deeper if you can direct.
Thanks,
Ryan
> + wake_range(ufd, uffdio_move.dst, len);
> + } else if (uffdio_move.move != len) {
> + err("UFFDIO_MOVE error: %"PRId64, (int64_t)uffdio_move.move);
> + } else
> + return 1;
> + return 0;
> +}
Powered by blists - more mailing lists