linux/mm/gup_test.h
David Hildenbrand c77369b437 mm/gup_test: start/stop/read functionality for PIN LONGTERM test
We want an easy way to take a R/O or R/W longterm pin on a range and be
able to observe the content of the pinned pages, so we can properly test
how longterm puns interact with our COW logic.

[david@redhat.com: silence a warning on 32-bit]
  Link: https://lkml.kernel.org/r/74adbb51-6e33-f636-8a9c-2ad87bd9007e@redhat.com
[yang.lee@linux.alibaba.com: ./mm/gup_test.c:281:2-3: Unneeded semicolon]
  Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2455
  Link: https://lkml.kernel.org/r/20221020024035.113619-1-yang.lee@linux.alibaba.com
Link: https://lkml.kernel.org/r/20220927110120.106906-7-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Christoph von Recklinghausen <crecklin@redhat.com>
Cc: Don Dutile <ddutile@redhat.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nadav Amit <namit@vmware.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2022-11-08 17:37:15 -08:00

46 lines
1.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __GUP_TEST_H
#define __GUP_TEST_H
#include <linux/types.h>
#define GUP_FAST_BENCHMARK _IOWR('g', 1, struct gup_test)
#define PIN_FAST_BENCHMARK _IOWR('g', 2, struct gup_test)
#define PIN_LONGTERM_BENCHMARK _IOWR('g', 3, struct gup_test)
#define GUP_BASIC_TEST _IOWR('g', 4, struct gup_test)
#define PIN_BASIC_TEST _IOWR('g', 5, struct gup_test)
#define DUMP_USER_PAGES_TEST _IOWR('g', 6, struct gup_test)
#define PIN_LONGTERM_TEST_START _IOW('g', 7, struct pin_longterm_test)
#define PIN_LONGTERM_TEST_STOP _IO('g', 8)
#define PIN_LONGTERM_TEST_READ _IOW('g', 9, __u64)
#define GUP_TEST_MAX_PAGES_TO_DUMP 8
#define GUP_TEST_FLAG_DUMP_PAGES_USE_PIN 0x1
struct gup_test {
__u64 get_delta_usec;
__u64 put_delta_usec;
__u64 addr;
__u64 size;
__u32 nr_pages_per_call;
__u32 gup_flags;
__u32 test_flags;
/*
* Each non-zero entry is the number of the page (1-based: first page is
* page 1, so that zero entries mean "do nothing") from the .addr base.
*/
__u32 which_pages[GUP_TEST_MAX_PAGES_TO_DUMP];
};
#define PIN_LONGTERM_TEST_FLAG_USE_WRITE 1
#define PIN_LONGTERM_TEST_FLAG_USE_FAST 2
struct pin_longterm_test {
__u64 addr;
__u64 size;
__u32 flags;
};
#endif /* __GUP_TEST_H */