8069111: Investigate NMT detail tracking support for 32bit ARM
Summary: Fix native stack walking issues arm arm32. Disable on thumb2. Removed support for NMT without NMT detail.
Reviewed-by: dholmes, bdelsart
--- a/hotspot/src/share/vm/prims/whitebox.cpp Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/src/share/vm/prims/whitebox.cpp Tue Mar 10 19:56:19 2015 -0700
@@ -364,10 +364,6 @@
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 @@
{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
--- a/hotspot/src/share/vm/services/memTracker.cpp Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/src/share/vm/services/memTracker.cpp Tue Mar 10 19:56:19 2015 -0700
@@ -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 @@
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 @@
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;
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Tue Mar 10 19:56:19 2015 -0700
@@ -446,15 +446,6 @@
# 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.
--- a/hotspot/src/share/vm/utilities/nativeCallStack.cpp Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/src/share/vm/utilities/nativeCallStack.cpp Tue Mar 10 19:56:19 2015 -0700
@@ -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 @@
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 @@
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);
--- a/hotspot/test/runtime/NMT/ChangeTrackingLevel.java Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/test/runtime/NMT/ChangeTrackingLevel.java Tue Mar 10 19:56:19 2015 -0700
@@ -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
--- a/hotspot/test/runtime/NMT/PrintNMTStatistics.java Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/test/runtime/NMT/PrintNMTStatistics.java Tue Mar 10 19:56:19 2015 -0700
@@ -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.*;
--- a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java Tue Mar 10 19:56:19 2015 -0700
@@ -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 @@
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 @@
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 @@
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 @@
output.shouldNotContain("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved");
}
- }
+}
--- a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java Tue Mar 10 19:56:19 2015 -0700
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
--- a/hotspot/test/runtime/NMT/VirtualAllocTestType.java Thu Mar 12 19:34:50 2015 -0400
+++ b/hotspot/test/runtime/NMT/VirtualAllocTestType.java Tue Mar 10 19:56:19 2015 -0700
@@ -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 @@
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 @@
output.shouldNotContain("Test (reserved=");
output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) + "\\] reserved");
}
- }
+}