Skip to contentSkip to conversation

selftests-mm-add-uffdio_move-ioctl-test.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Dec 29, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests/mm: add UFFDIO_MOVE ioctl test
has been removed from the -mm tree. Its filename was
selftests-mm-add-uffdio_move-ioctl-test.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Suren Baghdasaryan <[email protected]>
Subject: selftests/mm: add UFFDIO_MOVE ioctl test
Date: Wed, 6 Dec 2023 02:36:59 -0800

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.

Cc Al Viro <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Axel Rasmussen <[email protected]>
Cc Brian Geffon <[email protected]>
Cc Christian Brauner <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Jann Horn <[email protected]>
Cc Kalesh Singh <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lokesh Gidra <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mike Rapoport (IBM) <[email protected]>
Cc Nicolas Geoffray <[email protected]>
Cc Peter Xu <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Shuah Khan <[email protected]>
Cc ZhangPeng <[email protected]>

---

 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(+)
tools/testing/selftests/mm/uffd-common.c renamed from tools/testing/selftests/mm/uffd-common.c~selftests-mm-add-uffdio_move-ioctl-test +24 -0
@@ -631,6 +631,30 @@ int copy_page(int ufd, unsigned long off
 	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);
+		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;
+}
+
 int uffd_open_dev(unsigned int flags)
 {
 	int fd, uffd;
tools/testing/selftests/mm/uffd-common.h renamed from tools/testing/selftests/mm/uffd-common.h~selftests-mm-add-uffdio_move-ioctl-test +1 -0
@@ -119,6 +119,7 @@ void wp_range(int ufd, __u64 start, __u6
 void uffd_handle_page_fault(struct uffd_msg *msg, struct uffd_args *args);
 int __copy_page(int ufd, unsigned long offset, bool retry, bool wp);
 int copy_page(int ufd, unsigned long offset, bool wp);
+int move_page(int ufd, unsigned long offset, unsigned long len);
 void *uffd_poll_thread(void *arg);
 
 int uffd_open_dev(unsigned int flags);
tools/testing/selftests/mm/uffd-unit-tests.c renamed from tools/testing/selftests/mm/uffd-unit-tests.c~selftests-mm-add-uffdio_move-ioctl-test +189 -0

207 lines not on this page · raw message

_

Patches currently in -mm which might be from [email protected] are