RFR: 8368781: PerfMemory - make issues more transparent [v2]
Matthias Baesken
mbaesken at openjdk.org
Thu Oct 16 14:05:03 UTC 2025
On Tue, 14 Oct 2025 03:41:05 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Make EnhanceErrorWarningLogging DIAGNOSTIC
>
> We already have some UL in PerfMemory:
>> 8168122: Update logging in perfMemory to Unified Logging
> Summary: -XX:+PerfTraceMemOps replaced with -Xlog:perf+memops=debug, -XX:+PerfTraceDataCreation replaced with -Xlog:perf+datacreation=debug
>
> but for some reason that effort completely ignored the PrintMiscellaneous/Verbose "warnings". To keep things simple I suggest the following pattern:
>
> diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp
> index ed83487265c..968f3cea249 100644
> --- a/src/hotspot/os/posix/perfMemory_posix.cpp
> +++ b/src/hotspot/os/posix/perfMemory_posix.cpp
> @@ -447,10 +447,11 @@ static char* get_user_name(uid_t uid) {
> int result = getpwuid_r(uid, &pwent, pwbuf, (size_t)bufsize, &p);
>
> if (result != 0 || p == nullptr || p->pw_name == nullptr || *(p->pw_name) == '\0') {
> - if (PrintMiscellaneous && Verbose) {
> + if (log_is_enabled(Debug, perf)) {
> + LogStreamHandle(Debug, perf) log;
> if (result != 0) {
> - warning("Could not retrieve passwd entry: %s\n",
> - os::strerror(result));
> + log.print_cr("Could not retrieve passwd entry: %s",
> + os::strerror(result));
> }
> else if (p == nullptr) {
> // this check is added to protect against an observed problem
> @@ -463,13 +464,13 @@ static char* get_user_name(uid_t uid) {
> // message may result in an erroneous message.
> // Bug Id 89052 was opened with RedHat.
> //
> - warning("Could not retrieve passwd entry: %s\n",
> - os::strerror(errno));
> + log.print_cr("Could not retrieve passwd entry: %s",
> + os::strerror(errno));
> }
> else {
> - warning("Could not determine user name: %s\n",
> - p->pw_name == nullptr ? "pw_name = null" :
> - "pw_name zero length");
> + log.print_cr("Could not determine user name: %s",
> + p->pw_name == nullptr ? "pw_name = null" :
> + "pw_name zero length");
> }
> }
> FREE_C_HEAP_ARRAY(char, pwbuf);
>
> Of course you proposed changes as a potential consumer of this information, so how would you like to procure it?
@dholmes-ora while looking into the Windows perfmem code, I noticed we are using SetSecurityDescriptorControl
https://github.com/openjdk/jdk/blob/1653999871c8d7b1e61b44f8525e09b2cd0bdb6b/src/hotspot/os/windows/perfMemory_windows.cpp#L1016
but we use still handling for ancient Windows versions (we use dynamic handling of the function at runtime), should we remove this ?
Looking at the description
https://learn.microsoft.com/en-us/windows/win32/api/securitybaseapi/nf-securitybaseapi-setsecuritydescriptorcontrol
it is available at least since Win2003/XP so the function can be called directly (would do this in a separate JBS issue).
What do you think ?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27602#issuecomment-3411049767
More information about the hotspot-runtime-dev
mailing list