Index: /trunk/src/VBox/VMM/PGMHandler.cpp
===================================================================
--- /trunk/src/VBox/VMM/PGMHandler.cpp	(revision 20150)
+++ /trunk/src/VBox/VMM/PGMHandler.cpp	(revision 20151)
@@ -388,13 +388,10 @@
         if (enmType != PGMVIRTHANDLERTYPE_HYPERVISOR)
         {
+            PVMCPU pVCpu = VMMGetCpu(pVM);
+
             pVM->pgm.s.fPhysCacheFlushPending = true;
-            for (unsigned i=0;i<pVM->cCPUs;i++)
-            {
-                PVMCPU pVCpu = &pVM->aCpus[i];
-
-                pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL;
-                VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
-            }
-            pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL;
+
+            pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL | PGM_SYNC_CLEAR_PGM_POOL;
+            VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
         }
         pgmUnlock(pVM);
@@ -475,12 +472,8 @@
          * Schedule CR3 sync.
          */
-        for (unsigned i=0;i<pVM->cCPUs;i++)
-        {
-            PVMCPU pVCpu = &pVM->aCpus[i];
-
-            pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL;
-            VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
-        }
-        pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL;
+        PVMCPU pVCpu = VMMGetCpu(pVM);
+
+        pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_UPDATE_PAGE_BIT_VIRTUAL | PGM_SYNC_CLEAR_PGM_POOL;
+        VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
     }
     else
Index: /trunk/src/VBox/VMM/PGMInternal.h
===================================================================
--- /trunk/src/VBox/VMM/PGMInternal.h	(revision 20150)
+++ /trunk/src/VBox/VMM/PGMInternal.h	(revision 20151)
@@ -2224,9 +2224,4 @@
     bool                            afAlignment0[7];
 
-    /** What needs syncing (PGM_SYNC_*).
-     * This is used to queue operations for PGMSyncCR3, PGMInvalidatePage,
-     * PGMFlushTLB, and PGMR3Load. */
-    RTUINT                          fGlobalSyncFlags;
-
     /*
      * This will be redefined at least two more times before we're done, I'm sure.
@@ -2917,6 +2912,6 @@
 #define PGM_SYNC_MAP_CR3                        RT_BIT(3)
 /** Clear the page pool (a light weight flush). */
-#define PGM_GLOBAL_SYNC_CLEAR_PGM_POOL_BIT      8
-#define PGM_GLOBAL_SYNC_CLEAR_PGM_POOL          RT_BIT(PGM_GLOBAL_SYNC_CLEAR_PGM_POOL_BIT)
+#define PGM_SYNC_CLEAR_PGM_POOL_BIT             8
+#define PGM_SYNC_CLEAR_PGM_POOL                 RT_BIT(PGM_SYNC_CLEAR_PGM_POOL_BIT)
 /** @} */
 
@@ -2983,5 +2978,5 @@
 void            pgmPoolClearAll(PVM pVM);
 PPGMPOOLPAGE    pgmPoolGetPage(PPGMPOOL pPool, RTHCPHYS HCPhys);
-int             pgmPoolSyncCR3(PVM pVM);
+int             pgmPoolSyncCR3(PVMCPU pVCpu);
 int             pgmPoolTrackFlushGCPhys(PVM pVM, PPGMPAGE pPhysPage, bool *pfFlushTLBs);
 uint16_t        pgmPoolTrackPhysExtAddref(PVM pVM, uint16_t u16, uint16_t iShwPT);
Index: /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 20150)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAll.cpp	(revision 20151)
@@ -1774,5 +1774,5 @@
      * clear the whole thing.
      */
-    rc = pgmPoolSyncCR3(pVM);
+    rc = pgmPoolSyncCR3(pVCpu);
     if (rc != VINF_SUCCESS)
         return rc;
@@ -1833,5 +1833,5 @@
 #ifdef IN_RING3
         if (rc == VINF_PGM_SYNC_CR3)
-            rc = pgmPoolSyncCR3(pVM);
+            rc = pgmPoolSyncCR3(pVCpu);
 #else
         if (rc == VINF_PGM_SYNC_CR3)
Index: /trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp	(revision 20150)
+++ /trunk/src/VBox/VMM/VMMAll/PGMAllPool.cpp	(revision 20151)
@@ -1746,5 +1746,5 @@
          * the heap size should suffice. */
         AssertFatalMsgRC(rc, ("PGMHandlerPhysicalRegisterEx %RGp failed with %Rrc\n", GCPhysPage, rc));
-        Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3));
+        Assert(!(VMMGetCpu(pVM)->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3));
     }
     pPage->fMonitored = true;
@@ -1843,6 +1843,9 @@
         rc = PGMHandlerPhysicalDeregister(pVM, pPage->GCPhys & ~(RTGCPHYS)(PAGE_SIZE - 1));
         AssertFatalRC(rc);
