Re: [PATCH v6 5/5] selftests/mm: add UFFDIO_MOVE ioctl test

From: Suren Baghdasaryan
Date: Sun Dec 10 2023 - 20:10:14 EST


On Sun, Dec 10, 2023 at 6:26 AM Mark Brown <broonie@xxxxxxxxxx> wrote:
>
> On Wed, Dec 06, 2023 at 02:36:59AM -0800, Suren Baghdasaryan wrote:
> > 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.
> >
> > Signed-off-by: Suren Baghdasaryan <surenb@xxxxxxxxxx>
> > ---
> > 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(+)
>
> This breaks the build in at least some configurations with separate
> output directories like those used by KernelCI:
>
> make KBUILD_BUILD_USER=KernelCI FORMAT=.xz ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_COMPAT=arm-linux-gnueabihf- CC="ccache aarch64-linux-gnu-gcc" O=/tmp/kci/linux/build -C/tmp/kci/linux -j10 kselftest-gen_tar
>
> (full logs for both arm64 and x86_64 at):
>
> https://storage.kernelci.org/next/master/next-20231208/arm64/defconfig/gcc-10/logs/kselftest.log
> https://storage.kernelci.org/next/master/next-20231208/x86_64/x86_64_defconfig/clang-17/logs/kselftest.log
>
> or tuxmake:
>
> make --silent --keep-going --jobs=16 O=/home/broonie/.cache/tuxmake/builds/25/build INSTALL_PATH=/home/broonie/.cache/tuxmake/builds/25/build/kselftest_install ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CROSS_COMPILE_COMPAT=arm-linux-gnueabihf- kselftest-install
>
> The specific failure:
>
> aarch64-linux-gnu-gcc -Wall -I /tmp/kci/linux/tools/testing/selftests/../../.. -isystem /tmp/kci/linux/build/usr/include uffd-stress.c vm_util.c uffd-common.c -lrt -lpthread -lm -o /tmp/kci/linux/build/kselftest/mm/uffd-stress
> uffd-common.c: In function ‘move_page’:
> uffd-common.c:636:21: error: storage size of ‘uffdio_move’ isn’t known
> 636 | struct uffdio_move uffdio_move;
> | ^~~~~~~~~~~
> uffd-common.c:643:21: error: ‘UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES’ undeclared (first use in this function)
> 643 | uffdio_move.mode = UFFDIO_MOVE_MODE_ALLOW_SRC_HOLES;
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> uffd-common.c:643:21: note: each undeclared identifier is reported only once for each function it appears in
> uffd-common.c:645:17: error: ‘UFFDIO_MOVE’ undeclared (first use in this function); did you mean ‘UFFDIO_COPY’?
> 645 | if (ioctl(ufd, UFFDIO_MOVE, &uffdio_move)) {
> | ^~~~~~~~~~~
> | UFFDIO_COPY
> uffd-common.c:636:21: warning: unused variable ‘uffdio_move’ [-Wunused-variable]
> 636 | struct uffdio_move uffdio_move;
> | ^~~~~~~~~~~

Thanks for reporting! I'll try that later today.
Just to clarify, are you using mm-unstable and if so, has it been
rebased since Friday? There was an update to this patchset in
mm-unstable which Andrew merged on Friday and the failure does look
like something that would happen with the previous version.