RFR: 8300645: Handle julong values in logging of GET_CONTAINER_INFO macros [v2]
Ioi Lam
iklam at openjdk.org
Wed Feb 15 15:37:28 UTC 2023
On Wed, 15 Feb 2023 14:51:50 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Please review this change to Hotspot's container detection code. It adjusts the `GET_CONTAINER_INFO` macro to account for the fact that the return type, and thus the format for logging, being unsigned. Thanks to @iklam for the suggestion.
>>
>> This fixes an oddity where on error, i.e. a file doesn't exist a negative number is being returned from the `GET_CONTAINER_INFO` macro, which potentially logs values. This results in incorrect log output as `-2` gets converted to `unsigned long` and printed according to that format.
>>
>> Testing:
>> - [x] Container tests on x86_64 fastdebug with cgroup v1 (legacy), with and without `swapaccount=0`.
>> - [x] Container tests on x86_64 fastdebug with cgroup v2 (unified), with and without `swapaccount=0`.
>> - [x] Added regression test. Fails on cg v1 with `swappaccount=0` on unpatched. Passes after this patch.
>> - [x] GHA (only unrelated failures in [compiler/vectorization/runner*](https://github.com/jerboaa/jdk/actions/runs/3989491372#user-content-compiler_vectorization_runner_arrayindexfilltest) on x86 - 32 bit and MacOSX x64)
>
> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
>
> - Fix the GET_CONTAINER_INFO macro
>
> Previously it would not take in a log_fmt argument and would, therefore,
> format OS_CONTAINER_ERROR according to the log format string passed in,
> potentially being JULONG_FORMAT. Now with the format passed in
> explicitly it's possible to use a different format for the log line
> if OS_CONTAINER_ERROR is being returned ('%d'). For the actual log line
> in the non-error case no observable differences would be seen.
>
> NOTE: GET_CONTAINER_INFO_LINE would not need the change as it's not
> logging OS_CONTAINER_ERROR with a user-supplied format.
> - Remove conditional in trace log call
> - Reboot patch to original but keep reg-test
> - Revert "Refactor checked values reading into separate functions"
>
> This reverts commit 627e07067fefb0a44f8d6d14b3c4843b20e92bcb.
> - Merge branch 'master' into jdk-8300645-revert-julong-get-container
> - Refactor checked values reading into separate functions
> - Merge branch 'master' into jdk-8300645-revert-julong-get-container
> - 8300645: Revert julong changes from 8194232 after 8292083
Looks good to me. Thanks for taking my suggestions.
-------------
Marked as reviewed by iklam (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12166
More information about the hotspot-runtime-dev
mailing list