public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi
@ 2026-03-10  1:52 Charlie Jenkins via B4 Relay
  2026-03-10  1:52 ` [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro Charlie Jenkins via B4 Relay
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Charlie Jenkins via B4 Relay @ 2026-03-10  1:52 UTC (permalink / raw)
  To: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta
  Cc: linux-kselftest, linux-riscv, linux-kernel, Charlie Jenkins

There are a couple of compilation issues of the riscv selftests.
Coincidentally two of the issues are independent problems with not
including the header that includes the BIT() macro and the other issue
is from checkpatch incorrectly suggesting to remove non-redundant
braces.

Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
Changes in v2:
- Fix compilation issue reported by kernel test bot and Sergey
- Link to v1: https://lore.kernel.org/r/20260305-fix_selftests-v1-0-61b62d23500b@gmail.com

---
Charlie Jenkins (4):
      selftests: riscv: Add definition of BIT() macro
      selftests: riscv: Add braces around EXPECT_EQ()
      riscv: ptrace: Fix BIT() compilation issues
      selftests: riscv: Add license to cfi selftest

 arch/riscv/include/uapi/asm/ptrace.h                     |  1 +
 tools/testing/selftests/riscv/cfi/Makefile               |  2 ++
 tools/testing/selftests/riscv/vector/Makefile            |  7 +++++--
 tools/testing/selftests/riscv/vector/validate_v_ptrace.c | 16 ++++++++++------
 4 files changed, 18 insertions(+), 8 deletions(-)
---
base-commit: c107785c7e8dbabd1c18301a1c362544b5786282
change-id: ${change-id}

- Charlie



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro
  2026-03-10  1:52 [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Charlie Jenkins via B4 Relay
@ 2026-03-10  1:52 ` Charlie Jenkins via B4 Relay
  2026-03-10  8:18   ` Sergey Matyukevich
  2026-03-21  0:53   ` Paul Walmsley
  2026-03-10  1:52 ` [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ() Charlie Jenkins via B4 Relay
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 16+ messages in thread
From: Charlie Jenkins via B4 Relay @ 2026-03-10  1:52 UTC (permalink / raw)
  To: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta
  Cc: linux-kselftest, linux-riscv, linux-kernel, Charlie Jenkins

From: Charlie Jenkins <thecharlesjenkins@gmail.com>

The BIT() macros is used by the validate_v_ptrace() test case, but not
defined. Include linux/bits.h to pull in this definition. To ensure that
the header in the kernel source is used, add tools/include to the header
search path.

Fixes: 30eb191c895b ("selftests: riscv: verify ptrace rejects invalid vector csr inputs")
Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
 tools/testing/selftests/riscv/vector/Makefile            | 7 +++++--
 tools/testing/selftests/riscv/vector/validate_v_ptrace.c | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/riscv/vector/Makefile b/tools/testing/selftests/riscv/vector/Makefile
index 326dafd739bf..f74a3aa63c87 100644
--- a/tools/testing/selftests/riscv/vector/Makefile
+++ b/tools/testing/selftests/riscv/vector/Makefile
@@ -2,6 +2,9 @@
 # Copyright (C) 2021 ARM Limited
 # Originally tools/testing/arm64/abi/Makefile
 
+NO_LIBC_CFLAGS := $(CFLAGS)
+CFLAGS += -I$(top_srcdir)/tools/include
+
 TEST_GEN_PROGS := v_initval vstate_prctl vstate_ptrace validate_v_ptrace
 TEST_GEN_PROGS_EXTENDED := vstate_exec_nolibc v_exec_initval_nolibc
 TEST_GEN_LIBS := v_helpers.c sys_hwprobe.c
@@ -21,14 +24,14 @@ $(OUTPUT)/vstate_prctl: vstate_prctl.c $(OUTPUT)/sys_hwprobe.o $(OUTPUT)/v_helpe
 
 $(OUTPUT)/vstate_exec_nolibc: vstate_exec_nolibc.c
 	$(CC) -nostdlib -static -include ../../../../include/nolibc/nolibc.h \
-		-Wall $(CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
+		-Wall $(NO_LIBC_CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
 
 $(OUTPUT)/v_initval: v_initval.c $(OUTPUT)/sys_hwprobe.o $(OUTPUT)/v_helpers.o
 	$(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^
 
 $(OUTPUT)/v_exec_initval_nolibc: v_exec_initval_nolibc.c
 	$(CC) -nostdlib -static -include ../../../../include/nolibc/nolibc.h \
-		-Wall $(CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
+		-Wall $(NO_LIBC_CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
 
 $(OUTPUT)/vstate_ptrace: vstate_ptrace.c $(OUTPUT)/sys_hwprobe.o $(OUTPUT)/v_helpers.o
 	$(CC) -static -o$@ $(CFLAGS) $(LDFLAGS) $^
diff --git a/tools/testing/selftests/riscv/vector/validate_v_ptrace.c b/tools/testing/selftests/riscv/vector/validate_v_ptrace.c
index 3589549f7228..257de36274e9 100644
--- a/tools/testing/selftests/riscv/vector/validate_v_ptrace.c
+++ b/tools/testing/selftests/riscv/vector/validate_v_ptrace.c
@@ -6,6 +6,7 @@
 #include <unistd.h>
 #include <errno.h>
 
+#include <linux/bits.h>
 #include <linux/ptrace.h>
 #include <linux/elf.h>
 

-- 
2.52.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ()
  2026-03-10  1:52 [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Charlie Jenkins via B4 Relay
  2026-03-10  1:52 ` [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro Charlie Jenkins via B4 Relay
@ 2026-03-10  1:52 ` Charlie Jenkins via B4 Relay
  2026-03-10  3:50   ` Joe Perches
                     ` (2 more replies)
  2026-03-10  1:52 ` [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues Charlie Jenkins via B4 Relay
                   ` (2 subsequent siblings)
  4 siblings, 3 replies; 16+ messages in thread
From: Charlie Jenkins via B4 Relay @ 2026-03-10  1:52 UTC (permalink / raw)
  To: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta
  Cc: linux-kselftest, linux-riscv, linux-kernel, Charlie Jenkins

From: Charlie Jenkins <thecharlesjenkins@gmail.com>

EXPECT_EQ() expands to multiple lines, breaking up one-line if
statements. This issue was not present in the patch on the mailing list
but was instead introduced by the maintainer when attempting to fix up
checkpatch warnings. Add braces around EXPECT_EQ() to avoid the error
even though checkpatch suggests them to be removed:

validate_v_ptrace.c:626:17: error: ‘else’ without a previous ‘if’

Fixes: 3789d5eecd5a ("selftests: riscv: verify syscalls discard vector context")
Fixes: 30eb191c895b ("selftests: riscv: verify ptrace rejects invalid vector csr inputs")
Fixes: 849f05ae1ea6 ("selftests: riscv: verify ptrace accepts valid vector csr values")
Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
 tools/testing/selftests/riscv/vector/validate_v_ptrace.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/riscv/vector/validate_v_ptrace.c b/tools/testing/selftests/riscv/vector/validate_v_ptrace.c
index 257de36274e9..5724e6eb3309 100644
--- a/tools/testing/selftests/riscv/vector/validate_v_ptrace.c
+++ b/tools/testing/selftests/riscv/vector/validate_v_ptrace.c
@@ -291,10 +291,11 @@ TEST(ptrace_v_syscall_clobbering)
 
 		/* verify initial vsetvli settings */
 
-		if (is_xtheadvector_supported())
+		if (is_xtheadvector_supported()) {
 			EXPECT_EQ(5UL, regset_data->vtype);
-		else
+		} else {
 			EXPECT_EQ(9UL, regset_data->vtype);
+		}
 
 		EXPECT_EQ(regset_data->vlenb, regset_data->vl);
 		EXPECT_EQ(vlenb, regset_data->vlenb);
@@ -620,10 +621,11 @@ TEST_F(v_csr_invalid, ptrace_v_invalid_values)
 
 		/* verify initial vsetvli settings */
 
-		if (is_xtheadvector_supported())
+		if (is_xtheadvector_supported()) {
 			EXPECT_EQ(5UL, regset_data->vtype);
-		else
+		} else {
 			EXPECT_EQ(9UL, regset_data->vtype);
+		}
 
 		EXPECT_EQ(regset_data->vlenb, regset_data->vl);
 		EXPECT_EQ(vlenb, regset_data->vlenb);
@@ -828,10 +830,11 @@ TEST_F(v_csr_valid, ptrace_v_valid_values)
 
 		/* verify initial vsetvli settings */
 
-		if (is_xtheadvector_supported())
+		if (is_xtheadvector_supported()) {
 			EXPECT_EQ(5UL, regset_data->vtype);
-		else
+		} else {
 			EXPECT_EQ(9UL, regset_data->vtype);
+		}
 
 		EXPECT_EQ(regset_data->vlenb, regset_data->vl);
 		EXPECT_EQ(vlenb, regset_data->vlenb);

-- 
2.52.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues
  2026-03-10  1:52 [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Charlie Jenkins via B4 Relay
  2026-03-10  1:52 ` [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro Charlie Jenkins via B4 Relay
  2026-03-10  1:52 ` [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ() Charlie Jenkins via B4 Relay
@ 2026-03-10  1:52 ` Charlie Jenkins via B4 Relay
  2026-03-10  2:58   ` Deepak Gupta
  2026-03-21  0:53   ` Paul Walmsley
  2026-03-10  1:52 ` [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest Charlie Jenkins via B4 Relay
  2026-03-21  5:20 ` [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi patchwork-bot+linux-riscv
  4 siblings, 2 replies; 16+ messages in thread
From: Charlie Jenkins via B4 Relay @ 2026-03-10  1:52 UTC (permalink / raw)
  To: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta
  Cc: linux-kselftest, linux-riscv, linux-kernel, Charlie Jenkins

From: Charlie Jenkins <thecharlesjenkins@gmail.com>

BIT() is being used in ptrace.h without a definition, resulting in
compilation errors in tools/testing/selftests/riscv/cfi/cfitests.c:

cfitests.c:101:60: error: implicit declaration of function ‘BIT’ [-Wimplicit-function-declaration]
  101 |                      if ((cfi_reg.cfi_status.cfi_state & CFI_ENABLE_MASK) != CFI_ENABLE_MASK)

Include linux/bits.h to resolve this issue.

Fixes: 2af7c9cf021c ("riscv/ptrace: expose riscv CFI status and state via ptrace and in core files")
Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
 arch/riscv/include/uapi/asm/ptrace.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/include/uapi/asm/ptrace.h b/arch/riscv/include/uapi/asm/ptrace.h
index 18988a5f1a63..5b53cea14355 100644
--- a/arch/riscv/include/uapi/asm/ptrace.h
+++ b/arch/riscv/include/uapi/asm/ptrace.h
@@ -8,6 +8,7 @@
 
 #ifndef __ASSEMBLER__
 
+#include <linux/bits.h>
 #include <linux/types.h>
 
 #define PTRACE_GETFDPIC		33

-- 
2.52.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest
  2026-03-10  1:52 [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Charlie Jenkins via B4 Relay
                   ` (2 preceding siblings ...)
  2026-03-10  1:52 ` [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues Charlie Jenkins via B4 Relay
@ 2026-03-10  1:52 ` Charlie Jenkins via B4 Relay
  2026-03-10  2:58   ` Deepak Gupta
  2026-03-21  0:54   ` Paul Walmsley
  2026-03-21  5:20 ` [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi patchwork-bot+linux-riscv
  4 siblings, 2 replies; 16+ messages in thread
From: Charlie Jenkins via B4 Relay @ 2026-03-10  1:52 UTC (permalink / raw)
  To: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta
  Cc: linux-kselftest, linux-riscv, linux-kernel, Charlie Jenkins

From: Charlie Jenkins <thecharlesjenkins@gmail.com>

The cfi selftest was missing a license so add it.

Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
 tools/testing/selftests/riscv/cfi/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/riscv/cfi/Makefile b/tools/testing/selftests/riscv/cfi/Makefile
index 96a4dc4b69c3..93b4738c0e2e 100644
--- a/tools/testing/selftests/riscv/cfi/Makefile
+++ b/tools/testing/selftests/riscv/cfi/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
 CFLAGS += $(KHDR_INCLUDES)
 CFLAGS += -I$(top_srcdir)/tools/include
 

-- 
2.52.0



^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest
  2026-03-10  1:52 ` [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest Charlie Jenkins via B4 Relay
@ 2026-03-10  2:58   ` Deepak Gupta
  2026-03-21  0:54   ` Paul Walmsley
  1 sibling, 0 replies; 16+ messages in thread
From: Deepak Gupta @ 2026-03-10  2:58 UTC (permalink / raw)
  To: thecharlesjenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, linux-kselftest, linux-riscv, linux-kernel

On Mon, Mar 09, 2026 at 06:52:13PM -0700, Charlie Jenkins via B4 Relay wrote:
>From: Charlie Jenkins <thecharlesjenkins@gmail.com>
>
>The cfi selftest was missing a license so add it.
>
>Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
Reviewed-by: Deepak Gupta <debug@rivosinc.com>

>---
> tools/testing/selftests/riscv/cfi/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/tools/testing/selftests/riscv/cfi/Makefile b/tools/testing/selftests/riscv/cfi/Makefile
>index 96a4dc4b69c3..93b4738c0e2e 100644
>--- a/tools/testing/selftests/riscv/cfi/Makefile
>+++ b/tools/testing/selftests/riscv/cfi/Makefile
>@@ -1,3 +1,5 @@
>+# SPDX-License-Identifier: GPL-2.0
>+
> CFLAGS += $(KHDR_INCLUDES)
> CFLAGS += -I$(top_srcdir)/tools/include
>
>
>-- 
>2.52.0
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues
  2026-03-10  1:52 ` [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues Charlie Jenkins via B4 Relay
@ 2026-03-10  2:58   ` Deepak Gupta
  2026-03-21  0:53   ` Paul Walmsley
  1 sibling, 0 replies; 16+ messages in thread
From: Deepak Gupta @ 2026-03-10  2:58 UTC (permalink / raw)
  To: thecharlesjenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, linux-kselftest, linux-riscv, linux-kernel

On Mon, Mar 09, 2026 at 06:52:12PM -0700, Charlie Jenkins via B4 Relay wrote:
>From: Charlie Jenkins <thecharlesjenkins@gmail.com>
>
>BIT() is being used in ptrace.h without a definition, resulting in
>compilation errors in tools/testing/selftests/riscv/cfi/cfitests.c:
>
>cfitests.c:101:60: error: implicit declaration of function ‘BIT’ [-Wimplicit-function-declaration]
>  101 |                      if ((cfi_reg.cfi_status.cfi_state & CFI_ENABLE_MASK) != CFI_ENABLE_MASK)
>
>Include linux/bits.h to resolve this issue.
>
>Fixes: 2af7c9cf021c ("riscv/ptrace: expose riscv CFI status and state via ptrace and in core files")
>Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>

Reviewed-by: Deepak Gupta <debug@rivosinc.com>


>---
> arch/riscv/include/uapi/asm/ptrace.h | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/arch/riscv/include/uapi/asm/ptrace.h b/arch/riscv/include/uapi/asm/ptrace.h
>index 18988a5f1a63..5b53cea14355 100644
>--- a/arch/riscv/include/uapi/asm/ptrace.h
>+++ b/arch/riscv/include/uapi/asm/ptrace.h
>@@ -8,6 +8,7 @@
>
> #ifndef __ASSEMBLER__
>
>+#include <linux/bits.h>
> #include <linux/types.h>
>
> #define PTRACE_GETFDPIC		33
>
>-- 
>2.52.0
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ()
  2026-03-10  1:52 ` [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ() Charlie Jenkins via B4 Relay
@ 2026-03-10  3:50   ` Joe Perches
  2026-03-10  8:17   ` Sergey Matyukevich
  2026-03-21  0:24   ` Paul Walmsley
  2 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2026-03-10  3:50 UTC (permalink / raw)
  To: thecharlesjenkins, Shuah Khan, Paul Walmsley, Palmer Dabbelt,
	Sergey Matyukevich, Andy Chiu, Deepak Gupta, Kees Cook
  Cc: linux-kselftest, linux-riscv, linux-kernel

(adding Kees Cook as he originally submitted this __EXPECT macro)

On Mon, 2026-03-09 at 18:52 -0700, Charlie Jenkins via B4 Relay wrote:
> From: Charlie Jenkins <[thecharlesjenkins@gmail.com](mailto:thecharlesjenkins@gmail.com)>
> 
> EXPECT_EQ() expands to multiple lines, breaking up one-line if
> statements. This issue was not present in the patch on the mailing list
> but was instead introduced by the maintainer when attempting to fix up
> checkpatch warnings. Add braces around EXPECT_EQ() to avoid the error
> even though checkpatch suggests them to be removed:

The __EXPECT macro definition is a multistatement
	"do { ... } while (0); OPTIONAL_HANDLER(_assert)

Perhaps the multistatement __EXPECT should have another
do {} while (0) around both statments like:

	do {
		do { ... } while (0);
		OPTIONAL_HANDLER(_assert);
	} while (0)

so if else blocks without braces would work.

Perhaps the same for the __EXPECT_STR macro definition.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ()
  2026-03-10  1:52 ` [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ() Charlie Jenkins via B4 Relay
  2026-03-10  3:50   ` Joe Perches
@ 2026-03-10  8:17   ` Sergey Matyukevich
  2026-03-21  0:24   ` Paul Walmsley
  2 siblings, 0 replies; 16+ messages in thread
From: Sergey Matyukevich @ 2026-03-10  8:17 UTC (permalink / raw)
  To: thecharlesjenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Andy Chiu,
	Deepak Gupta, linux-kselftest, linux-riscv, linux-kernel

On Mon, Mar 09, 2026 at 06:52:11PM -0700, Charlie Jenkins via B4 Relay wrote:
> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> 
> EXPECT_EQ() expands to multiple lines, breaking up one-line if
> statements. This issue was not present in the patch on the mailing list
> but was instead introduced by the maintainer when attempting to fix up
> checkpatch warnings. Add braces around EXPECT_EQ() to avoid the error
> even though checkpatch suggests them to be removed:
> 
> validate_v_ptrace.c:626:17: error: ‘else’ without a previous ‘if’
> 
> Fixes: 3789d5eecd5a ("selftests: riscv: verify syscalls discard vector context")
> Fixes: 30eb191c895b ("selftests: riscv: verify ptrace rejects invalid vector csr inputs")
> Fixes: 849f05ae1ea6 ("selftests: riscv: verify ptrace accepts valid vector csr values")
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
> ---
>  tools/testing/selftests/riscv/vector/validate_v_ptrace.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

Reviewed-and-Tested-by: Sergey Matyukevich <geomatsi@gmail.com>

Thanks,
Sergey

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro
  2026-03-10  1:52 ` [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro Charlie Jenkins via B4 Relay
@ 2026-03-10  8:18   ` Sergey Matyukevich
  2026-03-21  0:48     ` Paul Walmsley
  2026-03-21  0:53   ` Paul Walmsley
  1 sibling, 1 reply; 16+ messages in thread
From: Sergey Matyukevich @ 2026-03-10  8:18 UTC (permalink / raw)
  To: thecharlesjenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Andy Chiu,
	Deepak Gupta, linux-kselftest, linux-riscv, linux-kernel

On Mon, Mar 09, 2026 at 06:52:10PM -0700, Charlie Jenkins via B4 Relay wrote:
> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> 
> The BIT() macros is used by the validate_v_ptrace() test case, but not
> defined. Include linux/bits.h to pull in this definition. To ensure that
> the header in the kernel source is used, add tools/include to the header
> search path.
> 
> Fixes: 30eb191c895b ("selftests: riscv: verify ptrace rejects invalid vector csr inputs")
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
> ---
>  tools/testing/selftests/riscv/vector/Makefile            | 7 +++++--
>  tools/testing/selftests/riscv/vector/validate_v_ptrace.c | 1 +
>  2 files changed, 6 insertions(+), 2 deletions(-)
 
Reviewed-and-Tested-by: Sergey Matyukevich <geomatsi@gmail.com>

Thanks,
Sergey

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ()
  2026-03-10  1:52 ` [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ() Charlie Jenkins via B4 Relay
  2026-03-10  3:50   ` Joe Perches
  2026-03-10  8:17   ` Sergey Matyukevich
@ 2026-03-21  0:24   ` Paul Walmsley
  2 siblings, 0 replies; 16+ messages in thread
From: Paul Walmsley @ 2026-03-21  0:24 UTC (permalink / raw)
  To: Charlie Jenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta, linux-kselftest, linux-riscv,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 681 bytes --]

On Mon, 9 Mar 2026, Charlie Jenkins via B4 Relay wrote:

> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> 
> EXPECT_EQ() expands to multiple lines, breaking up one-line if
> statements. This issue was not present in the patch on the mailing list
> but was instead introduced by the maintainer when attempting to fix up
> checkpatch warnings. Add braces around EXPECT_EQ() to avoid the error
> even though checkpatch suggests them to be removed:
> 
> validate_v_ptrace.c:626:17: error: ‘else’ without a previous ‘if’

That's annoying.  Can't the macro body be wrapped in do { ... } while (0); 
instead, rather than adding these permanent checkpatch warnings?


- Paul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro
  2026-03-10  8:18   ` Sergey Matyukevich
@ 2026-03-21  0:48     ` Paul Walmsley
  0 siblings, 0 replies; 16+ messages in thread
From: Paul Walmsley @ 2026-03-21  0:48 UTC (permalink / raw)
  To: Sergey Matyukevich
  Cc: thecharlesjenkins, Shuah Khan, Paul Walmsley, Palmer Dabbelt,
	Andy Chiu, Deepak Gupta, linux-kselftest, linux-riscv,
	linux-kernel

On Tue, 10 Mar 2026, Sergey Matyukevich wrote:

> On Mon, Mar 09, 2026 at 06:52:10PM -0700, Charlie Jenkins via B4 Relay wrote:
> > From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> > 
> > The BIT() macros is used by the validate_v_ptrace() test case, but not
> > defined. Include linux/bits.h to pull in this definition. To ensure that
> > the header in the kernel source is used, add tools/include to the header
> > search path.
> > 
> > Fixes: 30eb191c895b ("selftests: riscv: verify ptrace rejects invalid vector csr inputs")
> > Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
> > ---
> >  tools/testing/selftests/riscv/vector/Makefile            | 7 +++++--
> >  tools/testing/selftests/riscv/vector/validate_v_ptrace.c | 1 +
> >  2 files changed, 6 insertions(+), 2 deletions(-)
>  
> Reviewed-and-Tested-by: Sergey Matyukevich <geomatsi@gmail.com>

Thanks for reviewing and testing but please use "Reviewed-and-tested-by" 
next time so I don't have to fix it up by hand.


- Paul


$ scripts/checkpatch.pl --strict 0001-selftests-riscv-Add-definition-of-BIT-macro.patch
WARNING: 'Reviewed-and-tested-by:' is the preferred signature form
#13: 
Reviewed-and-Tested-by: Sergey Matyukevich <geomatsi@gmail.com>



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro
  2026-03-10  1:52 ` [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro Charlie Jenkins via B4 Relay
  2026-03-10  8:18   ` Sergey Matyukevich
@ 2026-03-21  0:53   ` Paul Walmsley
  1 sibling, 0 replies; 16+ messages in thread
From: Paul Walmsley @ 2026-03-21  0:53 UTC (permalink / raw)
  To: Charlie Jenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta, linux-kselftest, linux-riscv,
	linux-kernel

On Mon, 9 Mar 2026, Charlie Jenkins via B4 Relay wrote:

> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> 
> The BIT() macros is used by the validate_v_ptrace() test case, but not
> defined. Include linux/bits.h to pull in this definition. To ensure that
> the header in the kernel source is used, add tools/include to the header
> search path.
> 
> Fixes: 30eb191c895b ("selftests: riscv: verify ptrace rejects invalid vector csr inputs")
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>

Thanks, queued for v7.0-rc.


- Paul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues
  2026-03-10  1:52 ` [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues Charlie Jenkins via B4 Relay
  2026-03-10  2:58   ` Deepak Gupta
@ 2026-03-21  0:53   ` Paul Walmsley
  1 sibling, 0 replies; 16+ messages in thread
From: Paul Walmsley @ 2026-03-21  0:53 UTC (permalink / raw)
  To: Charlie Jenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta, linux-kselftest, linux-riscv,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

On Mon, 9 Mar 2026, Charlie Jenkins via B4 Relay wrote:

> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> 
> BIT() is being used in ptrace.h without a definition, resulting in
> compilation errors in tools/testing/selftests/riscv/cfi/cfitests.c:
> 
> cfitests.c:101:60: error: implicit declaration of function ‘BIT’ [-Wimplicit-function-declaration]
>   101 |                      if ((cfi_reg.cfi_status.cfi_state & CFI_ENABLE_MASK) != CFI_ENABLE_MASK)
> 
> Include linux/bits.h to resolve this issue.
> 
> Fixes: 2af7c9cf021c ("riscv/ptrace: expose riscv CFI status and state via ptrace and in core files")
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>

Thanks, queued for v7.0-rc.


- Paul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest
  2026-03-10  1:52 ` [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest Charlie Jenkins via B4 Relay
  2026-03-10  2:58   ` Deepak Gupta
@ 2026-03-21  0:54   ` Paul Walmsley
  1 sibling, 0 replies; 16+ messages in thread
From: Paul Walmsley @ 2026-03-21  0:54 UTC (permalink / raw)
  To: Charlie Jenkins
  Cc: Shuah Khan, Paul Walmsley, Palmer Dabbelt, Sergey Matyukevich,
	Andy Chiu, Deepak Gupta, linux-kselftest, linux-riscv,
	linux-kernel

On Mon, 9 Mar 2026, Charlie Jenkins via B4 Relay wrote:

> From: Charlie Jenkins <thecharlesjenkins@gmail.com>
> 
> The cfi selftest was missing a license so add it.
> 
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>

Thanks, queued for v7.0-rc.  This sort of thing probably is best coming 
from Deepak, since he is the author, but since he added his Reviewed-by:, 
we're good.


- Paul

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi
  2026-03-10  1:52 [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Charlie Jenkins via B4 Relay
                   ` (3 preceding siblings ...)
  2026-03-10  1:52 ` [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest Charlie Jenkins via B4 Relay
@ 2026-03-21  5:20 ` patchwork-bot+linux-riscv
  4 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+linux-riscv @ 2026-03-21  5:20 UTC (permalink / raw)
  To: Charlie Jenkins
  Cc: linux-riscv, shuah, pjw, palmer, geomatsi, andybnac, debug,
	linux-kselftest, linux-kernel

Hello:

This series was applied to riscv/linux.git (fixes)
by Paul Walmsley <pjw@kernel.org>:

On Mon, 09 Mar 2026 18:52:09 -0700 you wrote:
> There are a couple of compilation issues of the riscv selftests.
> Coincidentally two of the issues are independent problems with not
> including the header that includes the BIT() macro and the other issue
> is from checkpatch incorrectly suggesting to remove non-redundant
> braces.
> 
> Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
> 
> [...]

Here is the summary with links:
  - [v2,1/4] selftests: riscv: Add definition of BIT() macro
    https://git.kernel.org/riscv/c/e93c2978c9db
  - [v2,2/4] selftests: riscv: Add braces around EXPECT_EQ()
    (no matching commit)
  - [v2,3/4] riscv: ptrace: Fix BIT() compilation issues
    https://git.kernel.org/riscv/c/b1b59c40962e
  - [v2,4/4] selftests: riscv: Add license to cfi selftest
    https://git.kernel.org/riscv/c/5ccc568075c9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-03-21  5:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10  1:52 [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi Charlie Jenkins via B4 Relay
2026-03-10  1:52 ` [PATCH v2 1/4] selftests: riscv: Add definition of BIT() macro Charlie Jenkins via B4 Relay
2026-03-10  8:18   ` Sergey Matyukevich
2026-03-21  0:48     ` Paul Walmsley
2026-03-21  0:53   ` Paul Walmsley
2026-03-10  1:52 ` [PATCH v2 2/4] selftests: riscv: Add braces around EXPECT_EQ() Charlie Jenkins via B4 Relay
2026-03-10  3:50   ` Joe Perches
2026-03-10  8:17   ` Sergey Matyukevich
2026-03-21  0:24   ` Paul Walmsley
2026-03-10  1:52 ` [PATCH v2 3/4] riscv: ptrace: Fix BIT() compilation issues Charlie Jenkins via B4 Relay
2026-03-10  2:58   ` Deepak Gupta
2026-03-21  0:53   ` Paul Walmsley
2026-03-10  1:52 ` [PATCH v2 4/4] selftests: riscv: Add license to cfi selftest Charlie Jenkins via B4 Relay
2026-03-10  2:58   ` Deepak Gupta
2026-03-21  0:54   ` Paul Walmsley
2026-03-21  5:20 ` [PATCH v2 0/4] selftests: riscv: Fix compilation issues for v_ptrace and cfi patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox