Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8288904

Incorrect memory ordering in UL

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • b09
    • aarch64

      LogOutputList::wait_until_no_readers has two bugs:

      1. It doesn't use Atomic::load to access _active_readers even though _active_readers is stored to using Atomic::store.

      2. There's a missing OrderAccess::loadstore at the end to prevent stores from moving above the while loop.

      This is buggy on ARM (reminder: independent loads and stores are allowed to be moved freely).

      This might be the cause of JDK-8287420, but as I can't reproduce that ticket I cannot show that this is the case. Therefore, I am making a separate ticket for this fix.


      To illustrate the issue, consider this (inlined) call to wait_until_no_readers in LogOutputList::remove_output.

      OrderAccess::storeload();
      while (_active_readers != 0) {
         // Busy wait
      }
      delete node;

      An ARM processor is allowed to do this:

      OrderAccess::storeload();
      delete node;
      while (_active_readers != 0) {
         // Busy wait
      }

      Ouch!

            jsjolen Johan Sjölen
            jsjolen Johan Sjölen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: