This commit is contained in:
Coleen Phillimore 2016-04-07 21:24:12 +00:00
commit c66cf8bde7
22 changed files with 206 additions and 300 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/java.hpp"
#include "runtime/os.hpp"
@ -368,36 +369,38 @@ void VM_Version::initialize() {
FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
}
if (PrintMiscellaneous && Verbose) {
tty->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
tty->print_cr("L2 data cache line size: %u", L2_data_cache_line_size());
tty->print("Allocation");
if (log_is_enabled(Info, os, cpu)) {
ResourceMark rm;
outputStream* log = Log(os, cpu)::info_stream();
log->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
log->print_cr("L2 data cache line size: %u", L2_data_cache_line_size());
log->print("Allocation");
if (AllocatePrefetchStyle <= 0) {
tty->print_cr(": no prefetching");
log->print(": no prefetching");
} else {
tty->print(" prefetching: ");
log->print(" prefetching: ");
if (AllocatePrefetchInstr == 0) {
tty->print("PREFETCH");
log->print("PREFETCH");
} else if (AllocatePrefetchInstr == 1) {
tty->print("BIS");
log->print("BIS");
}
if (AllocatePrefetchLines > 1) {
tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
log->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
} else {
tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
log->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
}
}
if (PrefetchCopyIntervalInBytes > 0) {
tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
log->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
}
if (PrefetchScanIntervalInBytes > 0) {
tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
log->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
}
if (PrefetchFieldsAhead > 0) {
tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
log->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
}
if (ContendedPaddingWidth > 0) {
tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
log->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
}
}
}
@ -408,7 +411,7 @@ void VM_Version::print_features() {
int VM_Version::determine_features() {
if (UseV8InstrsOnly) {
if (PrintMiscellaneous && Verbose) { tty->print_cr("Version is Forced-V8"); }
log_info(os, cpu)("Version is Forced-V8");
return generic_v8_m;
}
@ -416,7 +419,7 @@ int VM_Version::determine_features() {
if (features == unknown_m) {
features = generic_v9_m;
warning("Cannot recognize SPARC version. Default to V9");
log_info(os)("Cannot recognize SPARC version. Default to V9");
}
assert(is_T_family(features) == is_niagara(features), "Niagara should be T series");
@ -424,12 +427,12 @@ int VM_Version::determine_features() {
if (is_T_family(features)) {
// Happy to accomodate...
} else {
if (PrintMiscellaneous && Verbose) { tty->print_cr("Version is Forced-Niagara"); }
log_info(os, cpu)("Version is Forced-Niagara");
features |= T_family_m;
}
} else {
if (is_T_family(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
if (PrintMiscellaneous && Verbose) { tty->print_cr("Version is Forced-Not-Niagara"); }
log_info(os, cpu)("Version is Forced-Not-Niagara");
features &= ~(T_family_m | T1_model_m);
} else {
// Happy to accomodate...

View File

@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/java.hpp"
#include "runtime/os.hpp"
@ -1223,59 +1224,60 @@ void VM_Version::get_processor_features() {
}
#ifndef PRODUCT
if (PrintMiscellaneous && Verbose) {
tty->print_cr("Logical CPUs per core: %u",
if (log_is_enabled(Info, os, cpu)) {
outputStream* log = Log(os, cpu)::info_stream();
log->print_cr("Logical CPUs per core: %u",
logical_processors_per_package());
tty->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
tty->print("UseSSE=%d", (int) UseSSE);
log->print_cr("L1 data cache line size: %u", L1_data_cache_line_size());
log->print("UseSSE=%d", (int) UseSSE);
if (UseAVX > 0) {
tty->print(" UseAVX=%d", (int) UseAVX);
log->print(" UseAVX=%d", (int) UseAVX);
}
if (UseAES) {
tty->print(" UseAES=1");
log->print(" UseAES=1");
}
#ifdef COMPILER2
if (MaxVectorSize > 0) {
tty->print(" MaxVectorSize=%d", (int) MaxVectorSize);
log->print(" MaxVectorSize=%d", (int) MaxVectorSize);
}
#endif
tty->cr();
tty->print("Allocation");
log->cr();
log->print("Allocation");
if (AllocatePrefetchStyle <= 0 || UseSSE == 0 && !supports_3dnow_prefetch()) {
tty->print_cr(": no prefetching");
log->print_cr(": no prefetching");
} else {
tty->print(" prefetching: ");
log->print(" prefetching: ");
if (UseSSE == 0 && supports_3dnow_prefetch()) {
tty->print("PREFETCHW");
log->print("PREFETCHW");
} else if (UseSSE >= 1) {
if (AllocatePrefetchInstr == 0) {
tty->print("PREFETCHNTA");
log->print("PREFETCHNTA");
} else if (AllocatePrefetchInstr == 1) {
tty->print("PREFETCHT0");
log->print("PREFETCHT0");
} else if (AllocatePrefetchInstr == 2) {
tty->print("PREFETCHT2");
log->print("PREFETCHT2");
} else if (AllocatePrefetchInstr == 3) {
tty->print("PREFETCHW");
log->print("PREFETCHW");
}
}
if (AllocatePrefetchLines > 1) {
tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
log->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
} else {
tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
log->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
}
}
if (PrefetchCopyIntervalInBytes > 0) {
tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
log->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
}
if (PrefetchScanIntervalInBytes > 0) {
tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
log->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
}
if (PrefetchFieldsAhead > 0) {
tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
log->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
}
if (ContendedPaddingWidth > 0) {
tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
log->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
}
}
#endif // !PRODUCT

View File

@ -3612,14 +3612,12 @@ jint os::init_2(void) {
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
perror("os::init_2 getrlimit failed");
log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno));
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode))
perror("os::init_2 setrlimit failed");
log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno));
}
}
}

