Re: [PATCH v3 3/3] mm/hmm/test: add self tests for HMM

From: Qian Cai
Date: Wed Oct 30 2019 - 14:34:47 EST


On Tue, 2019-10-29 at 17:58 +0000, Jason Gunthorpe wrote:
> On Wed, Oct 23, 2019 at 12:55:15PM -0700, Ralph Campbell wrote:
> > Add self tests for HMM.
> >
> > Signed-off-by: Ralph Campbell <rcampbell@xxxxxxxxxx>
> > ---
> > MAINTAINERS | 3 +
> > drivers/char/Kconfig | 11 +
> > drivers/char/Makefile | 1 +
> > drivers/char/hmm_dmirror.c | 1566 ++++++++++++++++++++++++
> > include/Kbuild | 1 +
> > include/uapi/linux/hmm_dmirror.h | 74 ++
> > tools/testing/selftests/vm/.gitignore | 1 +
> > tools/testing/selftests/vm/Makefile | 3 +
> > tools/testing/selftests/vm/config | 3 +
> > tools/testing/selftests/vm/hmm-tests.c | 1311 ++++++++++++++++++++
> > tools/testing/selftests/vm/run_vmtests | 16 +
> > tools/testing/selftests/vm/test_hmm.sh | 97 ++
> > 12 files changed, 3087 insertions(+)
> > create mode 100644 drivers/char/hmm_dmirror.c
> > create mode 100644 include/uapi/linux/hmm_dmirror.h
> > create mode 100644 tools/testing/selftests/vm/hmm-tests.c
> > create mode 100755 tools/testing/selftests/vm/test_hmm.sh
>
> This is really big, it would be nice to get a comment from the various
> kernel testing folks if this approach makes sense with the test
> frameworks. Do we have other drivers that are only intended to be used
> by selftests?
>
> Frankly, I'm not super excited about the idea of a 'test driver', it
> seems more logical for testing to have some way for a test harness to
> call hmm_range_fault() under various conditions and check the results?

Not a big fan of those selftests either. Could it be saner to use the new KUnit
framework for those instead?