diff mbox

[RFC,1/4] migration/postcopy-ram: check pagefault flags in userfaultfd thread

Message ID 20170309113437.9667-2-c.pinto@virtualopensystems.com
State New
Headers show

Commit Message

Christian Pinto March 9, 2017, 11:34 a.m. UTC
The UFFD_PAGEFAULT_FLAG_WP should be set every time the page fault is due to a
write to a write-protected page. Flag should be checked at every time
to be sure the page fault is due to a write into WP area.

Signed-off-by: Christian Pinto <c.pinto@virtualopensystems.com>
Signed-off-by: Baptiste Reynal <b.reynal@virtualopensystems.com>
---
 migration/postcopy-ram.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index ea70bd5d16..9c45f1059f 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -534,7 +534,12 @@  static void *postcopy_ram_fault_thread(void *opaque)
                 migrate_send_rp_req_pages(mis, NULL,
                                           rb_offset, hostpagesize);
             }
-        } else { /* UFFDIO_REGISTER_MODE_WP */
+        } else if (msg.arg.pagefault.flags &
+                    UFFD_PAGEFAULT_FLAG_WP) { /* UFFDIO_REGISTER_MODE_WP */
+            /*
+             * msg.arg.pagefault.flags &UFFD_PAGEFAULT_FLAG_WP expected to
+             * be set in case of pagefault due to write protected page
+             * */
             MigrationState *ms = container_of(us, MigrationState,
                                               userfault_state);
             ret = ram_save_queue_pages(ms, qemu_ram_get_idstr(rb), rb_offset,