x86/mm: Allow pages typed as log dirty to also be shared
authorAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 1 Dec 2011 14:56:43 +0000 (14:56 +0000)
committerAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 1 Dec 2011 14:56:43 +0000 (14:56 +0000)
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm/mem_sharing.c
xen/include/asm-x86/p2m.h

index e2e5be2ea345405996abe598976809226af309ac..30e84c5d5ed9424bbc724a06f6dd34da19afd319 100644 (file)
@@ -697,6 +697,9 @@ private_page_found:
     /* Update m2p entry */
     set_gpfn_from_mfn(mfn_x(page_to_mfn(page)), gfn);
 
+    /* Now that the gfn<->mfn map is properly established,
+     * marking dirty is feasible */
+    paging_mark_dirty(d, mfn_x(page_to_mfn(page)));
     put_gfn(d, gfn);
     shr_unlock();
     return 0;
index 7a900bf12f0d13190e414f18baf2be6ae97f17af..581cd8155267a5edf7c2b9eacec3c07c5ad83cbe 100644 (file)
@@ -163,7 +163,8 @@ typedef enum {
 /* Shared types */
 /* XXX: Sharable types could include p2m_ram_ro too, but we would need to
  * reinit the type correctly after fault */
-#define P2M_SHARABLE_TYPES (p2m_to_mask(p2m_ram_rw))
+#define P2M_SHARABLE_TYPES (p2m_to_mask(p2m_ram_rw) \
+                            | p2m_to_mask(p2m_ram_logdirty) )
 #define P2M_SHARED_TYPES   (p2m_to_mask(p2m_ram_shared))
 
 /* Broken type: the frame backing this pfn has failed in hardware