-        AssertMsg(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3),
-                  ("%#x %#x\n", pVM->pgm.s.fGlobalSyncFlags, pVM->fGlobalForcedActions));
+#ifdef VBOX_STRICT
+        PVMCPU pVCpu = VMMGetCpu(pVM);
+#endif
+        AssertMsg(!(pVCpu->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL) || VMCPU_FF_ISSET(pVCpu, VMCPU_FF_PGM_SYNC_CR3),
+                  ("%#x %#x\n", pVCpu->pgm.s.fSyncFlags, pVM->fGlobalForcedActions));
     }
     pPage->fMonitored = false;
@@ -2075,4 +2078,12 @@
 #endif
 
+    /* Clear the PGM_SYNC_CLEAR_PGM_POOL flag on all VCPUs to prevent redundant flushes. */
+    for (unsigned idCpu = 0; idCpu < pVM->cCPUs; idCpu++)
+    {
+        PVMCPU pVCpu = &pVM->aCpus[idCpu];
+
+        pVCpu->pgm.s.fSyncFlags &= ~PGM_SYNC_CLEAR_PGM_POOL;
+    }
+
     pPool->cPresent = 0;
     pgmUnlock(pVM);
@@ -2090,10 +2101,11 @@
  * @retval  VINF_SUCCESS if successfully added.
  * @retval  VINF_PGM_SYNC_CR3 is it needs to be deferred to ring 3 (GC only)
- * @param   pVM     The VM handle.
+ * @param   pVCpu     The VMCPU handle.
  * @remark  Should only be used when monitoring is available, thus placed in
  *          the PGMPOOL_WITH_MONITORING #ifdef.
  */
-int pgmPoolSyncCR3(PVM pVM)
-{
+int pgmPoolSyncCR3(PVMCPU pVCpu)
+{
+    PVM pVM = pVCpu->CTX_SUFF(pVM);
     LogFlow(("pgmPoolSyncCR3\n"));
     /*
@@ -2104,12 +2116,12 @@
      */
 # ifdef IN_RING3 /* Don't flush in ring-0 or raw mode, it's taking too long. */
-    if (ASMBitTestAndClear(&pVM->pgm.s.fGlobalSyncFlags, PGM_GLOBAL_SYNC_CLEAR_PGM_POOL_BIT))
+    if (ASMBitTestAndClear(&pVCpu->pgm.s.fSyncFlags, PGM_SYNC_CLEAR_PGM_POOL_BIT))
     {
         VMMR3AtomicExecuteHandler(pVM, pgmPoolClearAll, NULL);
 # else  /* !IN_RING3 */
-    if (pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL)
-    {
-        LogFlow(("SyncCR3: PGM_GLOBAL_SYNC_CLEAR_PGM_POOL is set -> VINF_PGM_SYNC_CR3\n"));
-        VMCPU_FF_SET(VMMGetCpu(pVM), VMCPU_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */
+    if (pVCpu->pgm.s.fSyncFlags & PGM_SYNC_CLEAR_PGM_POOL)
+    {
+        LogFlow(("SyncCR3: PGM_SYNC_CLEAR_PGM_POOL is set -> VINF_PGM_SYNC_CR3\n"));
+        VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3); /** @todo no need to do global sync, right? */
         return VINF_PGM_SYNC_CR3;
 # endif /* !IN_RING3 */
@@ -2749,5 +2761,5 @@
     if (rc == VINF_PGM_GCPHYS_ALIASED)
     {
-        pVM->pgm.s.fGlobalSyncFlags |= PGM_GLOBAL_SYNC_CLEAR_PGM_POOL;
+        pVCpu->pgm.s.fSyncFlags |= PGM_SYNC_CLEAR_PGM_POOL;
         VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
         rc = VINF_PGM_SYNC_CR3;
@@ -4048,5 +4060,5 @@
     /** @todo CSAM/PGMPrefetchPage messes up here during CSAMR3CheckGates
      *  (TRPMR3SyncIDT) because of FF priority. Try fix that?
-     *  Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_GLOBAL_SYNC_CLEAR_PGM_POOL)); */
+     *  Assert(!(pVM->pgm.s.fGlobalSyncFlags & PGM_SYNC_CLEAR_PGM_POOL)); */
 
     pgmLock(pVM);
Index: /trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp
===================================================================
--- /trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp	(revision 20150)
+++ /trunk/src/VBox/VMM/testcase/tstVMStructGC.cpp	(revision 20151)
@@ -475,5 +475,4 @@
     GEN_CHECK_OFF(PGM, offVCpuPGM);
     GEN_CHECK_OFF(PGM, fRamPreAlloc);
-    GEN_CHECK_OFF(PGM, fGlobalSyncFlags);
     GEN_CHECK_OFF(PGM, paDynPageMap32BitPTEsGC);
     GEN_CHECK_OFF(PGM, paDynPageMapPaePTEsGC);
