RFR: 8352185: Shenandoah: Invalid logic for remembered set verification [v3]
Xiaolong Peng
xpeng at openjdk.org
Wed Mar 19 00:48:31 UTC 2025
> There are some scenarios in which GenShen may have improper remembered set verification logic:
>
> 1. Concurrent young cycles following a Full GC:
>
> In the end of ShenandoahFullGC, it resets bitmaps for the entire heap w/o resetting marking context to be incomplete, but ShenandoahVerifier has code like below to get a complete old marking context for remembered set verification
>
>
> ShenandoahVerifier
> ShenandoahMarkingContext* ShenandoahVerifier::get_marking_context_for_old() {
> shenandoah_assert_generations_reconciled();
> if (_heap->old_generation()->is_mark_complete() || _heap->gc_generation()->is_global()) {
> return _heap->complete_marking_context();
> }
> return nullptr;
> }
>
>
> For the concurrent young GC cycles after a full GC, the old marking context used for remembered set verification is stale, and may cause unexpected result.
>
> 2. For the impl of `ShenandoahVerifier::get_marking_context_for_old` mentioned above, it always return a marking context for global GC, but marking bitmaps is already reset before before init-mark, `ShenandoahVerifier::help_verify_region_rem_set` always skip verification in this case.
>
> 3. ShenandoahConcurrentGC always clean remembered set read table, but only swap read/write table when gc generation is young, this issue causes remembered set verification before init-mark to use a completely clean remembered set, but it is covered by issue 2.
>
>
> ### Test
> - [x] `make test TEST=hotspot_gc_shenandoah`
Xiaolong Peng has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
- Merge branch 'openjdk:master' into JDK-8345399-v3
- Address review comments
- Clean and rebuild rem-set in global gc
- Set mark incomplete after ShenandoahMCResetCompleteBitmapTask
- Only clean rem-set read table in young gc; not verify rem-set in concurrent global GC in generational mode
- Always swap card table in generational mode so the table can be properly rebuilt through marking.
- Initial works
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/24092/files
- new: https://git.openjdk.org/jdk/pull/24092/files/021f2fef..4726b876
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=24092&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=24092&range=01-02
Stats: 54221 lines in 805 files changed: 27210 ins; 17485 del; 9526 mod
Patch: https://git.openjdk.org/jdk/pull/24092.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24092/head:pull/24092
PR: https://git.openjdk.org/jdk/pull/24092
More information about the shenandoah-dev
mailing list