View File

@ -3459,25 +3459,13 @@ jint os::init_2(void) {
guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
os::set_polling_page(polling_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
(intptr_t)polling_page);
}
#endif
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
if (!UseMembar) {
address mem_serialize_page = (address) ::mmap(NULL, Bsd::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
(intptr_t)mem_serialize_page);
}
#endif
log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
}
// initialize suspend/resume support - must do this before signal_sets_init()
@ -3519,9 +3507,7 @@ jint os::init_2(void) {
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 getrlimit failed");
}
log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno));
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
@ -3534,9 +3520,7 @@ jint os::init_2(void) {
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 setrlimit failed");
}
log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno));
}
}
}

View File

@ -2163,7 +2163,7 @@ static bool print_model_name_and_flags(outputStream* st, char* buf, size_t bufle
bool model_name_printed = false;
if (strstr(buf, "model name") != NULL) {
if (!model_name_printed) {
st->print_raw("\nCPU Model and flags from /proc/cpuinfo:\n");
st->print_raw("CPU Model and flags from /proc/cpuinfo:\n");
st->print_raw(buf);
model_name_printed = true;
} else {
@ -4671,25 +4671,13 @@ jint os::init_2(void) {
guarantee(polling_page != MAP_FAILED, "os::init_2: failed to allocate polling page");
os::set_polling_page(polling_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
(intptr_t)polling_page);
}
#endif
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
if (!UseMembar) {
address mem_serialize_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
guarantee(mem_serialize_page != MAP_FAILED, "mmap Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
(intptr_t)mem_serialize_page);
}
#endif
log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
}
// initialize suspend/resume support - must do this before signal_sets_init()
@ -4732,10 +4720,8 @@ jint os::init_2(void) {
#endif
Linux::libpthread_init();
if (PrintMiscellaneous && (Verbose || WizardMode)) {
tty->print_cr("[HotSpot is running with %s, %s]\n",
Linux::glibc_version(), Linux::libpthread_version());
}
log_info(os)("HotSpot is running with %s, %s",
Linux::glibc_version(), Linux::libpthread_version());
if (UseNUMA) {
if (!Linux::libnuma_init()) {
@ -4776,16 +4762,12 @@ jint os::init_2(void) {
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 getrlimit failed");
}
log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno));
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 setrlimit failed");
}
log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno));
}
}
}

