RFR: 8288904: Incorrect memory ordering in UL [v2]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Wed Jun 22 19:01:53 UTC 2022
On Wed, 22 Jun 2022 07:45:26 GMT, Johan Sjölén <duke at openjdk.org> wrote:
>> Please review this fix for JDK-8288904, thank you.
>>
>> Passed tier1-tier3 tests, excluding faulty tests.
>
> Johan Sjölén has updated the pull request incrementally with one additional commit since the last revision:
>
> Comment the loadstore
src/hotspot/share/logging/logOutputList.cpp line 51:
> 49: // Prevent mutations to the output list to float above the active reader check.
> 50: // Such a reordering would lead to readers loading faulty data.
> 51: OrderAccess::loadstore();
Just got curious about this memory ordering problem. How can a write after the while loop be executed(and be seen by other threads) without even knowing if we can bail out of the while loop. So I'm thinking that otherwise this program would crash:
volatile int never_touched_variable = 0;
int* address = (int*)0xBADC0FEE;
int main() {
while(never_touched_variable == 0) {}
*address = 1;
return 0;
}
-------------
PR: https://git.openjdk.org/jdk/pull/9225
More information about the hotspot-runtime-dev
mailing list