summary refs log tree commit diff stats
path: root/migration/postcopy-ram.c
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2017-02-24 18:28:42 +0000
committerDr. David Alan Gilbert <dgilbert@redhat.com>2017-02-28 11:30:24 +0000
commit7e8cafb7137502ce006cc48d0265f89399e0cb33 (patch)
treefafbd64bbe29329ad0246098fd893411ce653cec /migration/postcopy-ram.c
parent61a502128bc81df154ecaa7d42dc075832b169e8 (diff)
downloadfocaccia-qemu-7e8cafb7137502ce006cc48d0265f89399e0cb33.tar.gz
focaccia-qemu-7e8cafb7137502ce006cc48d0265f89399e0cb33.zip
postcopy: Check for userfault+hugepage feature
We need extra Linux kernel support (~4.11) to support userfaults
on hugetlbfs; check for them.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20170224182844.32452-15-dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/postcopy-ram.c')
-rw-r--r--migration/postcopy-ram.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 6b30b43d51..102fb61485 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -81,6 +81,17 @@ static bool ufd_version_check(int ufd)
         return false;
     }
 
+    if (getpagesize() != ram_pagesize_summary()) {
+        bool have_hp = false;
+        /* We've got a huge page */
+#ifdef UFFD_FEATURE_MISSING_HUGETLBFS
+        have_hp = api_struct.features & UFFD_FEATURE_MISSING_HUGETLBFS;
+#endif
+        if (!have_hp) {
+            error_report("Userfault on this host does not support huge pages");
+            return false;
+        }
+    }
     return true;
 }
 
@@ -115,7 +126,6 @@ bool postcopy_ram_supported_by_host(void)
     if (!ufd_version_check(ufd)) {
         goto out;
     }
-    /* TODO: Only allow huge pages if the kernel supports it */
 
     /*
      * userfault and mlock don't go together; we'll put it back later if