Bug 1479200 - Exclude graphics shared memory contents from snapshots, r=froydnj.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 31 Jul 2018 19:17:03 +0000
changeset 487617 ea2290c53efc4467947632435a396a99ff2fe33a
parent 487616 e1f22d19eb6933f2ffc3dc9b78b0cf66d8648474
child 487618 172b93b2f60040b79df8461d2b079cf30b459b2b
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1479200
milestone63.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 1479200 - Exclude graphics shared memory contents from snapshots, r=froydnj.
toolkit/recordreplay/MemorySnapshot.cpp
toolkit/recordreplay/MemorySnapshot.h
toolkit/recordreplay/ipc/ChildIPC.cpp
--- a/toolkit/recordreplay/MemorySnapshot.cpp
+++ b/toolkit/recordreplay/MemorySnapshot.cpp
@@ -672,17 +672,17 @@ UnrecoverableSnapshotFailure()
                           /* aIgnoreFailures = */ true);
   }
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // Initial Memory Region Processing
 ///////////////////////////////////////////////////////////////////////////////
 
-static void
+void
 AddInitialUntrackedMemoryRegion(uint8_t* aBase, size_t aSize)
 {
   MOZ_RELEASE_ASSERT(!HasSavedCheckpoint());
 
   if (gInitializationFailureMessage) {
     return;
   }
 
--- a/toolkit/recordreplay/MemorySnapshot.h
+++ b/toolkit/recordreplay/MemorySnapshot.h
@@ -41,16 +41,20 @@ void RestoreWritableFixedMemory(void* aA
 // Allocate memory, trying to use a specific address if provided but only if
 // it is free.
 void* AllocateMemoryTryAddress(void* aAddress, size_t aSize, MemoryKind aKind);
 
 // Note a range of memory that was just allocated from the system, and the
 // kind of memory allocation that was performed.
 void RegisterAllocatedMemory(void* aBaseAddress, size_t aSize, MemoryKind aKind);
 
+// Exclude a region of memory from snapshots, before the first checkpoint has
+// been reached.
+void AddInitialUntrackedMemoryRegion(uint8_t* aBase, size_t aSize);
+
 // Initialize the memory snapshots system.
 void InitializeMemorySnapshots();
 
 // Take the first heap memory snapshot.
 void TakeFirstMemorySnapshot();
 
 // Take a differential heap memory snapshot compared to the last one,
 // associated with the last saved checkpoint.
--- a/toolkit/recordreplay/ipc/ChildIPC.cpp
+++ b/toolkit/recordreplay/ipc/ChildIPC.cpp
@@ -226,16 +226,21 @@ InitRecordingOrReplayingProcess(int* aAr
   kr = mach_vm_map(mach_task_self(), &address, parent::GraphicsMemorySize, 0, VM_FLAGS_ANYWHERE,
                    graphicsPort, 0, false,
                    VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE,
                    VM_INHERIT_NONE);
   MOZ_RELEASE_ASSERT(kr == KERN_SUCCESS);
 
   gGraphicsShmem = (void*) address;
 
+  // The graphics shared memory contents are excluded from snapshots. We do not
+  // want checkpoint restores in this child to interfere with drawing being
+  // performed by another child.
+  AddInitialUntrackedMemoryRegion((uint8_t*) gGraphicsShmem, parent::GraphicsMemorySize);
+
   pt.reset();
 
   // We are ready to receive initialization messages from the middleman, pause
   // so they can be sent.
   HitCheckpoint(CheckpointId::Invalid, /* aRecordingEndpoint = */ false);
 
   // Process the introduction message to fill in arguments.
   MOZ_RELEASE_ASSERT(gParentArgv.empty());