Bug 1503639 Part 7 - Remove instrumentation used to avoid taking locks after diverging from the recording, r=mccr8.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 31 Oct 2018 10:23:23 -1000
changeset 445256 4319d0b6443bc3c6c2bff061ac01a20060841897
parent 445255 8efe543a747c1fadf44b46f79c121a13c687f81c
child 445257 584368614d2ccb8c4b4af9d088f1f647490f97f9
push id35014
push userdvarga@mozilla.com
push dateFri, 09 Nov 2018 10:01:40 +0000
treeherdermozilla-central@5e7636ec12c5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1503639
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1503639 Part 7 - Remove instrumentation used to avoid taking locks after diverging from the recording, r=mccr8.
ipc/glue/MessageChannel.cpp
toolkit/recordreplay/ipc/ChildIPC.cpp
toolkit/recordreplay/ipc/ChildIPC.h
toolkit/recordreplay/ipc/DisabledIPC.cpp
xpcom/threads/ThreadEventTarget.cpp
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -986,27 +986,16 @@ MessageChannel::Echo(Message* aMsg)
 
     mLink->EchoMessage(msg.release());
     return true;
 }
 
 bool
 MessageChannel::Send(Message* aMsg)
 {
-    if (recordreplay::HasDivergedFromRecording() &&
-        recordreplay::child::SuppressMessageAfterDiverge(aMsg))
-    {
-        // Only certain IPDL messages are allowed to be sent in a replaying
-        // process after it has diverged from the recording, to avoid
-        // deadlocking with threads that remain idle. The browser remains
-        // paused after diverging from the recording, and other IPDL messages
-        // do not need to be sent.
-        return true;
-    }
-
     if (aMsg->size() >= kMinTelemetryMessageSize) {
         Telemetry::Accumulate(Telemetry::IPC_MESSAGE_SIZE2, aMsg->size());
     }
 
     // If the message was created by the IPC bindings, the create time will be
     // recorded. Use this information to report the IPC_WRITE_MAIN_THREAD_LATENCY_MS (time
     // from message creation to it being sent).
     if (NS_IsMainThread() && aMsg->create_time()) {
--- a/toolkit/recordreplay/ipc/ChildIPC.cpp
+++ b/toolkit/recordreplay/ipc/ChildIPC.cpp
@@ -11,20 +11,17 @@
 
 #include "base/message_loop.h"
 #include "base/task.h"
 #include "chrome/common/child_thread.h"
 #include "chrome/common/mach_ipc_mac.h"
 #include "ipc/Channel.h"
 #include "mac/handler/exception_handler.h"
 #include "mozilla/dom/ContentChild.h"
-#include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/ImageDataSerializer.h"
-#include "mozilla/layers/ImageDataSerializer.h"
-#include "mozilla/layers/LayerTransactionChild.h"
 #include "mozilla/Sprintf.h"
 #include "mozilla/VsyncDispatcher.h"
 
 #include "InfallibleVector.h"
 #include "MemorySnapshot.h"
 #include "nsPrintfCString.h"
 #include "ParentInternal.h"
 #include "ProcessRecordReplay.h"
@@ -621,39 +618,16 @@ Repaint(size_t* aWidth, size_t* aHeight)
     *aWidth = gPaintWidth;
     *aHeight = gPaintHeight;
   } else {
     *aWidth = 0;
     *aHeight = 0;
   }
 }
 
