RFR: 8309258: RISC-V: Add riscv_hwprobe syscall [v6]

Fei Yang fyang at openjdk.org
Mon Jun 19 08:07:13 UTC 2023


On Mon, 19 Jun 2023 07:48:54 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

>> src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp line 196:
>> 
>>> 194:         if (strncmp(buf, "uarch", sizeof "uarch" - 1) == 0) {
>>> 195:           ret = os::strdup(p + 2);
>>> 196:           ret[strcspn(p, "\n")] = '\0';
>> 
>> This line was triggering some NMT corruption errors when running tier1 test on unmatched board. I think this should be: `ret[strcspn(ret, "\n")] = '\0';`.
>
> Since ret is identical to 'p' (but larger), the number of chars is identical.
> I don't have a system which return uarch in cpuinfo, and I have not seen one, so I can't test this path.
> What are you testing on?
> 
> 
> rehn at rv:~/source/gdb/binutils-gdb$ uname -a ; grep -i "uarch|mmu" /proc/cpuinfo  | uniq 
> Linux rv 6.2.0-19-generic #19.1-Ubuntu SMP Fri Mar 31 12:41:53 UTC 2023 riscv64 riscv64 riscv64 GNU/Linux
> mmu		: sv48
> 
> 
> 
> I don't mind pushing your suggested change, but I fail to understand how that can fix something :)

Here is dump of file /proc/cpuinfo on hifive unmatched board:

$ cat /proc/cpuinfo
processor       : 0
hart            : 2
isa             : rv64imafdc
mmu             : sv39
uarch           : sifive,u74-mc

processor       : 1
hart            : 1
isa             : rv64imafdc
mmu             : sv39
uarch           : sifive,u74-mc

processor       : 2
hart            : 3
isa             : rv64imafdc
mmu             : sv39
uarch           : sifive,u74-mc

processor       : 3
hart            : 4
isa             : rv64imafdc
mmu             : sv39
uarch           : sifive,u74-mc


Since `ret = os::strdup(p + 2);`, I don't think `ret` and 'p' are identical. And here is what the old code does [1].

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp#LL128-L129

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14445#discussion_r1233678377


More information about the hotspot-dev mailing list