View File

@ -2754,13 +2754,13 @@ char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
pd_unmap_memory(addr, bytes);
}
if (PrintMiscellaneous && Verbose) {
if (log_is_enabled(Warning, os)) {
char buf[256];
buf[0] = '\0';
if (addr == NULL) {
jio_snprintf(buf, sizeof(buf), ": %s", os::strerror(err));
}
warning("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at "
log_info(os)("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at "
PTR_FORMAT ": reserve_memory_helper returned " PTR_FORMAT
"%s", bytes, requested_addr, addr, buf);
}
@ -2790,9 +2790,7 @@ char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
assert(i > 0, "gap adjustment code problem");
have_adjusted_gap = true; // adjust the gap only once, just in case
gap = actual_gap;
if (PrintMiscellaneous && Verbose) {
warning("attempt_reserve_memory_at: adjusted gap to 0x%lx", gap);
}
log_info(os)("attempt_reserve_memory_at: adjusted gap to 0x%lx", gap);
unmap_memory(base[i], bytes);
unmap_memory(base[i-1], size[i-1]);
i-=2;
@ -2824,8 +2822,8 @@ char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
} else {
size_t bottom_overlap = base[i] + bytes - requested_addr;
if (bottom_overlap >= 0 && bottom_overlap < bytes) {
if (PrintMiscellaneous && Verbose && bottom_overlap == 0) {
warning("attempt_reserve_memory_at: possible alignment bug");
if (bottom_overlap == 0) {
log_info(os)("attempt_reserve_memory_at: possible alignment bug");
}
unmap_memory(requested_addr, bottom_overlap);
size[i] = bytes - bottom_overlap;
@ -4355,8 +4353,8 @@ static pset_getloadavg_type pset_getloadavg_ptr = NULL;
void init_pset_getloadavg_ptr(void) {
pset_getloadavg_ptr =
(pset_getloadavg_type)dlsym(RTLD_DEFAULT, "pset_getloadavg");
if (PrintMiscellaneous && Verbose && pset_getloadavg_ptr == NULL) {
warning("pset_getloadavg function not found");
if (pset_getloadavg_ptr == NULL) {
log_warning(os)("pset_getloadavg function not found");
}
}
@ -4439,25 +4437,13 @@ jint os::init_2(void) {
}
os::set_polling_page(polling_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
(intptr_t)polling_page);
}
#endif
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
if (!UseMembar) {
address mem_serialize_page = (address)Solaris::mmap_chunk(NULL, page_size, MAP_PRIVATE, PROT_READ | PROT_WRITE);
guarantee(mem_serialize_page != NULL, "mmap Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
(intptr_t)mem_serialize_page);
}
#endif
log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
}
// Check minimum allowable stack size for thread creation and to initialize
@ -4537,16 +4523,12 @@ jint os::init_2(void) {
struct rlimit nbr_files;
int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 getrlimit failed");
}
log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno));
} else {
nbr_files.rlim_cur = nbr_files.rlim_max;
status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("os::init_2 setrlimit failed");
}
log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno));
}
}
}

View File

