8069111: Investigate NMT detail tracking support for 32bit ARM

Fix native stack walking issues arm arm32. Disable on thumb2. Removed support for NMT without NMT detail.

Reviewed-by: dholmes, bdelsart
This commit is contained in:
Chris Plummer 2015-03-10 19:56:19 -07:00
parent 33690bd090
commit 984cf4c9b5
9 changed files with 34 additions and 113 deletions

View File

@ -364,10 +364,6 @@ WB_ENTRY(void, WB_NMTReleaseMemory(JNIEnv* env, jobject o, jlong addr, jlong siz
os::release_memory((char *)(uintptr_t)addr, size);
WB_END
WB_ENTRY(jboolean, WB_NMTIsDetailSupported(JNIEnv* env))
return MemTracker::tracking_level() == NMT_detail;
WB_END
WB_ENTRY(jboolean, WB_NMTChangeTrackingLevel(JNIEnv* env))
// Test that we can downgrade NMT levels but not upgrade them.
if (MemTracker::tracking_level() == NMT_off) {
@ -1252,7 +1248,6 @@ static JNINativeMethod methods[] = {
{CC"NMTCommitMemory", CC"(JJ)V", (void*)&WB_NMTCommitMemory },
{CC"NMTUncommitMemory", CC"(JJ)V", (void*)&WB_NMTUncommitMemory },
{CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory },
{CC"NMTIsDetailSupported",CC"()Z", (void*)&WB_NMTIsDetailSupported},
{CC"NMTChangeTrackingLevel", CC"()Z", (void*)&WB_NMTChangeTrackingLevel},
{CC"NMTGetHashSize", CC"()I", (void*)&WB_NMTGetHashSize },
#endif // INCLUDE_NMT

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, 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
@ -53,11 +53,7 @@ NMT_TrackingLevel MemTracker::init_tracking_level() {
if (strcmp(nmt_option, "summary") == 0) {
level = NMT_summary;
} else if (strcmp(nmt_option, "detail") == 0) {
#if PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
level = NMT_detail;
#else
level = NMT_summary;
#endif // PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
} else if (strcmp(nmt_option, "off") != 0) {
// The option value is invalid
_is_nmt_env_valid = false;
@ -95,17 +91,9 @@ void MemTracker::init() {
bool MemTracker::check_launcher_nmt_support(const char* value) {
if (strcmp(value, "=detail") == 0) {
#if !PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
jio_fprintf(defaultStream::error_stream(),
"NMT detail is not supported on this platform. Using NMT summary instead.\n");
if (MemTracker::tracking_level() != NMT_summary) {
return false;
}
#else
if (MemTracker::tracking_level() != NMT_detail) {
return false;
}
#endif
} else if (strcmp(value, "=summary") == 0) {
if (MemTracker::tracking_level() != NMT_summary) {
return false;

View File

@ -446,15 +446,6 @@ enum RTMState {
# include "globalDefinitions_aarch64.hpp"
#endif
/*
* If a platform does not support native stack walking
* the platform specific globalDefinitions (above)
* can set PLATFORM_NATIVE_STACK_WALKING_SUPPORTED to 0
*/
#ifndef PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
#define PLATFORM_NATIVE_STACK_WALKING_SUPPORTED 1
#endif
// To assure the IRIW property on processors that are not multiple copy
// atomic, sync instructions must be issued between volatile reads to
// assure their ordering, instead of after volatile stores.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015, 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
@ -32,10 +32,6 @@ const NativeCallStack NativeCallStack::EMPTY_STACK(0, false);
NativeCallStack::NativeCallStack(int toSkip, bool fillStack) :
_hash_value(0) {
#if !PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
fillStack = false;
#endif
if (fillStack) {
os::get_native_stack(_stack, NMT_TrackingStackDepth, toSkip);
} else {
@ -95,11 +91,7 @@ void NativeCallStack::print_on(outputStream* out, int indent) const {
int offset;
if (is_empty()) {
for (int index = 0; index < indent; index ++) out->print(" ");
#if PLATFORM_NATIVE_STACK_WALKING_SUPPORTED
out->print("[BOOTSTRAP]");
#else
out->print("[No stack]");
#endif
} else {
for (int frame = 0; frame < NMT_TrackingStackDepth; frame ++) {
pc = get_frame(frame);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, 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
@ -27,7 +27,6 @@
* @summary Test that you can decrease NMT tracking level but not increase it.
* @key nmt
* @library /testlibrary /../../test/lib
* @ignore 8067167
* @build ChangeTrackingLevel
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, 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
@ -27,7 +27,6 @@
* @bug 8005936 8058606
* @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level
* @library /testlibrary
* @ignore 8067167
*/
import com.oracle.java.testlibrary.*;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, 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
@ -46,13 +46,6 @@ public class ThreadedVirtualAllocTestType {
String pid = Integer.toString(ProcessTools.getProcessId());
ProcessBuilder pb = new ProcessBuilder();
boolean has_nmt_detail = wb.NMTIsDetailSupported();
if (has_nmt_detail) {
System.out.println("NMT detail support detected.");
} else {
System.out.println("NMT detail support not detected.");
}
Thread reserveThread = new Thread() {
public void run() {
addr = wb.NMTReserveMemory(reserveSize);
@ -64,9 +57,7 @@ public class ThreadedVirtualAllocTestType {
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=512KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 512KB for Test");
Thread commitThread = new Thread() {
public void run() {
@ -78,9 +69,7 @@ public class ThreadedVirtualAllocTestType {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=512KB, committed=128KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
Thread uncommitThread = new Thread() {
public void run() {
@ -107,4 +96,4 @@ public class ThreadedVirtualAllocTestType {
output.shouldNotContain("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015, 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
@ -49,13 +49,6 @@ public class VirtualAllocCommitUncommitRecommit {
String pid = Integer.toString(ProcessTools.getProcessId());
ProcessBuilder pb = new ProcessBuilder();
boolean has_nmt_detail = wb.NMTIsDetailSupported();
if (has_nmt_detail) {
System.out.println("NMT detail support detected.");
} else {
System.out.println("NMT detail support not detected.");
}
// reserve
addr = wb.NMTReserveMemory(reserveSize);
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid,
@ -63,11 +56,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
long addrA = addr;
long addrB = addr + commitSize;
@ -85,11 +76,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=512KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// uncommit BC
wb.NMTUncommitMemory(addrB, commitSize);
wb.NMTUncommitMemory(addrC, commitSize);
@ -97,11 +86,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=256KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// commit EF
wb.NMTCommitMemory(addrE, commitSize);
@ -109,22 +96,18 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=512KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// uncommit A
wb.NMTUncommitMemory(addrA, commitSize);
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=384KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// commit ABC
wb.NMTCommitMemory(addrA, commitSize);
@ -133,11 +116,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=768KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// uncommit ABCDEF
wb.NMTUncommitMemory(addrA, commitSize);
@ -149,11 +130,9 @@ public class VirtualAllocCommitUncommitRecommit {
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=4096KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
+ Long.toHexString(addr + reserveSize)
+ "\\] reserved 4096KB for Test");
// release
wb.NMTReleaseMemory(addr, reserveSize);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2015, 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
@ -47,30 +47,19 @@ public class VirtualAllocTestType {
String pid = Integer.toString(ProcessTools.getProcessId());
ProcessBuilder pb = new ProcessBuilder();
boolean has_nmt_detail = wb.NMTIsDetailSupported();
if (has_nmt_detail) {
System.out.println("NMT detail support detected.");
} else {
System.out.println("NMT detail support not detected.");
}
addr = wb.NMTReserveMemory(reserveSize);
pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail"});
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=256KB, committed=0KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved 256KB for Test");
wb.NMTCommitMemory(addr, commitSize);
output = new OutputAnalyzer(pb.start());
output.shouldContain("Test (reserved=256KB, committed=128KB)");
if (has_nmt_detail) {
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
}
output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + commitSize) + "\\] committed 128KB");
wb.NMTUncommitMemory(addr, commitSize);
@ -85,4 +74,4 @@ public class VirtualAllocTestType {
output.shouldNotContain("Test (reserved=");
output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved");
}
}
}