RFR: 8348554: Enhance Linux kernel verions checks

Aleksey Shipilev shade at openjdk.org
Fri Jan 24 09:57:48 UTC 2025


On Fri, 24 Jan 2025 09:04:39 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

> Hi please considered.
> 
> As we have kernel bugs to work around in risc-v, we need a more detailed check.
> See:
> https://github.com/openjdk/jdk/pull/23256
> 
> I updated the names according Linux (major, patch, sub):
> https://github.com/torvalds/linux/blob/bc8198dc7ebc492ec3e9fa1617dcdfbe98e73b17/Makefile#L1313
> 
> And I added a comp func to make these checks easier.
> 
> Manual tested, thanks Robbin

I also fixed a typo in bug synopsis, you need to adjust the PR title a bit too  :)

src/hotspot/os/linux/os_linux.cpp line 381:

> 379: }
> 380: 
> 381: void os::Linux::kernel_version(long* major, long* patch, long* sub) {

I think semver calls these "major", "minor", "patch".

src/hotspot/os/linux/os_linux.cpp line 392:

> 390:     return;
> 391:   }
> 392:   int nr_matched = sscanf(buffer.release, "%ld.%ld.%ld", major, patch, sub);

Are we sure the kernel version always have 3 components? It would be safer to handle 2-component version as well, and set the third component to `0` in that case.

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

PR Comment: https://git.openjdk.org/jdk/pull/23291#issuecomment-2612111445
PR Review Comment: https://git.openjdk.org/jdk/pull/23291#discussion_r1928424156
PR Review Comment: https://git.openjdk.org/jdk/pull/23291#discussion_r1928423474


More information about the hotspot-runtime-dev mailing list