Skip to contentSkip to conversation

RISC-V: hwprobe: Couple fixes found on late review

PATCH Applied Andrew Jones 4 participants 6 messages Apr 26, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

cover RISC-V: hwprobe: Couple fixes found on late review

I didn't get a chance to take a close look at "[PATCH v6 0/6] RISC-V Hardware Probing User Interface" until now. I spotted a couple issues while looking and this series collects the fixes.

Andrew Jones (2):
RISC-V: hwprobe: There can only be one first
RISC-V: hwprobe: Explicity check for -1 in vdso init

 arch/riscv/kernel/sys_riscv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Signature · 7 lines
2.39.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

PATCH 1/2 RISC-V: hwprobe: There can only be one first

Only capture the first cpu_id in order for the comparison below to be of any use.

Fixes ea3de9ce8aa2 ("RISC-V: Add a syscall for HW probing")
---
 arch/riscv/kernel/sys_riscv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/riscv/kernel/sys_riscv.c +3 -1
index 849b4170629d..c569dac7452e 100644
@@ -103,8 +103,10 @@ static void hwprobe_arch_id(struct riscv_hwprobe *pair,
 			break;
 		}
 
-		if (first)
+		if (first) {
 			id = cpu_id;
+			first = false;
+		}
 
 		/*
 		 * If there's a mismatch for the given set, return -1 in the
Signature · 7 lines
2.39.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#2 lore raw

PATCH 2/2 RISC-V: hwprobe: Explicity check for -1 in vdso init

In reply to Andrew Jones

id_bitsmash is unsigned. We need to explicitly check for -1, rather than use > 0.

Fixes aa5af0aa90ba ("RISC-V: Add hwprobe vDSO function and data")
---
 arch/riscv/kernel/sys_riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/sys_riscv.c +1 -1
index c569dac7452e..5db29683ebee 100644
@@ -282,7 +282,7 @@ static int __init init_hwprobe_vdso_data(void)
 	 * populated) or any value returns -1 (varies across CPUs), then the
 	 * vDSO should defer to the kernel for exotic cpu masks.
 	 */
-	avd->homogeneous_cpus = (id_bitsmash > 0);
+	avd->homogeneous_cpus = id_bitsmash != 0 && id_bitsmash != -1;
 	return 0;
 }
 
Signature · 7 lines
2.39.2


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by on the v1 series
#3 lore raw
In reply to Andrew Jones
Quoted 3 lines · Andrew Jones

I didn't get a chance to take a close look at "[PATCH v6 0/6] RISC-V Hardware Probing User Interface" until now. I spotted a couple issues while looking and this series collects the fixes.

Both seem fair..

Thanks,
Conor.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

Reviewed-by on the v1 series
#4 lore raw
In reply to Andrew Jones
Quoted 9 lines · Andrew Jones

I didn't get a chance to take a close look at "[PATCH v6 0/6] RISC-V Hardware Probing User Interface" until now. I spotted a couple issues while looking and this series collects the fixes.

Andrew Jones (2):
RISC-V: hwprobe: There can only be one first
RISC-V: hwprobe: Explicity check for -1 in vdso init

Quoted 5 lines
 arch/riscv/kernel/sys_riscv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--
2.39.2

Sigh, wish I had spotted these. Thanks!

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#5 lore raw
In reply to Andrew Jones
Quoted 9 lines · Andrew Jones

I didn't get a chance to take a close look at "[PATCH v6 0/6] RISC-V Hardware Probing User Interface" until now. I spotted a couple issues while looking and this series collects the fixes.

Andrew Jones (2):
RISC-V: hwprobe: There can only be one first
RISC-V: hwprobe: Explicity check for -1 in vdso init

[...]

Applied, thanks!

[1/2] RISC-V: hwprobe: There can only be one first

      https://git.kernel.org/palmer/c/08dc10759468
[2/2] RISC-V: hwprobe: Explicity check for -1 in vdso init
      https://git.kernel.org/palmer/c/b09313dd2e72

Best regards,

Signature · 7 lines
Palmer Dabbelt <[email protected]>


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv