Re: [PATCH bpf-next 0/5] Support local vmtest for riscv64

Eduard Zingerman
2024-04-02T23:40:23Z

On Sat, 2024-03-30 at 18:12 +0800, Pu Lehui wrote:
[...]

> > Looks like I won't be able to test this patch-set, unless you have
> > some writeup on how to create a riscv64 dev environment at hand.
> > Sorry for the noise
>
> Yeah, environmental issues are indeed a developer's nightmare. I will
> try to do something for the newcomers of riscv64 bpf. At present, I have
> simply built a docker local vmtest environment [0] based on Bjorn's
> riscv-cross-builder. We can directly run vmtest within this environment.
> Hopefully it will help.
>
> Link: https://github.com/pulehui/riscv-cross-builder/tree/vmtest [0]

Hi Pu,

Thank you for sharing the docker file, I've managed to run the tests
using it. In order to avoid creating files with root permissions I had
to add the following lines at the end of the Dockerfile:

+ RUN useradd --no-create-home --uid 1000 eddy
+ RUN passwd -d eddy
+ RUN echo 'eddy ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+ # vmtest.sh does 'mount -o loop',
+ # ensure there is a loop device in the container
+ RUN mknod /dev/loop0 b 7 20

Where 'eddy' is my local user with UID 1000.
Probably this should be made more generic.
I used the following command to start the container:

docker run -ti -u 1000:1000 \
--rm -v <path-to-kernel-dir>:/workspace \
-v <path-to-rootfs-image-dir>:/rootfs \
--privileged ubuntu-vmtest:latest /bin/bash

Also, I had to add '-d /rootfs/bpf_selftests' option for vmtest.sh in
order to avoid polluting user directory inside the container.
Maybe OUTPUT_DIR for vmtest.sh should be mounted as a separate volume.

I agree with Daniel, it would be great to document all of this
somewhere in the repo (or even scripted somehow).

Using the specified DENYLIST I get the following stats for test_progs:

#3/2 arena_htab/arena_htab_asm:FAIL
#3 arena_htab:FAIL
#95 get_branch_snapshot:FAIL
#172/1 perf_branches/perf_branches_hw:FAIL
#172 perf_branches:FAIL
#434/3 verifier_arena/basic_alloc3:FAIL
#434 verifier_arena:FAIL
Summary: 531/3581 PASSED, 64 SKIPPED, 4 FAILED

Tested-by: Eduard Zingerman <eddyz87@gmail.com>

> PS: Since the current rootfs of riscv64 is not in the INDEX, I simply
> modified vmtest.sh to support local rootfs.

Could you please add this change to the patch-set? …