6822370: ReentrantReadWriteLock: threads hung when there are no threads holding onto the lock (Netra x4450)

Tue, 01 Dec 2009 22:29:02 -0500

author
dholmes
date
Tue, 01 Dec 2009 22:29:02 -0500
changeset 1552
95e9083cf4a7
parent 1550
4b966d9946a3
child 1553
3115100553b5

6822370: ReentrantReadWriteLock: threads hung when there are no threads holding onto the lock (Netra x4450)
Summary: This day one bug is caused by missing memory barriers in various Parker::park() paths that can result in lost wakeups and hangs.
Reviewed-by: dice, acorn

src/os/linux/vm/os_linux.cpp file | annotate | diff | comparison | revisions
src/os/solaris/vm/os_solaris.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/os/linux/vm/os_linux.cpp	Wed Nov 25 08:37:04 2009 -0800
     1.2 +++ b/src/os/linux/vm/os_linux.cpp	Tue Dec 01 22:29:02 2009 -0500
     1.3 @@ -4683,6 +4683,7 @@
     1.4    // Return immediately if a permit is available.
     1.5    if (_counter > 0) {
     1.6        _counter = 0 ;
     1.7 +      OrderAccess::fence();
     1.8        return ;
     1.9    }
    1.10  
    1.11 @@ -4725,6 +4726,7 @@
    1.12      _counter = 0;
    1.13      status = pthread_mutex_unlock(_mutex);
    1.14      assert (status == 0, "invariant") ;
    1.15 +    OrderAccess::fence();
    1.16      return;
    1.17    }
    1.18  
    1.19 @@ -4765,6 +4767,7 @@
    1.20      jt->java_suspend_self();
    1.21    }
    1.22  
    1.23 +  OrderAccess::fence();
    1.24  }
    1.25  
    1.26  void Parker::unpark() {
     2.1 --- a/src/os/solaris/vm/os_solaris.cpp	Wed Nov 25 08:37:04 2009 -0800
     2.2 +++ b/src/os/solaris/vm/os_solaris.cpp	Tue Dec 01 22:29:02 2009 -0500
     2.3 @@ -5803,6 +5803,7 @@
     2.4    // Return immediately if a permit is available.
     2.5    if (_counter > 0) {
     2.6        _counter = 0 ;
     2.7 +      OrderAccess::fence();
     2.8        return ;
     2.9    }
    2.10  
    2.11 @@ -5846,6 +5847,7 @@
    2.12      _counter = 0;
    2.13      status = os::Solaris::mutex_unlock(_mutex);
    2.14      assert (status == 0, "invariant") ;
    2.15 +    OrderAccess::fence();
    2.16      return;
    2.17    }
    2.18  
    2.19 @@ -5892,6 +5894,7 @@
    2.20      jt->java_suspend_self();
    2.21    }
    2.22  
    2.23 +  OrderAccess::fence();
    2.24  }
    2.25  
    2.26  void Parker::unpark() {

mercurial