From 8efd7aa6c1671fa7d40c5c43bed140a493cfcf72 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 4 Apr 2024 07:48:48 +0000 Subject: [PATCH] 8328786: [AIX] move some important warnings/errors from trcVerbose to UL Reviewed-by: lucy, stuefe --- src/hotspot/os/aix/libperfstat_aix.cpp | 9 +++---- src/hotspot/os/aix/loadlib_aix.cpp | 13 +++++----- src/hotspot/os/aix/os_aix.cpp | 33 +++++++++++++------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/hotspot/os/aix/libperfstat_aix.cpp b/src/hotspot/os/aix/libperfstat_aix.cpp index 0185d7d041c..5e51e1a7a88 100644 --- a/src/hotspot/os/aix/libperfstat_aix.cpp +++ b/src/hotspot/os/aix/libperfstat_aix.cpp @@ -26,6 +26,7 @@ #include "libperfstat_aix.hpp" #include "misc_aix.hpp" +#include "logging/log.hpp" #include "runtime/os.hpp" #include @@ -76,7 +77,7 @@ bool libperfstat::init() { char ebuf[512]; g_libhandle = os::dll_load(libperfstat, ebuf, sizeof(ebuf)); if (!g_libhandle) { - trcVerbose("Cannot load %s (error: %s)", libperfstat, ebuf); + log_warning(os)("Cannot load %s (error: %s)", libperfstat, ebuf); return false; } @@ -213,7 +214,7 @@ bool libperfstat::get_cpuinfo(cpuinfo_t* pci) { if (-1 == libperfstat::perfstat_cpu_total(nullptr, &psct, sizeof(PERFSTAT_CPU_TOTAL_T_LATEST), 1)) { if (-1 == libperfstat::perfstat_cpu_total(nullptr, &psct, sizeof(perfstat_cpu_total_t_71), 1)) { - trcVerbose("perfstat_cpu_total() failed (errno=%d)", errno); + log_warning(os)("perfstat_cpu_total() failed (errno=%d)", errno); return false; } } @@ -248,7 +249,7 @@ bool libperfstat::get_partitioninfo(partitioninfo_t* ppi) { if (-1 == libperfstat::perfstat_partition_total(nullptr, &pspt, sizeof(PERFSTAT_PARTITON_TOTAL_T_LATEST), 1)) { if (-1 == libperfstat::perfstat_partition_total(nullptr, &pspt, sizeof(perfstat_partition_total_t_71), 1)) { ame_details = false; - trcVerbose("perfstat_partition_total() failed (errno=%d)", errno); + log_warning(os)("perfstat_partition_total() failed (errno=%d)", errno); return false; } } @@ -314,7 +315,7 @@ bool libperfstat::get_wparinfo(wparinfo_t* pwi) { memset (&pswt, '\0', sizeof(pswt)); if (-1 == libperfstat::perfstat_wpar_total(nullptr, &pswt, sizeof(PERFSTAT_WPAR_TOTAL_T_LATEST), 1)) { - trcVerbose("perfstat_wpar_total() failed (errno=%d)", errno); + log_warning(os)("perfstat_wpar_total() failed (errno=%d)", errno); return false; } diff --git a/src/hotspot/os/aix/loadlib_aix.cpp b/src/hotspot/os/aix/loadlib_aix.cpp index bc71ca2e310..107f2783ff5 100644 --- a/src/hotspot/os/aix/loadlib_aix.cpp +++ b/src/hotspot/os/aix/loadlib_aix.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2019 SAP SE. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * Copyright (c) 2022, IBM Corp. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,6 +35,7 @@ #include "loadlib_aix.hpp" #include "misc_aix.hpp" #include "porting_aix.hpp" +#include "logging/log.hpp" #include "utilities/debug.hpp" #include "utilities/ostream.hpp" @@ -194,7 +195,7 @@ static bool reload_table() { if (errno == ENOMEM) { buflen *= 2; } else { - trcVerbose("loadquery failed (%d)", errno); + log_warning(os)("loadquery failed (%d)", errno); goto cleanup; } } else { @@ -211,7 +212,7 @@ static bool reload_table() { loaded_module_t* lm = (loaded_module_t*) ::malloc(sizeof(loaded_module_t)); if (!lm) { - trcVerbose("OOM."); + log_warning(os)("OOM."); goto cleanup; } @@ -224,7 +225,7 @@ static bool reload_table() { lm->path = g_stringlist.add(ldi->ldinfo_filename); if (!lm->path) { - trcVerbose("OOM."); + log_warning(os)("OOM."); free(lm); goto cleanup; } @@ -246,7 +247,7 @@ static bool reload_table() { if (*p_mbr_name) { lm->member = g_stringlist.add(p_mbr_name); if (!lm->member) { - trcVerbose("OOM."); + log_warning(os)("OOM."); free(lm); goto cleanup; } diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index f83b195b986..3309d3aa77e 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -347,7 +347,7 @@ size_t os::Aix::query_pagesize(void* addr) { if (::vmgetinfo(&pi, VM_PAGE_INFO, sizeof(pi)) == 0) { return pi.pagesize; } else { - trcVerbose("vmgetinfo(VM_PAGE_INFO) failed (errno: %d)", errno); + log_warning(pagesize)("vmgetinfo(VM_PAGE_INFO) failed (errno: %d)", errno); assert(false, "vmgetinfo failed to retrieve page size"); return 4*K; } @@ -442,14 +442,13 @@ static void query_multipage_support() { psize_t sizes[MAX_PAGE_SIZES]; const int num_psizes = ::vmgetinfo(sizes, VMINFO_GETPSIZES, MAX_PAGE_SIZES); if (num_psizes == -1) { - trcVerbose("vmgetinfo(VMINFO_GETPSIZES) failed (errno: %d)", errno); - trcVerbose("disabling multipage support."); + log_warning(pagesize)("vmgetinfo(VMINFO_GETPSIZES) failed (errno: %d), disabling multipage support.", errno); g_multipage_support.error = ERROR_MP_VMGETINFO_FAILED; goto query_multipage_support_end; } guarantee(num_psizes > 0, "vmgetinfo(.., VMINFO_GETPSIZES, ...) failed."); assert(num_psizes <= MAX_PAGE_SIZES, "Surprise! more than 4 page sizes?"); - trcVerbose("vmgetinfo(.., VMINFO_GETPSIZES, ...) returns %d supported page sizes: ", num_psizes); + log_info(pagesize)("vmgetinfo(.., VMINFO_GETPSIZES, ...) returns %d supported page sizes: ", num_psizes); for (int i = 0; i < num_psizes; i ++) { trcVerbose(" %s ", describe_pagesize(sizes[i])); } @@ -471,7 +470,7 @@ static void query_multipage_support() { if (::shmctl(shmid, SHM_PAGESIZE, &shm_buf) != 0) { const int en = errno; ::shmctl(shmid, IPC_RMID, nullptr); // As early as possible! - trcVerbose("shmctl(SHM_PAGESIZE) failed with errno=%d", errno); + log_warning(pagesize)("shmctl(SHM_PAGESIZE) failed with errno=%d", errno); } else { // Attach and double check pageisze. void* p = ::shmat(shmid, nullptr, 0); @@ -479,7 +478,7 @@ static void query_multipage_support() { guarantee0(p != (void*) -1); // Should always work. const size_t real_pagesize = os::Aix::query_pagesize(p); if (real_pagesize != pagesize) { - trcVerbose("real page size (" SIZE_FORMAT_X ") differs.", real_pagesize); + log_warning(pagesize)("real page size (" SIZE_FORMAT_X ") differs.", real_pagesize); } else { can_use = true; } @@ -609,7 +608,7 @@ bool os::Aix::get_meminfo(meminfo_t* pmi) { memset (&psmt, '\0', sizeof(psmt)); const int rc = libperfstat::perfstat_memory_total(nullptr, &psmt, sizeof(psmt), 1); if (rc == -1) { - trcVerbose("perfstat_memory_total() failed (errno=%d)", errno); + log_warning(os)("perfstat_memory_total() failed (errno=%d)", errno); assert(0, "perfstat_memory_total() failed"); return false; } @@ -1601,7 +1600,7 @@ static bool uncommit_shmated_memory(char* addr, size_t size) { const bool rc = my_disclaim64(addr, size); if (!rc) { - trcVerbose("my_disclaim64(" PTR_FORMAT ", " UINTX_FORMAT ") failed.\n", p2i(addr), size); + log_warning(os)("my_disclaim64(" PTR_FORMAT ", " UINTX_FORMAT ") failed.\n", p2i(addr), size); return false; } return true; @@ -1791,7 +1790,7 @@ bool os::pd_commit_memory(char* addr, size_t size, bool exec) { guarantee0(vmi); vmi->assert_is_valid_subrange(addr, size); - trcVerbose("commit_memory [" PTR_FORMAT " - " PTR_FORMAT "].", p2i(addr), p2i(addr + size - 1)); + log_info(os)("commit_memory [" PTR_FORMAT " - " PTR_FORMAT "].", p2i(addr), p2i(addr + size - 1)); if (UseExplicitCommit) { // AIX commits memory on touch. So, touch all pages to be committed. @@ -2171,7 +2170,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) { int ret = pthread_setschedparam(thr, policy, ¶m); if (ret != 0) { - trcVerbose("Could not change priority for thread %d to %d (error %d, %s)", + log_warning(os)("Could not change priority for thread %d to %d (error %d, %s)", (int)thr, newpri, ret, os::errno_name(ret)); } return (ret == 0) ? OS_OK : OS_ERR; @@ -2664,10 +2663,10 @@ void os::Aix::initialize_os_info() { memset(&uts, 0, sizeof(uts)); strcpy(uts.sysname, "?"); if (::uname(&uts) == -1) { - trcVerbose("uname failed (%d)", errno); + log_warning(os)("uname failed (%d)", errno); guarantee(0, "Could not determine uname information"); } else { - trcVerbose("uname says: sysname \"%s\" version \"%s\" release \"%s\" " + log_info(os)("uname says: sysname \"%s\" version \"%s\" release \"%s\" " "node \"%s\" machine \"%s\"\n", uts.sysname, uts.version, uts.release, uts.nodename, uts.machine); const int major = atoi(uts.version); @@ -2683,7 +2682,7 @@ void os::Aix::initialize_os_info() { // Determine detailed AIX version: Version, Release, Modification, Fix Level. odmWrapper::determine_os_kernel_version(&_os_version); if (os_version_short() < 0x0701) { - trcVerbose("AIX releases older than AIX 7.1 are not supported."); + log_warning(os)("AIX releases older than AIX 7.1 are not supported."); assert(false, "AIX release too old."); } name_str = "AIX"; @@ -2692,7 +2691,7 @@ void os::Aix::initialize_os_info() { } else { assert(false, "%s", name_str); } - trcVerbose("We run on %s %s", name_str, ver_str); + log_info(os)("We run on %s %s", name_str, ver_str); } guarantee(_os_version, "Could not determine AIX release"); @@ -2717,7 +2716,7 @@ void os::Aix::scan_environment() { trcVerbose("EXTSHM=%s.", p ? p : ""); if (p && strcasecmp(p, "ON") == 0) { _extshm = 1; - trcVerbose("*** Unsupported mode! Please remove EXTSHM from your environment! ***"); + log_warning(os)("*** Unsupported mode! Please remove EXTSHM from your environment! ***"); if (!AllowExtshm) { // We allow under certain conditions the user to continue. However, we want this // to be a fatal error by default. On certain AIX systems, leaving EXTSHM=ON means @@ -2741,7 +2740,7 @@ void os::Aix::scan_environment() { trcVerbose("XPG_SUS_ENV=%s.", p ? p : ""); if (p && strcmp(p, "ON") == 0) { _xpg_sus_mode = 1; - trcVerbose("Unsupported setting: XPG_SUS_ENV=ON"); + log_warning(os)("Unsupported setting: XPG_SUS_ENV=ON"); // This is not supported. Worst of all, it changes behaviour of mmap MAP_FIXED to // clobber address ranges. If we ever want to support that, we have to do some // testing first. @@ -2760,7 +2759,7 @@ void os::Aix::scan_environment() { void os::Aix::initialize_libperfstat() { if (!libperfstat::init()) { - trcVerbose("libperfstat initialization failed."); + log_warning(os)("libperfstat initialization failed."); assert(false, "libperfstat initialization failed"); } else { trcVerbose("libperfstat initialized.");