[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211207193139.GK6385@nvidia.com>
Date: Tue, 7 Dec 2021 15:31:39 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Alex Sierra <alex.sierra@....com>
Cc: akpm@...ux-foundation.org, Felix.Kuehling@....com,
linux-mm@...ck.org, rcampbell@...dia.com,
linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
hch@....de, jglisse@...hat.com, apopple@...dia.com,
willy@...radead.org
Subject: Re: [PATCH v2 11/11] tools: add hmm gup test for long term pinned
device pages
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@....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
Powered by blists - more mailing lists