On Mon, Dec 06, 2021 at 12:52:51PM -0600, Alex Sierra wrote:
The intention is to test device coherent type pages that have been called through get user pages with PIN_LONGTERM flag set.
Signed-off-by: Alex Sierra alex.sierra@amd.com tools/testing/selftests/vm/Makefile | 2 +- tools/testing/selftests/vm/hmm-tests.c | 81 ++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile index d9605bd10f2d..527a7bfd80bd 100644 +++ b/tools/testing/selftests/vm/Makefile @@ -141,7 +141,7 @@ $(OUTPUT)/mlock-random-test $(OUTPUT)/memfd_secret: LDLIBS += -lcap
$(OUTPUT)/gup_test: ../../../../mm/gup_test.h
-$(OUTPUT)/hmm-tests: local_config.h +$(OUTPUT)/hmm-tests: local_config.h ../../../../mm/gup_test.h
# HMM_EXTRA_LIBS may get set in local_config.mk, or it may be left empty. $(OUTPUT)/hmm-tests: LDLIBS += $(HMM_EXTRA_LIBS) diff --git a/tools/testing/selftests/vm/hmm-tests.c b/tools/testing/selftests/vm/hmm-tests.c index 8eb81dfba4b3..9a0b7e44a674 100644 +++ b/tools/testing/selftests/vm/hmm-tests.c @@ -36,6 +36,7 @@
- in the usual include/uapi/... directory.
*/ #include "../../../../lib/test_hmm_uapi.h" +#include "../../../../mm/gup_test.h"
struct hmm_buffer { void *ptr; @@ -60,6 +61,8 @@ enum { #define NTIMES 10
#define ALIGN(x, a) (((x) + (a - 1)) & (~((a) - 1))) +/* Just the flags we need, copied from mm.h: */ +#define FOLL_WRITE 0x01 /* check pte is writable */
This is so fragile, you should have a dedicated flag here for asking for this of PIN_LONGTERM_BENCHMARK
Jason