JDK-8079315 : UseCondCardMark broken in conjunction with CMS precleaning on x86
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 8u60,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-05-05
  • Updated: 2019-06-26
  • Resolved: 2015-06-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b72Fixed
Related Reports
Blocks :  
Relates :  
Description
When using conditional card marking in conjunction with CMS precleaning, the conditional card mark check may float above the store of the reference, using invalid information to skip card marking, causing it to loose card updates.

I.e.
mutator:

x.a = something
StoreStore
if (card[@x.a] != dirty) {
  card[@x.a] = dirty
}

preclean:

if (card[@x.a] == dirty) {
  card[@x.a] = precleaned
}
storeload/loadstore/loadload
read x.a

The storestore barrier in the mutator code does not prevent the check whether the card is dirty to be executed above setting the value in the memory. So the update might get lost because the mutator might see dirty, the preclean thread sets it to preclean, examines the memory and only then the mutator updates the memory.

The storestore synchronization in the mutator is insufficient.

This bug has been in hotspot with CMS since UseCondCardMark code for that has been added to C2.
Comments
ILW = High (potential crash), Low, Low = P4
05-05-2015

The StoreStore synchronization is sufficient if UseCondCardMark is disabled (the default). Also CMS precleaning is enabled by default. Link to relevant openjdk discussion: http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2015-April/013105.html
05-05-2015

Suggested by Mikael G: the method for the mutator could be changed to x.a = something StoreStore if (card[@x.a] != clean) { card[@x.a] = dirty } according to http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2015-April/013178.html
05-05-2015