On Thu, Aug 14, 2025 at 10:42 PM Joel Stanley <j...@jms.id.au> wrote: > > Hi Jesse, > > We had a pretty huge cc list on the thread, I've trimmed it right > back. Feel free to add some people back but keep it focused. > > On Wed, 6 Aug 2025 at 05:42, Jesse Taube <je...@rivosinc.com> wrote: > > > > Add riscv specific selftest for hardhardware breakpoints. > > nit: double hardware > > > These tests are based on: > > tools/testing/selftests/breakpoints/breakpoint_test_arm64.c > > The sefltest didn't build for me. There's a few suggested fixes below. > > > Signed-off-by: Jesse Taube <je...@rivosinc.com> > > --- > > The selftest fails as register_user_hw_breakpoint seemingly does not > > call arch_install_hw_breakpoint. The test also seems to fail on arm64 > > in the same way when I tested it. > > Is this still a problem with your patchset?
Yes > > Do you test in qemu? Can you share your version, command line, etc? Yes. I used buildroot's `qemu_aarch64_virt_defconfig` config and set `BR2_PACKAGE_LINUX_TOOLS_SELFTESTS` and tested with the example command from the boards readme. > > > --- /dev/null > > +++ b/tools/testing/selftests/riscv/breakpoints/Makefile > > @@ -0,0 +1,12 @@ > > +# SPDX-License-Identifier: GPL-2.0 > > +# Copyright (C) 2021 ARM Limited > > +# Originally tools/testing/arm64/abi/Makefile > > CFLAGS += $(KHDR_INCLUDES) > > This adds -isystem to include local headers for the up to date > ptrace.h and elf.h definitions. > > $ make headers oh that's why it wasn't building! Thanks, Jesse Taube > $ make -C tools/testing/selftests CROSS_COMPILE=riscv64-linux-gnu- > ARCH=riscv TARGETS=riscv/breakpoints > make: Entering directory 'tools/testing/selftests' > riscv64-linux-gnu-gcc -static > -otools/testing/selftests/riscv/breakpoints/breakpoint_test > -isystem usr/include -Itools/testing/selftests/../../../tools/include > -D_GNU_SOURCE= breakpoint_test.c > > > + > > +CFLAGS += -I$(top_srcdir)/tools/include > > + > > +TEST_GEN_PROGS := breakpoint_test > > + > > +include ../../lib.mk > > + > > +$(OUTPUT)/breakpoint_test: breakpoint_test.c > > + $(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^ > > diff --git a/tools/testing/selftests/riscv/breakpoints/breakpoint_test.c > > b/tools/testing/selftests/riscv/breakpoints/breakpoint_test.c > > new file mode 100644 > > index 000000000000..faeecc72da12 > > --- /dev/null > > +++ b/tools/testing/selftests/riscv/breakpoints/breakpoint_test.c > > @@ -0,0 +1,246 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/* > > + * Copyright (C) 2016 Google, Inc. > > + * > > + * Original Code by Pavel Labath <lab...@google.com> > > + * > > + * Code modified by Pratyush Anand <pan...@redhat.com> > > + * for testing different byte select for each access size. > > + * Originally tools/testing/selftests/breakpoints/breakpoint_test_arm64.c > > + */ > > + > > +#define _GNU_SOURCE > > + > > +#include <asm/ptrace.h> > > +#include <sys/types.h> > > +#include <sys/wait.h> > > +#include <sys/ptrace.h> > > +#include <sys/param.h> > > +#include <sys/uio.h> > > +#include <stdint.h> > > +#include <stdbool.h> > > +#include <stddef.h> > > +#include <string.h> > > +#include <stdio.h> > > +#include <unistd.h> > > +#include <elf.h> > > This is the wrong elf.h, we want the one with NT_RISCV_HW_BREAK. > > -#include <elf.h> > +#include <linux/elf.h> > > > > +#include <errno.h> > > +#include <signal.h> > > + > > +#include "../../kselftest.h" > > + > > +#define MAX_BP_SIZE 8 > > +