-bool
-SuppressMessageAfterDiverge(IPC::Message* aMsg)
-{
-  MOZ_RELEASE_ASSERT(HasDivergedFromRecording());
-
-  // Only messages necessary for compositing can be sent after the sending
-  // thread has diverged from the recording. Sending other messages can risk
-  // deadlocking when a necessary lock is held by an idle thread (we probably
-  // need a more robust way to deal with this problem).
-
-  IPC::Message::msgid_t type = aMsg->type();
-  if (type >= layers::PLayerTransaction::PLayerTransactionStart &&
-      type <= layers::PLayerTransaction::PLayerTransactionEnd) {
-    return false;
-  }
-
-  if (type == layers::PCompositorBridge::Msg_PTextureConstructor__ID) {
-    return false;
-  }
-
-  return true;
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 // Checkpoint Messages
 ///////////////////////////////////////////////////////////////////////////////
 
 // The time when the last HitCheckpoint message was sent.
 static double gLastCheckpointTime;
 
 // When recording and we are idle, the time when we became idle.
--- a/toolkit/recordreplay/ipc/ChildIPC.h
+++ b/toolkit/recordreplay/ipc/ChildIPC.h
@@ -6,18 +6,16 @@
 
 #ifndef mozilla_recordreplay_ChildIPC_h
 #define mozilla_recordreplay_ChildIPC_h
 
 #include "base/process.h"
 #include "mozilla/gfx/2D.h"
 #include "Units.h"
 
-namespace IPC { class Message; }
-
 namespace mozilla {
 
 class VsyncObserver;
 
 namespace recordreplay {
 namespace child {
 
 // This file has the public API for definitions used in facilitating IPC
@@ -51,17 +49,13 @@ bool OnVsync();
 // about to happen, the main thread calls NotifyPaintStart, and when the
 // compositor thread finishes the paint it calls NotifyPaintComplete.
 void NotifyPaintStart();
 void NotifyPaintComplete();
 
 // Get a draw target which the compositor thread can paint to.
 already_AddRefed<gfx::DrawTarget> DrawTargetForRemoteDrawing(LayoutDeviceIntSize aSize);
 
-// Called to ignore IPDL messages sent after diverging from the recording,
-// except for those needed for compositing.
-bool SuppressMessageAfterDiverge(IPC::Message* aMsg);
-
 } // namespace child
 } // namespace recordreplay
 } // namespace mozilla
 
 #endif // mozilla_recordreplay_ChildIPC_h
--- a/toolkit/recordreplay/ipc/DisabledIPC.cpp
+++ b/toolkit/recordreplay/ipc/DisabledIPC.cpp
@@ -70,22 +70,16 @@ NotifyPaintComplete()
 }
 
 already_AddRefed<gfx::DrawTarget>
 DrawTargetForRemoteDrawing(LayoutDeviceIntSize aSize)
 {
   MOZ_CRASH();
 }
 
-bool
-SuppressMessageAfterDiverge(IPC::Message* aMsg)
-{
-  MOZ_CRASH();
-}
-
 } // namespace child
 
 namespace parent {
 
 void
 InitializeUIProcess(int aArgc, char** aArgv)
 {
   // This is called from UI processes, and has no state to initialize if
--- a/xpcom/threads/ThreadEventTarget.cpp
+++ b/xpcom/threads/ThreadEventTarget.cpp
@@ -129,24 +129,16 @@ ThreadEventTarget::Dispatch(already_AddR
     return NS_ERROR_INVALID_ARG;
   }
 
   if (gXPCOMThreadsShutDown && !mIsMainThread) {
     NS_ASSERTION(false, "Failed Dispatch after xpcom-shutdown-threads");
     return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
   }
 
-  // Don't dispatch runnables to other threads when replaying and diverged from
-  // the recording, to avoid deadlocking with other idle threads. The browser
-  // remains paused after diverging from the recording, and threads will not
-  // run their event loops.
-  if (recordreplay::HasDivergedFromRecording()) {
-    return NS_ERROR_FAILURE;
-  }
-
 #ifdef MOZ_TASK_TRACER
   nsCOMPtr<nsIRunnable> tracedRunnable = CreateTracedRunnable(event.take());
   (static_cast<TracedRunnable*>(tracedRunnable.get()))->DispatchTask();
   // XXX tracedRunnable will always leaked when we fail to disptch.
   event = tracedRunnable.forget();
 #endif
 
   if (aFlags & DISPATCH_SYNC) {