@ -2436,14 +2436,10 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
bool res = os::protect_memory((char*) page_start, page_size,
os::MEM_PROT_RWX);
if (PrintMiscellaneous && Verbose) {
char buf[256];
jio_snprintf(buf, sizeof(buf), "Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s", addr,
page_start, (res ? "success" : os::strerror(errno)));
tty->print_raw_cr(buf);
}
log_debug(os)("Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s", p2i(addr),
p2i(page_start), (res ? "success" : os::strerror(errno)));
// Set last_addr so if we fault again at the same address, we don't
// end up in an endless loop.
@ -2896,12 +2892,12 @@ static bool numa_interleaving_init() {
NUMAInterleaveGranularity = align_size_up(NUMAInterleaveGranularity, min_interleave_granularity);
if (numa_node_list_holder.build()) {
if (PrintMiscellaneous && Verbose) {
tty->print("NUMA UsedNodeCount=%d, namely ", numa_node_list_holder.get_count());
if (log_is_enabled(Debug, os, cpu)) {
Log(os, cpu) log;
log.debug("NUMA UsedNodeCount=%d, namely ", numa_node_list_holder.get_count());
for (int i = 0; i < numa_node_list_holder.get_count(); i++) {
tty->print("%d ", numa_node_list_holder.get_node_list_entry(i));
log.debug(" %d ", numa_node_list_holder.get_node_list_entry(i));
}
tty->print("\n");
}
success = true;
} else {
@ -4119,13 +4115,7 @@ jint os::init_2(void) {
guarantee(return_page != NULL, "Commit Failed for polling page");
os::set_polling_page(polling_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[SafePoint Polling address: " INTPTR_FORMAT "]\n",
(intptr_t)polling_page);
}
#endif
log_info(os)("SafePoint Polling address: " INTPTR_FORMAT, p2i(polling_page));
if (!UseMembar) {
address mem_serialize_page = (address)VirtualAlloc(NULL, os::vm_page_size(), MEM_RESERVE, PAGE_READWRITE);
@ -4135,13 +4125,7 @@ jint os::init_2(void) {
guarantee(return_page != NULL, "Commit Failed for memory serialize page");
os::set_memory_serialize_page(mem_serialize_page);
#ifndef PRODUCT
if (Verbose && PrintMiscellaneous) {
tty->print("[Memory Serialize Page address: " INTPTR_FORMAT "]\n",
(intptr_t)mem_serialize_page);
}
#endif
log_info(os)("Memory Serialize Page address: " INTPTR_FORMAT, p2i(mem_serialize_page));
}
// Setup Windows Exceptions
@ -4769,10 +4753,7 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
hFile = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == NULL) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("CreateFile() failed: GetLastError->%ld.", err);
}
log_info(os)("CreateFile() failed: GetLastError->%ld.", GetLastError());
return NULL;
}
@ -4790,10 +4771,7 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
base = (char*) VirtualAlloc(addr, bytes, MEM_COMMIT | MEM_RESERVE,
PAGE_READWRITE);
if (base == NULL) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("VirtualAlloc() failed: GetLastError->%ld.", err);
}
log_info(os)("VirtualAlloc() failed: GetLastError->%ld.", GetLastError());
CloseHandle(hFile);
return NULL;
}
@ -4807,10 +4785,7 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
// number of bytes were read before returning.
bool res = ReadFile(hFile, base, (DWORD)bytes, &bytes_read, &overlapped) != 0;
if (!res) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("ReadFile() failed: GetLastError->%ld.", err);
}
log_info(os)("ReadFile() failed: GetLastError->%ld.", GetLastError());
release_memory(base, bytes);
CloseHandle(hFile);
return NULL;
@ -4819,10 +4794,7 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_WRITECOPY, 0, 0,
NULL /* file_name */);
if (hMap == NULL) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("CreateFileMapping() failed: GetLastError->%ld.", err);
}
log_info(os)("CreateFileMapping() failed: GetLastError->%ld.", GetLastError());
CloseHandle(hFile);
return NULL;
}
@ -4831,20 +4803,14 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
base = (char*)MapViewOfFileEx(hMap, access, 0, (DWORD)file_offset,
(DWORD)bytes, addr);
if (base == NULL) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("MapViewOfFileEx() failed: GetLastError->%ld.", err);
}
log_info(os)("MapViewOfFileEx() failed: GetLastError->%ld.", GetLastError());
CloseHandle(hMap);
CloseHandle(hFile);
return NULL;
}
if (CloseHandle(hMap) == 0) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("CloseHandle(hMap) failed: GetLastError->%ld.", err);
}
log_info(os)("CloseHandle(hMap) failed: GetLastError->%ld.", GetLastError());
CloseHandle(hFile);
return base;
}
@ -4856,10 +4822,7 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
bool res = VirtualProtect(base, bytes, exec_access, &old_protect) != 0;
if (!res) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("VirtualProtect() failed: GetLastError->%ld.", err);
}
log_info(os)("VirtualProtect() failed: GetLastError->%ld.", GetLastError());
// Don't consider this a hard error, on IA32 even if the
// VirtualProtect fails, we should still be able to execute
CloseHandle(hFile);
@ -4868,10 +4831,7 @@ char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
}
if (CloseHandle(hFile) == 0) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("CloseHandle(hFile) failed: GetLastError->%ld.", err);
}
log_info(os)("CloseHandle(hFile) failed: GetLastError->%ld.", GetLastError());
return base;
}
@ -4904,10 +4864,7 @@ char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
bool os::pd_unmap_memory(char* addr, size_t bytes) {
MEMORY_BASIC_INFORMATION mem_info;
if (VirtualQuery(addr, &mem_info, sizeof(mem_info)) == 0) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("VirtualQuery() failed: GetLastError->%ld.", err);
}
log_info(os)("VirtualQuery() failed: GetLastError->%ld.", GetLastError());
return false;
}
@ -4924,10 +4881,7 @@ bool os::pd_unmap_memory(char* addr, size_t bytes) {
BOOL result = UnmapViewOfFile(addr);
if (result == 0) {
if (PrintMiscellaneous && Verbose) {
DWORD err = GetLastError();
tty->print_cr("UnmapViewOfFile() failed: GetLastError->%ld.", err);
}
log_info(os)("UnmapViewOfFile() failed: GetLastError->%ld.", GetLastError());
return false;
}
return true;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2014 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -184,9 +184,7 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec
if (os::Aix::chained_handler(sig, info, ucVoid)) {
return 1;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
warning("Ignoring SIGPIPE - see bug 4229104");
}
// Ignoring SIGPIPE - see bugs 4229104
return 1;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -469,11 +469,7 @@ JVM_handle_bsd_signal(int sig,
if (os::Bsd::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see bugs 4229104 or 646499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}
@ -728,14 +724,10 @@ JVM_handle_bsd_signal(int sig,
bool res = os::protect_memory((char*) page_start, page_size,
os::MEM_PROT_RWX);
if (PrintMiscellaneous && Verbose) {
char buf[256];
jio_snprintf(buf, sizeof(buf), "Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s, errno=%d", addr,
page_start, (res ? "success" : "failed"), errno);
tty->print_raw_cr(buf);
}
log_debug(os)("Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s, errno=%d", p2i(addr),
p2i(page_start), (res ? "success" : "failed"), errno);
stub = pc;
// Set last_addr so if we fault again at the same address, we don't end

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -159,11 +159,7 @@ JVM_handle_bsd_signal(int sig,
if (os::Bsd::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see bugs 4229104 or 646499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -270,11 +270,7 @@ JVM_handle_linux_signal(int sig,
if (os::Linux::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see bugs 4229104 or 646499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -198,9 +198,7 @@ JVM_handle_linux_signal(int sig,
if (os::Linux::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
warning("Ignoring SIGPIPE - see bug 4229104");
}
// Ignoring SIGPIPE - see bugs 4229104
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -561,11 +561,7 @@ JVM_handle_linux_signal(int sig,
if (os::Linux::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see bugs 4229104 or 646499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,12 +66,12 @@ int VM_Version::platform_features(int features) {
features = generic_v9_m;
if (detect_niagara()) {
if (PrintMiscellaneous && Verbose) { tty->print_cr("Detected Linux on Niagara"); }
log_info(os, cpu)("Detected Linux on Niagara");
features = niagara1_m | T_family_m;
}
if (detect_M_family()) {
if (PrintMiscellaneous && Verbose) { tty->print_cr("Detected Linux on M family"); }
log_info(os, cpu)("Detected Linux on M family");
features = sun4v_m | generic_v9_m | M_family_m | T_family_m;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -287,11 +287,7 @@ JVM_handle_linux_signal(int sig,
if (os::Linux::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see bugs 4229104 or 646499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}
@ -542,14 +538,10 @@ JVM_handle_linux_signal(int sig,
bool res = os::protect_memory((char*) page_start, page_size,
os::MEM_PROT_RWX);
if (PrintMiscellaneous && Verbose) {
char buf[256];
jio_snprintf(buf, sizeof(buf), "Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s, errno=%d", addr,
page_start, (res ? "success" : "failed"), errno);
tty->print_raw_cr(buf);
}
log_debug(os)("Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s, errno=%d", p2i(addr),
p2i(page_start), (res ? "success" : "failed"), errno);
stub = pc;
// Set last_addr so if we fault again at the same address, we don't end
@ -645,12 +637,8 @@ bool os::supports_sse() {
int major = strtol(uts.release,&minor_string,10);
int minor = strtol(minor_string+1,NULL,10);
bool result = (major > 2 || (major==2 && minor >= 4));
#ifndef PRODUCT
if (PrintMiscellaneous && Verbose) {
tty->print("OS version is %d.%d, which %s support SSE/SSE2\n",
log_info(os)("OS version is %d.%d, which %s support SSE/SSE2",
major,minor, result ? "DOES" : "does NOT");
}
#endif
return result;
#endif // AMD64
}
@ -939,9 +927,7 @@ void os::workaround_expand_exec_shield_cs_limit() {
MemTracker::record_virtual_memory_type((address)codebuf, mtInternal);
if (PrintMiscellaneous && (Verbose || WizardMode)) {
tty->print_cr("[CS limit NX emulation work-around, exec code at: %p]", codebuf);
}
log_info(os)("[CS limit NX emulation work-around, exec code at: %p]", codebuf);
// Some code to exec: the 'ret' instruction
codebuf[0] = 0xC3;

View File

@ -154,11 +154,7 @@ JVM_handle_linux_signal(int sig,
if (os::Linux::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see bugs 4229104 or 646499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -338,12 +338,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
if (os::Solaris::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see 4229104 or 6499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "logging/log.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
#include "runtime/os.hpp"
@ -361,15 +362,10 @@ int VM_Version::platform_features(int features) {
assert(avn <= 2, "should return two or less av's");
uint_t av = avs[0];
#ifndef PRODUCT
if (PrintMiscellaneous && Verbose) {
tty->print("getisax(2) returned: " PTR32_FORMAT, av);
if (avn > 1) {
tty->print(", " PTR32_FORMAT, avs[1]);
}
tty->cr();
log_info(os, cpu)("getisax(2) returned: " PTR32_FORMAT, av);
if (avn > 1) {
log_info(os, cpu)(" " PTR32_FORMAT, avs[1]);
}
#endif
if (av & AV_SPARC_MUL32) features |= hardware_mul32_m;
if (av & AV_SPARC_DIV32) features |= hardware_div32_m;
@ -464,11 +460,7 @@ int VM_Version::platform_features(int features) {
if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
has_implementation = true;
#ifndef PRODUCT
if (PrintMiscellaneous && Verbose) {
tty->print_cr("cpu_info.implementation: %s", implementation);
}
#endif
log_info(os, cpu)("cpu_info.implementation: %s", implementation);
features |= parse_features(implementation);
break;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -403,12 +403,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
if (os::Solaris::chained_handler(sig, info, ucVoid)) {
return true;
} else {
if (PrintMiscellaneous && (WizardMode || Verbose)) {
char buf[64];
warning("Ignoring %s - see 4229104 or 6499219",
os::exception_name(sig, buf, sizeof(buf)));
}
// Ignoring SIGPIPE/SIGXFSZ - see bugs 4229104 or 6499219
return true;
}
}
@ -640,14 +635,10 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
bool res = os::protect_memory((char*) page_start, page_size,
os::MEM_PROT_RWX);
if (PrintMiscellaneous && Verbose) {
char buf[256];
jio_snprintf(buf, sizeof(buf), "Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s, errno=%d", addr,
page_start, (res ? "success" : "failed"), errno);
tty->print_raw_cr(buf);
}
log_debug(os)("Execution protection violation "
"at " INTPTR_FORMAT
", unguarding " INTPTR_FORMAT ": %s, errno=%d", p2i(addr),
p2i(page_start), (res ? "success" : "failed"), errno);
stub = pc;
// Set last_addr so if we fault again at the same address, we don't end

View File

@ -377,7 +377,7 @@ void Test_loghandle_on() {
assert(log_handle.is_debug(), "assert");
// Try to log trough a LogHandle.
// Try to log through a LogHandle.
log_handle.debug("%d workers", 3);
FILE* fp = fopen(log_file.name(), "r");
@ -408,7 +408,7 @@ void Test_loghandle_off() {
return;
}
// Try to log trough a LogHandle. Should fail, since only info is turned on.
// Try to log through a LogHandle. Should fail, since only info is turned on.
log_handle.debug("%d workers", 3);
// Log a dummy line so that fgets doesn't return NULL because the file is empty.
@ -440,7 +440,7 @@ static void Test_logtargethandle_on() {
assert(log_handle.is_enabled(), "assert");
// Try to log trough a LogHandle.
// Try to log through a LogHandle.
log_handle.print("%d workers", 3);
FILE* fp = fopen(log_file.name(), "r");
@ -471,7 +471,7 @@ static void Test_logtargethandle_off() {
return;
}
// Try to log trough a LogHandle. Should fail, since only info is turned on.
// Try to log through a LogHandle. Should fail, since only info is turned on.
log_handle.print("%d workers", 3);
// Log a dummy line so that fgets doesn't return NULL because the file is empty.

View File

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "code/codeCacheExtensions.hpp"
#include "logging/log.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/arguments.hpp"
@ -274,12 +275,12 @@ unsigned int Abstract_VM_Version::jvm_version() {
void VM_Version_init() {
VM_Version::initialize();
#ifndef PRODUCT
if (PrintMiscellaneous && Verbose) {
char buf[512];
os::print_cpu_info(tty, buf, sizeof(buf));
if (log_is_enabled(Info, os, cpu)) {
char buf[1024];
ResourceMark rm;
outputStream* log = Log(os, cpu)::info_stream();
os::print_cpu_info(log, buf, sizeof(buf));
}
#endif
}
unsigned int Abstract_VM_Version::nof_parallel_worker_threads(

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8151939
* @summary os+cpu output should contain some os,cpu information
* @library /testlibrary
* @modules java.base/sun.misc
* java.management
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools
* @run driver OsCpuLoggingTest
*/
import java.io.File;
import java.util.Map;
import jdk.test.lib.*;
public class OsCpuLoggingTest {
static void analyzeOutputForOsLog(OutputAnalyzer output) throws Exception {
// Aix has it's own logging
if (!Platform.isAix()) {
output.shouldContain("SafePoint Polling address");
}
output.shouldHaveExitValue(0);
}
static void analyzeOutputForOsCpuLog(OutputAnalyzer output) throws Exception {
output.shouldContain("CPU:total");
output.shouldHaveExitValue(0);
}
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+cpu", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
analyzeOutputForOsCpuLog(output);
pb = ProcessTools.createJavaProcessBuilder("-Xlog:os", "-version");
output = new OutputAnalyzer(pb.start());
analyzeOutputForOsLog(output);
}
}