]> git.proxmox.com Git - mirror_qemu.git/blobdiff - migration/postcopy-ram.c
postcopy: Check for userfault+hugepage feature
[mirror_qemu.git] / migration / postcopy-ram.c
index 6b30b43d518be3237b4d3cb3f3b4c7ed479f99d3..102fb61485e9a46e7de93bec9c51c95e33aa1dd7 100644 (file)
@@ -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