# HG changeset patch # User kbarrett # Date 1544313177 18000 # Node ID bf2f2560dd5354e87c975b994f7c1fa31910d37d # Parent f94276ccc9fc9d6c5b00cf9bafa77d708e9c2e6b 8214315: G1: fatal error: acquiring lock SATB_Q_FL_lock/1 out of order with lock tty_lock/0 Summary: Add new 'tty' lock rank. Reviewed-by: eosterlund, tschatzl diff -r f94276ccc9fc -r bf2f2560dd53 src/hotspot/share/runtime/mutex.cpp --- a/src/hotspot/share/runtime/mutex.cpp Sat Dec 08 17:41:17 2018 +0100 +++ b/src/hotspot/share/runtime/mutex.cpp Sat Dec 08 18:52:57 2018 -0500 @@ -1076,9 +1076,9 @@ Monitor * least = get_least_ranked_lock_besides_this(Self->owned_locks()); assert(least != this, "Specification of get_least_... call above"); if (least != NULL && least->rank() <= special) { - tty->print("Attempting to wait on monitor %s/%d while holding" - " lock %s/%d -- possible deadlock", - name(), rank(), least->name(), least->rank()); + ::tty->print("Attempting to wait on monitor %s/%d while holding" + " lock %s/%d -- possible deadlock", + name(), rank(), least->name(), least->rank()); assert(false, "Shouldn't block(wait) while holding a lock of rank special"); } #endif // ASSERT diff -r f94276ccc9fc -r bf2f2560dd53 src/hotspot/share/runtime/mutex.hpp --- a/src/hotspot/share/runtime/mutex.hpp Sat Dec 08 17:41:17 2018 +0100 +++ b/src/hotspot/share/runtime/mutex.hpp Sat Dec 08 18:52:57 2018 -0500 @@ -87,6 +87,8 @@ // The rank 'access' is similar to 'special' and has the same restrictions on usage. // It is reserved for locks that may be required in order to perform memory accesses // that require special barriers, e.g. SATB GC barriers, that in turn uses locks. + // The rank 'tty' is also similar to 'special' and has the same restrictions. + // It is reserved for the tty_lock. // Since memory accesses should be able to be performed pretty much anywhere // in the code, that requires locks required for performing accesses being // inherently a bit more special than even locks of the 'special' rank. @@ -104,7 +106,8 @@ enum lock_types { event, access = event + 1, - special = access + 2, + tty = access + 2, + special = tty + 1, suspend_resume = special + 1, vmweak = suspend_resume + 2, leaf = vmweak + 2, @@ -236,7 +239,7 @@ #ifndef PRODUCT void print_on(outputStream* st) const; - void print() const { print_on(tty); } + void print() const { print_on(::tty); } DEBUG_ONLY(int rank() const { return _rank; }) bool allow_vm_block() { return _allow_vm_block; } diff -r f94276ccc9fc -r bf2f2560dd53 src/hotspot/share/runtime/mutexLocker.cpp --- a/src/hotspot/share/runtime/mutexLocker.cpp Sat Dec 08 17:41:17 2018 +0100 +++ b/src/hotspot/share/runtime/mutexLocker.cpp Sat Dec 08 18:52:57 2018 -0500 @@ -199,7 +199,7 @@ // Using Padded subclasses to prevent false sharing of these global monitors and mutexes. void mutex_init() { - def(tty_lock , PaddedMutex , event, true, Monitor::_safepoint_check_never); // allow to lock in VM + def(tty_lock , PaddedMutex , tty, true, Monitor::_safepoint_check_never); // allow to lock in VM def(CGC_lock , PaddedMonitor, special, true, Monitor::_safepoint_check_never); // coordinate between fore- and background GC def(STS_lock , PaddedMonitor, leaf, true, Monitor::_safepoint_check_never);