public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings
@ 2023-11-23 18:58 Christoph Muellner
  2023-11-23 18:58 ` [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe Christoph Muellner
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Christoph Muellner @ 2023-11-23 18:58 UTC (permalink / raw)
  To: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins, Christoph Müllner

From: Christoph Müllner <christoph.muellner@vrull.eu>

When building the RISC-V selftests with a riscv32 compiler I ran into
a couple of compiler warnings. While riscv32 support for these tests is
questionable, the fixes are so trivial that it is probably best to simply
apply them.

Note that the missing-include patch and some format string warnings
are also relevant for riscv64.

Christoph Müllner (5):
  tools: selftests: riscv: Fix compile warnings in hwprobe
  tools: selftests: riscv: Fix compile warnings in cbo
  tools: selftests: riscv: Add missing include for vector test
  tools: selftests: riscv: Fix compile warnings in vector tests
  tools: selftests: riscv: Fix compile warnings in mm tests

 tools/testing/selftests/riscv/hwprobe/cbo.c               | 6 +++---
 tools/testing/selftests/riscv/hwprobe/hwprobe.c           | 4 ++--
 tools/testing/selftests/riscv/mm/mmap_test.h              | 3 +++
 tools/testing/selftests/riscv/vector/v_initval_nolibc.c   | 2 +-
 tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c | 3 +++
 tools/testing/selftests/riscv/vector/vstate_prctl.c       | 4 ++--
 6 files changed, 14 insertions(+), 8 deletions(-)

-- 
2.41.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe
  2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
@ 2023-11-23 18:58 ` Christoph Muellner
  2023-12-15 13:41   ` Alexandre Ghiti
  2023-12-15 13:52   ` Alexandre Ghiti
  2023-11-23 18:58 ` [PATCH 2/5] tools: selftests: riscv: Fix compile warnings in cbo Christoph Muellner
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 16+ messages in thread
From: Christoph Muellner @ 2023-11-23 18:58 UTC (permalink / raw)
  To: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins, Christoph Müllner

From: Christoph Müllner <christoph.muellner@vrull.eu>

GCC prints a couple of format string warnings when compiling
the hwprobe test. Let's follow the recommendation in
Documentation/printk-formats.txt to fix these warnings.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
 tools/testing/selftests/riscv/hwprobe/hwprobe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/riscv/hwprobe/hwprobe.c b/tools/testing/selftests/riscv/hwprobe/hwprobe.c
index c474891df307..abb825811c70 100644
--- a/tools/testing/selftests/riscv/hwprobe/hwprobe.c
+++ b/tools/testing/selftests/riscv/hwprobe/hwprobe.c
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
 		/* Fail if the kernel claims not to recognize a base key. */
 		if ((i < 4) && (pairs[i].key != i))
 			ksft_exit_fail_msg("Failed to recognize base key: key != i, "
-					   "key=%ld, i=%ld\n", pairs[i].key, i);
+					   "key=%lld, i=%ld\n", pairs[i].key, i);
 
 		if (pairs[i].key != RISCV_HWPROBE_KEY_BASE_BEHAVIOR)
 			continue;
@@ -37,7 +37,7 @@ int main(int argc, char **argv)
 		if (pairs[i].value & RISCV_HWPROBE_BASE_BEHAVIOR_IMA)
 			continue;
 
-		ksft_exit_fail_msg("Unexpected pair: (%ld, %ld)\n", pairs[i].key, pairs[i].value);
+		ksft_exit_fail_msg("Unexpected pair: (%lld, %llu)\n", pairs[i].key, pairs[i].value);
 	}
 
 	out = riscv_hwprobe(pairs, 8, 0, 0, 0);
-- 
2.41.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 2/5] tools: selftests: riscv: Fix compile warnings in cbo
  2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
  2023-11-23 18:58 ` [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe Christoph Muellner
@ 2023-11-23 18:58 ` Christoph Muellner
  2023-12-15 13:54   ` Alexandre Ghiti
  2023-11-23 18:58 ` [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test Christoph Muellner
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Christoph Muellner @ 2023-11-23 18:58 UTC (permalink / raw)
  To: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins, Christoph Müllner

From: Christoph Müllner <christoph.muellner@vrull.eu>

GCC prints a couple of format string warnings when compiling
the cbo test. Let's follow the recommendation in
Documentation/printk-formats.txt to fix these warnings.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
 tools/testing/selftests/riscv/hwprobe/cbo.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/riscv/hwprobe/cbo.c b/tools/testing/selftests/riscv/hwprobe/cbo.c
index 50a2cc8aef38..c6a83ab11e22 100644
--- a/tools/testing/selftests/riscv/hwprobe/cbo.c
+++ b/tools/testing/selftests/riscv/hwprobe/cbo.c
@@ -97,7 +97,7 @@ static void test_zicboz(void *arg)
 	block_size = pair.value;
 	ksft_test_result(rc == 0 && pair.key == RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE &&
 			 is_power_of_2(block_size), "Zicboz block size\n");
-	ksft_print_msg("Zicboz block size: %ld\n", block_size);
+	ksft_print_msg("Zicboz block size: %llu\n", block_size);
 
 	illegal_insn = false;
 	cbo_zero(&mem[block_size]);
@@ -121,7 +121,7 @@ static void test_zicboz(void *arg)
 		for (j = 0; j < block_size; ++j) {
 			if (mem[i * block_size + j] != expected) {
 				ksft_test_result_fail("cbo.zero check\n");
-				ksft_print_msg("cbo.zero check: mem[%d] != 0x%x\n",
+				ksft_print_msg("cbo.zero check: mem[%llu] != 0x%x\n",
 					       i * block_size + j, expected);
 				return;
 			}
@@ -201,7 +201,7 @@ int main(int argc, char **argv)
 	pair.key = RISCV_HWPROBE_KEY_IMA_EXT_0;
 	rc = riscv_hwprobe(&pair, 1, sizeof(cpu_set_t), (unsigned long *)&cpus, 0);
 	if (rc < 0)
-		ksft_exit_fail_msg("hwprobe() failed with %d\n", rc);
+		ksft_exit_fail_msg("hwprobe() failed with %ld\n", rc);
 	assert(rc == 0 && pair.key == RISCV_HWPROBE_KEY_IMA_EXT_0);
 
 	if (pair.value & RISCV_HWPROBE_EXT_ZICBOZ) {
-- 
2.41.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test
  2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
  2023-11-23 18:58 ` [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe Christoph Muellner
  2023-11-23 18:58 ` [PATCH 2/5] tools: selftests: riscv: Fix compile warnings in cbo Christoph Muellner
@ 2023-11-23 18:58 ` Christoph Muellner
  2023-12-15 13:57   ` Alexandre Ghiti
  2023-12-15 15:38   ` Andy Chiu
  2023-11-23 18:58 ` [PATCH 4/5] tools: selftests: riscv: Fix compile warnings in vector tests Christoph Muellner
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 16+ messages in thread
From: Christoph Muellner @ 2023-11-23 18:58 UTC (permalink / raw)
  To: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins, Christoph Müllner

From: Christoph Müllner <christoph.muellner@vrull.eu>

GCC raises the following warning:
  warning: 'status' may be used uninitialized
The warning comes from the fact, that the signature of waitpid() is
unknown and therefore the initialization of GCC cannot be guessed.
Let's add the relevant header to address this warning.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
 tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
index 2c0d2b1126c1..1f9969bed235 100644
--- a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
+++ b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
@@ -1,4 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
+
+#include <linux/wait.h>
+
 #define THIS_PROGRAM "./vstate_exec_nolibc"
 
 int main(int argc, char **argv)
-- 
2.41.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 4/5] tools: selftests: riscv: Fix compile warnings in vector tests
  2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
                   ` (2 preceding siblings ...)
  2023-11-23 18:58 ` [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test Christoph Muellner
@ 2023-11-23 18:58 ` Christoph Muellner
  2023-12-15 13:44   ` Alexandre Ghiti
  2023-11-23 18:58 ` [PATCH 5/5] tools: selftests: riscv: Fix compile warnings in mm tests Christoph Muellner
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Christoph Muellner @ 2023-11-23 18:58 UTC (permalink / raw)
  To: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins, Christoph Müllner

From: Christoph Müllner <christoph.muellner@vrull.eu>

GCC prints a couple of format string warnings when compiling
the vector tests. Let's follow the recommendation in
Documentation/printk-formats.txt to fix these warnings.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
 tools/testing/selftests/riscv/vector/v_initval_nolibc.c | 2 +-
 tools/testing/selftests/riscv/vector/vstate_prctl.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/riscv/vector/v_initval_nolibc.c b/tools/testing/selftests/riscv/vector/v_initval_nolibc.c
index 66764edb0d52..1dd94197da30 100644
--- a/tools/testing/selftests/riscv/vector/v_initval_nolibc.c
+++ b/tools/testing/selftests/riscv/vector/v_initval_nolibc.c
@@ -27,7 +27,7 @@ int main(void)
 
 	datap = malloc(MAX_VSIZE);
 	if (!datap) {
-		ksft_test_result_fail("fail to allocate memory for size = %lu\n", MAX_VSIZE);
+		ksft_test_result_fail("fail to allocate memory for size = %d\n", MAX_VSIZE);
 		exit(-1);
 	}
 
diff --git a/tools/testing/selftests/riscv/vector/vstate_prctl.c b/tools/testing/selftests/riscv/vector/vstate_prctl.c
index b348b475be57..8ad94e08ff4d 100644
--- a/tools/testing/selftests/riscv/vector/vstate_prctl.c
+++ b/tools/testing/selftests/riscv/vector/vstate_prctl.c
@@ -68,7 +68,7 @@ int test_and_compare_child(long provided, long expected, int inherit)
 	}
 	rc = launch_test(inherit);
 	if (rc != expected) {
-		ksft_test_result_fail("Test failed, check %d != %d\n", rc,
+		ksft_test_result_fail("Test failed, check %d != %ld\n", rc,
 				      expected);
 		return -2;
 	}
@@ -87,7 +87,7 @@ int main(void)
 	pair.key = RISCV_HWPROBE_KEY_IMA_EXT_0;
 	rc = riscv_hwprobe(&pair, 1, 0, NULL, 0);
 	if (rc < 0) {
-		ksft_test_result_fail("hwprobe() failed with %d\n", rc);
+		ksft_test_result_fail("hwprobe() failed with %ld\n", rc);
 		return -1;
 	}
 
-- 
2.41.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* [PATCH 5/5] tools: selftests: riscv: Fix compile warnings in mm tests
  2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
                   ` (3 preceding siblings ...)
  2023-11-23 18:58 ` [PATCH 4/5] tools: selftests: riscv: Fix compile warnings in vector tests Christoph Muellner
@ 2023-11-23 18:58 ` Christoph Muellner
  2023-12-15 13:50   ` Alexandre Ghiti
  2023-11-24  9:40 ` [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Andrew Jones
  2024-01-12  6:30 ` patchwork-bot+linux-riscv
  6 siblings, 1 reply; 16+ messages in thread
From: Christoph Muellner @ 2023-11-23 18:58 UTC (permalink / raw)
  To: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins, Christoph Müllner

From: Christoph Müllner <christoph.muellner@vrull.eu>

When building the mm tests with a riscv32 compiler, we see a range
of shift-count-overflow errors from shifting 1UL by more than 32 bits
in do_mmaps(). Since, the relevant code is only called from code that
is gated by `__riscv_xlen == 64`, we can just apply the same gating
to do_mmaps().

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
 tools/testing/selftests/riscv/mm/mmap_test.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/riscv/mm/mmap_test.h b/tools/testing/selftests/riscv/mm/mmap_test.h
index 9b8434f62f57..2e0db9c5be6c 100644
--- a/tools/testing/selftests/riscv/mm/mmap_test.h
+++ b/tools/testing/selftests/riscv/mm/mmap_test.h
@@ -18,6 +18,8 @@ struct addresses {
 	int *on_56_addr;
 };
 
+// Only works on 64 bit
+#if __riscv_xlen == 64
 static inline void do_mmaps(struct addresses *mmap_addresses)
 {
 	/*
@@ -50,6 +52,7 @@ static inline void do_mmaps(struct addresses *mmap_addresses)
 	mmap_addresses->on_56_addr =
 		mmap(on_56_bits, 5 * sizeof(int), prot, flags, 0, 0);
 }
+#endif /* __riscv_xlen == 64 */
 
 static inline int memory_layout(void)
 {
-- 
2.41.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings
  2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
                   ` (4 preceding siblings ...)
  2023-11-23 18:58 ` [PATCH 5/5] tools: selftests: riscv: Fix compile warnings in mm tests Christoph Muellner
@ 2023-11-24  9:40 ` Andrew Jones
  2023-12-15 10:02   ` Christoph Müllner
  2024-01-12  6:30 ` patchwork-bot+linux-riscv
  6 siblings, 1 reply; 16+ messages in thread
From: Andrew Jones @ 2023-11-24  9:40 UTC (permalink / raw)
  To: Christoph Muellner
  Cc: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan, Philipp Tomsich, Evan Green,
	Xiao Wang, Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

On Thu, Nov 23, 2023 at 07:58:16PM +0100, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
> 
> When building the RISC-V selftests with a riscv32 compiler I ran into
> a couple of compiler warnings. While riscv32 support for these tests is
> questionable, the fixes are so trivial that it is probably best to simply
> apply them.
> 
> Note that the missing-include patch and some format string warnings
> are also relevant for riscv64.

I also posted [1] a couple days ago for the format warnings, but, as this
series also includes rv32 fixes, then we can drop [1] in favor of this.

[1] https://lore.kernel.org/all/20231122171821.130854-2-ajones@ventanamicro.com/

For the series,

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>

Thanks,
drew

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings
  2023-11-24  9:40 ` [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Andrew Jones
@ 2023-12-15 10:02   ` Christoph Müllner
  0 siblings, 0 replies; 16+ messages in thread
From: Christoph Müllner @ 2023-12-15 10:02 UTC (permalink / raw)
  To: Andrew Jones
  Cc: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan, Philipp Tomsich, Evan Green,
	Xiao Wang, Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

Ping.
It would be great to have these compiler warnings fixed before the release.

On Fri, Nov 24, 2023 at 10:40 AM Andrew Jones <ajones@ventanamicro.com> wrote:
>
> On Thu, Nov 23, 2023 at 07:58:16PM +0100, Christoph Muellner wrote:
> > From: Christoph Müllner <christoph.muellner@vrull.eu>
> >
> > When building the RISC-V selftests with a riscv32 compiler I ran into
> > a couple of compiler warnings. While riscv32 support for these tests is
> > questionable, the fixes are so trivial that it is probably best to simply
> > apply them.
> >
> > Note that the missing-include patch and some format string warnings
> > are also relevant for riscv64.
>
> I also posted [1] a couple days ago for the format warnings, but, as this
> series also includes rv32 fixes, then we can drop [1] in favor of this.
>
> [1] https://lore.kernel.org/all/20231122171821.130854-2-ajones@ventanamicro.com/
>
> For the series,
>
> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
>
> Thanks,
> drew

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe
  2023-11-23 18:58 ` [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe Christoph Muellner
@ 2023-12-15 13:41   ` Alexandre Ghiti
  2023-12-15 13:52   ` Alexandre Ghiti
  1 sibling, 0 replies; 16+ messages in thread
From: Alexandre Ghiti @ 2023-12-15 13:41 UTC (permalink / raw)
  To: Christoph Muellner, linux-riscv, linux-kselftest, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

On 23/11/2023 19:58, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> GCC prints a couple of format string warnings when compiling
> the hwprobe test. Let's follow the recommendation in
> Documentation/printk-formats.txt to fix these warnings.
>
> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
> ---
>   tools/testing/selftests/riscv/hwprobe/hwprobe.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/riscv/hwprobe/hwprobe.c b/tools/testing/selftests/riscv/hwprobe/hwprobe.c
> index c474891df307..abb825811c70 100644
> --- a/tools/testing/selftests/riscv/hwprobe/hwprobe.c
> +++ b/tools/testing/selftests/riscv/hwprobe/hwprobe.c
> @@ -29,7 +29,7 @@ int main(int argc, char **argv)
>   		/* Fail if the kernel claims not to recognize a base key. */
>   		if ((i < 4) && (pairs[i].key != i))
>   			ksft_exit_fail_msg("Failed to recognize base key: key != i, "
> -					   "key=%ld, i=%ld\n", pairs[i].key, i);
> +					   "key=%lld, i=%ld\n", pairs[i].key, i);
>   
>   		if (pairs[i].key != RISCV_HWPROBE_KEY_BASE_BEHAVIOR)
>   			continue;
> @@ -37,7 +37,7 @@ int main(int argc, char **argv)
>   		if (pairs[i].value & RISCV_HWPROBE_BASE_BEHAVIOR_IMA)
>   			continue;
>   
> -		ksft_exit_fail_msg("Unexpected pair: (%ld, %ld)\n", pairs[i].key, pairs[i].value);
> +		ksft_exit_fail_msg("Unexpected pair: (%lld, %llu)\n", pairs[i].key, pairs[i].value);
>   	}
>   
>   	out = riscv_hwprobe(pairs, 8, 0, 0, 0);


You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks!

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 4/5] tools: selftests: riscv: Fix compile warnings in vector tests
  2023-11-23 18:58 ` [PATCH 4/5] tools: selftests: riscv: Fix compile warnings in vector tests Christoph Muellner
@ 2023-12-15 13:44   ` Alexandre Ghiti
  0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Ghiti @ 2023-12-15 13:44 UTC (permalink / raw)
  To: Christoph Muellner, linux-riscv, linux-kselftest, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

On 23/11/2023 19:58, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> GCC prints a couple of format string warnings when compiling
> the vector tests. Let's follow the recommendation in
> Documentation/printk-formats.txt to fix these warnings.
>
> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
> ---
>   tools/testing/selftests/riscv/vector/v_initval_nolibc.c | 2 +-
>   tools/testing/selftests/riscv/vector/vstate_prctl.c     | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/riscv/vector/v_initval_nolibc.c b/tools/testing/selftests/riscv/vector/v_initval_nolibc.c
> index 66764edb0d52..1dd94197da30 100644
> --- a/tools/testing/selftests/riscv/vector/v_initval_nolibc.c
> +++ b/tools/testing/selftests/riscv/vector/v_initval_nolibc.c
> @@ -27,7 +27,7 @@ int main(void)
>   
>   	datap = malloc(MAX_VSIZE);
>   	if (!datap) {
> -		ksft_test_result_fail("fail to allocate memory for size = %lu\n", MAX_VSIZE);
> +		ksft_test_result_fail("fail to allocate memory for size = %d\n", MAX_VSIZE);
>   		exit(-1);
>   	}
>   
> diff --git a/tools/testing/selftests/riscv/vector/vstate_prctl.c b/tools/testing/selftests/riscv/vector/vstate_prctl.c
> index b348b475be57..8ad94e08ff4d 100644
> --- a/tools/testing/selftests/riscv/vector/vstate_prctl.c
> +++ b/tools/testing/selftests/riscv/vector/vstate_prctl.c
> @@ -68,7 +68,7 @@ int test_and_compare_child(long provided, long expected, int inherit)
>   	}
>   	rc = launch_test(inherit);
>   	if (rc != expected) {
> -		ksft_test_result_fail("Test failed, check %d != %d\n", rc,
> +		ksft_test_result_fail("Test failed, check %d != %ld\n", rc,
>   				      expected);
>   		return -2;
>   	}
> @@ -87,7 +87,7 @@ int main(void)
>   	pair.key = RISCV_HWPROBE_KEY_IMA_EXT_0;
>   	rc = riscv_hwprobe(&pair, 1, 0, NULL, 0);
>   	if (rc < 0) {
> -		ksft_test_result_fail("hwprobe() failed with %d\n", rc);
> +		ksft_test_result_fail("hwprobe() failed with %ld\n", rc);
>   		return -1;
>   	}
>   


You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks!

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 5/5] tools: selftests: riscv: Fix compile warnings in mm tests
  2023-11-23 18:58 ` [PATCH 5/5] tools: selftests: riscv: Fix compile warnings in mm tests Christoph Muellner
@ 2023-12-15 13:50   ` Alexandre Ghiti
  0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Ghiti @ 2023-12-15 13:50 UTC (permalink / raw)
  To: Christoph Muellner, linux-riscv, linux-kselftest, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

On 23/11/2023 19:58, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> When building the mm tests with a riscv32 compiler, we see a range
> of shift-count-overflow errors from shifting 1UL by more than 32 bits
> in do_mmaps(). Since, the relevant code is only called from code that
> is gated by `__riscv_xlen == 64`, we can just apply the same gating
> to do_mmaps().
>
> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
> ---
>   tools/testing/selftests/riscv/mm/mmap_test.h | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/riscv/mm/mmap_test.h b/tools/testing/selftests/riscv/mm/mmap_test.h
> index 9b8434f62f57..2e0db9c5be6c 100644
> --- a/tools/testing/selftests/riscv/mm/mmap_test.h
> +++ b/tools/testing/selftests/riscv/mm/mmap_test.h
> @@ -18,6 +18,8 @@ struct addresses {
>   	int *on_56_addr;
>   };
>   
> +// Only works on 64 bit
> +#if __riscv_xlen == 64
>   static inline void do_mmaps(struct addresses *mmap_addresses)
>   {
>   	/*
> @@ -50,6 +52,7 @@ static inline void do_mmaps(struct addresses *mmap_addresses)
>   	mmap_addresses->on_56_addr =
>   		mmap(on_56_bits, 5 * sizeof(int), prot, flags, 0, 0);
>   }
> +#endif /* __riscv_xlen == 64 */
>   
>   static inline int memory_layout(void)
>   {


You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks!

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe
  2023-11-23 18:58 ` [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe Christoph Muellner
  2023-12-15 13:41   ` Alexandre Ghiti
@ 2023-12-15 13:52   ` Alexandre Ghiti
  1 sibling, 0 replies; 16+ messages in thread
From: Alexandre Ghiti @ 2023-12-15 13:52 UTC (permalink / raw)
  To: Christoph Muellner, linux-riscv, linux-kselftest, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

On 23/11/2023 19:58, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> GCC prints a couple of format string warnings when compiling
> the hwprobe test. Let's follow the recommendation in
> Documentation/printk-formats.txt to fix these warnings.
>
> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
> ---
>   tools/testing/selftests/riscv/hwprobe/hwprobe.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/riscv/hwprobe/hwprobe.c b/tools/testing/selftests/riscv/hwprobe/hwprobe.c
> index c474891df307..abb825811c70 100644
> --- a/tools/testing/selftests/riscv/hwprobe/hwprobe.c
> +++ b/tools/testing/selftests/riscv/hwprobe/hwprobe.c
> @@ -29,7 +29,7 @@ int main(int argc, char **argv)
>   		/* Fail if the kernel claims not to recognize a base key. */
>   		if ((i < 4) && (pairs[i].key != i))
>   			ksft_exit_fail_msg("Failed to recognize base key: key != i, "
> -					   "key=%ld, i=%ld\n", pairs[i].key, i);
> +					   "key=%lld, i=%ld\n", pairs[i].key, i);
>   
>   		if (pairs[i].key != RISCV_HWPROBE_KEY_BASE_BEHAVIOR)
>   			continue;
> @@ -37,7 +37,7 @@ int main(int argc, char **argv)
>   		if (pairs[i].value & RISCV_HWPROBE_BASE_BEHAVIOR_IMA)
>   			continue;
>   
> -		ksft_exit_fail_msg("Unexpected pair: (%ld, %ld)\n", pairs[i].key, pairs[i].value);
> +		ksft_exit_fail_msg("Unexpected pair: (%lld, %llu)\n", pairs[i].key, pairs[i].value);
>   	}
>   
>   	out = riscv_hwprobe(pairs, 8, 0, 0, 0);

You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks!

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 2/5] tools: selftests: riscv: Fix compile warnings in cbo
  2023-11-23 18:58 ` [PATCH 2/5] tools: selftests: riscv: Fix compile warnings in cbo Christoph Muellner
@ 2023-12-15 13:54   ` Alexandre Ghiti
  0 siblings, 0 replies; 16+ messages in thread
From: Alexandre Ghiti @ 2023-12-15 13:54 UTC (permalink / raw)
  To: Christoph Muellner, linux-riscv, linux-kselftest, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

On 23/11/2023 19:58, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> GCC prints a couple of format string warnings when compiling
> the cbo test. Let's follow the recommendation in
> Documentation/printk-formats.txt to fix these warnings.
>
> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
> ---
>   tools/testing/selftests/riscv/hwprobe/cbo.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/riscv/hwprobe/cbo.c b/tools/testing/selftests/riscv/hwprobe/cbo.c
> index 50a2cc8aef38..c6a83ab11e22 100644
> --- a/tools/testing/selftests/riscv/hwprobe/cbo.c
> +++ b/tools/testing/selftests/riscv/hwprobe/cbo.c
> @@ -97,7 +97,7 @@ static void test_zicboz(void *arg)
>   	block_size = pair.value;
>   	ksft_test_result(rc == 0 && pair.key == RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE &&
>   			 is_power_of_2(block_size), "Zicboz block size\n");
> -	ksft_print_msg("Zicboz block size: %ld\n", block_size);
> +	ksft_print_msg("Zicboz block size: %llu\n", block_size);
>   
>   	illegal_insn = false;
>   	cbo_zero(&mem[block_size]);
> @@ -121,7 +121,7 @@ static void test_zicboz(void *arg)
>   		for (j = 0; j < block_size; ++j) {
>   			if (mem[i * block_size + j] != expected) {
>   				ksft_test_result_fail("cbo.zero check\n");
> -				ksft_print_msg("cbo.zero check: mem[%d] != 0x%x\n",
> +				ksft_print_msg("cbo.zero check: mem[%llu] != 0x%x\n",
>   					       i * block_size + j, expected);
>   				return;
>   			}
> @@ -201,7 +201,7 @@ int main(int argc, char **argv)
>   	pair.key = RISCV_HWPROBE_KEY_IMA_EXT_0;
>   	rc = riscv_hwprobe(&pair, 1, sizeof(cpu_set_t), (unsigned long *)&cpus, 0);
>   	if (rc < 0)
> -		ksft_exit_fail_msg("hwprobe() failed with %d\n", rc);
> +		ksft_exit_fail_msg("hwprobe() failed with %ld\n", rc);
>   	assert(rc == 0 && pair.key == RISCV_HWPROBE_KEY_IMA_EXT_0);
>   
>   	if (pair.value & RISCV_HWPROBE_EXT_ZICBOZ) {


You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks!

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test
  2023-11-23 18:58 ` [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test Christoph Muellner
@ 2023-12-15 13:57   ` Alexandre Ghiti
  2023-12-15 15:38   ` Andy Chiu
  1 sibling, 0 replies; 16+ messages in thread
From: Alexandre Ghiti @ 2023-12-15 13:57 UTC (permalink / raw)
  To: Christoph Muellner, linux-riscv, linux-kselftest, linux-kernel,
	Palmer Dabbelt, Paul Walmsley, Albert Ou, Shuah Khan
  Cc: Philipp Tomsich, Andrew Jones, Evan Green, Xiao Wang,
	Alexandre Ghiti, Andy Chiu, Björn Töpel,
	Charlie Jenkins

On 23/11/2023 19:58, Christoph Muellner wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> GCC raises the following warning:
>    warning: 'status' may be used uninitialized
> The warning comes from the fact, that the signature of waitpid() is
> unknown and therefore the initialization of GCC cannot be guessed.
> Let's add the relevant header to address this warning.
>
> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
> ---
>   tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> index 2c0d2b1126c1..1f9969bed235 100644
> --- a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> +++ b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> @@ -1,4 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <linux/wait.h>
> +
>   #define THIS_PROGRAM "./vstate_exec_nolibc"
>   
>   int main(int argc, char **argv)

You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks!

Alex


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test
  2023-11-23 18:58 ` [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test Christoph Muellner
  2023-12-15 13:57   ` Alexandre Ghiti
@ 2023-12-15 15:38   ` Andy Chiu
  1 sibling, 0 replies; 16+ messages in thread
From: Andy Chiu @ 2023-12-15 15:38 UTC (permalink / raw)
  To: Christoph Muellner
  Cc: linux-riscv, linux-kselftest, linux-kernel, Palmer Dabbelt,
	Paul Walmsley, Albert Ou, Shuah Khan, Philipp Tomsich,
	Andrew Jones, Evan Green, Xiao Wang, Alexandre Ghiti,
	Björn Töpel, Charlie Jenkins

On Fri, Nov 24, 2023 at 2:58 AM Christoph Muellner
<christoph.muellner@vrull.eu> wrote:
>
> From: Christoph Müllner <christoph.muellner@vrull.eu>
>
> GCC raises the following warning:
>   warning: 'status' may be used uninitialized
> The warning comes from the fact, that the signature of waitpid() is
> unknown and therefore the initialization of GCC cannot be guessed.
> Let's add the relevant header to address this warning.
>
> Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>

Reviewed-by: Andy Chiu <andy.chiu@sifive.com>


> ---
>  tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> index 2c0d2b1126c1..1f9969bed235 100644
> --- a/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> +++ b/tools/testing/selftests/riscv/vector/vstate_exec_nolibc.c
> @@ -1,4 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <linux/wait.h>
> +
>  #define THIS_PROGRAM "./vstate_exec_nolibc"
>
>  int main(int argc, char **argv)
> --
> 2.41.0
>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings
  2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
                   ` (5 preceding siblings ...)
  2023-11-24  9:40 ` [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Andrew Jones
@ 2024-01-12  6:30 ` patchwork-bot+linux-riscv
  6 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-01-12  6:30 UTC (permalink / raw)
  To: =?utf-8?q?Christoph_M=C3=BCllner_=3Cchristoph=2Emuellner=40vrull=2Eeu=3E?=
  Cc: linux-riscv, linux-kselftest, linux-kernel, palmer, paul.walmsley,
	aou, shuah, philipp.tomsich, ajones, evan, xiao.w.wang, alexghiti,
	andy.chiu, bjorn, charlie

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 23 Nov 2023 19:58:16 +0100 you wrote:
> From: Christoph Müllner <christoph.muellner@vrull.eu>
> 
> When building the RISC-V selftests with a riscv32 compiler I ran into
> a couple of compiler warnings. While riscv32 support for these tests is
> questionable, the fixes are so trivial that it is probably best to simply
> apply them.
> 
> [...]

Here is the summary with links:
  - [1/5] tools: selftests: riscv: Fix compile warnings in hwprobe
    https://git.kernel.org/riscv/c/b91c26fdb0e8
  - [2/5] tools: selftests: riscv: Fix compile warnings in cbo
    https://git.kernel.org/riscv/c/ac7b2a02d62f
  - [3/5] tools: selftests: riscv: Add missing include for vector test
    https://git.kernel.org/riscv/c/b250c9089841
  - [4/5] tools: selftests: riscv: Fix compile warnings in vector tests
    https://git.kernel.org/riscv/c/e1baf5e68ed1
  - [5/5] tools: selftests: riscv: Fix compile warnings in mm tests
    https://git.kernel.org/riscv/c/12c16919652b

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



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2024-01-12  6:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-23 18:58 [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Christoph Muellner
2023-11-23 18:58 ` [PATCH 1/5] tools: selftests: riscv: Fix compile warnings in hwprobe Christoph Muellner
2023-12-15 13:41   ` Alexandre Ghiti
2023-12-15 13:52   ` Alexandre Ghiti
2023-11-23 18:58 ` [PATCH 2/5] tools: selftests: riscv: Fix compile warnings in cbo Christoph Muellner
2023-12-15 13:54   ` Alexandre Ghiti
2023-11-23 18:58 ` [PATCH 3/5] tools: selftests: riscv: Add missing include for vector test Christoph Muellner
2023-12-15 13:57   ` Alexandre Ghiti
2023-12-15 15:38   ` Andy Chiu
2023-11-23 18:58 ` [PATCH 4/5] tools: selftests: riscv: Fix compile warnings in vector tests Christoph Muellner
2023-12-15 13:44   ` Alexandre Ghiti
2023-11-23 18:58 ` [PATCH 5/5] tools: selftests: riscv: Fix compile warnings in mm tests Christoph Muellner
2023-12-15 13:50   ` Alexandre Ghiti
2023-11-24  9:40 ` [PATCH 0/5] tools: selftests: riscv: Fix compiler warnings Andrew Jones
2023-12-15 10:02   ` Christoph Müllner
2024-01-12  6:30 ` 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