[aarch64-port-dev ] RFR(S): 8248851: CMS: Missing memory fences between free chunk check and klass read

Yangfei (Felix) felix.yang at huawei.com
Wed Jul 8 02:49:17 UTC 2020


Hi,

> -----Original Message-----
> From: Kim Barrett [mailto:kim.barrett at oracle.com]
> Sent: Tuesday, July 7, 2020 9:28 PM
> To: Yangfei (Felix) <felix.yang at huawei.com>
> Cc: Andrew Haley <aph at redhat.com>; jdk8u-dev at openjdk.java.net;
> hotspot-gc-dev at openjdk.java.net; aarch64-port-dev at openjdk.java.net
> Subject: Re: [aarch64-port-dev ] RFR(S): 8248851: CMS: Missing memory
> fences between free chunk check and klass read
> 

Cut...

> >
> > Good suggestion.
> > I have prepared a new webrev with the line removed:
> > http://cr.openjdk.java.net/~fyang/8248851/webrev.01/
> > Does it look better?
> >
> > Thanks,
> > Felix
> 
> This change seems needed, but is it sufficient? Seems like there should be a
> corresponding release/storestore/something for the correspnding writes; is
> it there? (I haven't looked at CMS for quite a while, so no longer sure where
> to look.)
 
Yes, I think it's there.  As mention in my first mail, the logic in markNotFree:

void markNotFree() {
     // Set _prev (klass) to null before (if) clearing the mark word below
     _prev = NULL;                                                        <========== Write klass (= NULL)
#ifdef _LP64
     if (UseCompressedOops) {
       OrderAccess::storestore();                             <========== StoreStore barrier
       set_mark(markOopDesc::prototype());    <========== Write marking not free
     }
#endif
     assert(!is_free(), "Error");
}

> This issue seems to persist all the way until CMS removal in JDK 14.

Since CMS is deprecated from JDK9, I am not sure if it's appropriate to fix this issue for those JDK9+ versions.

> Also, there's the closely related JDK-8160369 (JDK 9), which doesn't appear to
> have been backported to JDK 8.

Yeah, we also noticed that and was looking into it to see the possibility of a 8u backport.

Thanks,
Felix


More information about the hotspot-gc-dev mailing list