Commit b8146576 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

Reland "[test] Avoid disabling of RCS during runtime"

This is a reland of 11045926

The first version of this CL uncovered a TSAN failure when not disabling
RCS anymore. The problem was that a background thread was still updating
RCS counters, while the main thread already dumped those values during
tear down. This CL fixes this by dumping counters only after all
background threads are stopped.

Original change's description:
> [test] Avoid disabling of RCS during runtime
>
> Test was flaky since disabling of RCS at runtime is unsafe. Some code
> (e.g. TRACE_GC) is run only in case RCS is enabled and such code paths
> might also DCHECK that RCS is enabled.
> A background thread (sweeping in this case) could've already
> entered such a code path right before RCS is disabled. In this case the
> guard at the entry still saw that RCS is enabled but subsequent DCHECKs
> that ensure that RCS is enabled might fail.
>
> We could fix this by completing the sweeper tasks before disabling RCS
> but there might be other similar tasks which might be run at that point
> in the future (e.g. memory unmapper).
>
> Disabling the flag doesn't even seem to be needed for the initial
> regression test, so it seems simpler to just not disable RCS anymore.
>
> Bug: v8:12026
> Change-Id: I878f7dd9a7a4abb6a501f7a7651a1240ef2082a6
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3162043
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#76845}

Bug: v8:12026, v8:12234
Change-Id: I5cb577051d188d17b02ca7da79a3f1d9aa646cae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3162050
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76859}
parent 0fe20577
......@@ -3115,8 +3115,6 @@ void Isolate::Deinit() {
// All client isolates should already be detached.
DCHECK_NULL(client_isolate_head_);
DumpAndResetStats();
if (FLAG_print_deopt_stress) {
PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_);
}
......@@ -3156,6 +3154,10 @@ void Isolate::Deinit() {
// This stops cancelable tasks (i.e. concurrent marking tasks)
cancelable_task_manager()->CancelAndWait();
// After all concurrent tasks are stopped, we know for sure that stats aren't
// updated anymore.
DumpAndResetStats();
main_thread_local_isolate_->heap()->FreeLinearAllocationArea();
if (shared_isolate_) {
......
......@@ -7318,7 +7318,6 @@ TEST(Regress11181) {
v8::HandleScope scope(CcTest::isolate());
GenerateGarbage();
CcTest::CollectAllAvailableGarbage();
TracingFlags::runtime_stats.store(0, std::memory_order_relaxed);
}
TEST(LongTaskStatsFullAtomic) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment