[kvm-unit-tests PATCH v1] configure: arm64: Add support for dirty-ring in migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a new configure option "--dirty-ring-size" to support dirty-ring
migration on arm64. By default, the dirty-ring is disabled, we can
enable it by:

  # ./configure --dirty-ring-size=65536

This will generate one more entry in config.mak, it will look like:

  # cat config.mak
    :
  ACCEL=kvm,dirty-ring-size=65536

With this configure option, user can easy enable dirty-ring and specify
dirty-ring-size to test the dirty-ring in migration.

Signed-off-by: Shaoqin Huang <shahuang@xxxxxxxxxx>
---
 configure | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/configure b/configure
index 6ee9b27..54ce38a 100755
--- a/configure
+++ b/configure
@@ -32,6 +32,7 @@ enable_dump=no
 page_size=
 earlycon=
 efi=
+dirty_ring_size=
 
 # Enable -Werror by default for git repositories only (i.e. developer builds)
 if [ -e "$srcdir"/.git ]; then
@@ -89,6 +90,9 @@ usage() {
 	    --[enable|disable]-efi Boot and run from UEFI (disabled by default, x86_64 and arm64 only)
 	    --[enable|disable]-werror
 	                           Select whether to compile with the -Werror compiler flag
+	    --dirty-ring-size=SIZE
+                             Specify the dirty-ring size and enable dirty-ring for
+                             migration(disable dirty-ring by default, arm64 only)
 EOF
     exit 1
 }
@@ -174,6 +178,9 @@ while [[ "$1" = -* ]]; do
 	--disable-werror)
 	    werror=
 	    ;;
+	--dirty-ring-size)
+	    dirty_ring_size="$arg"
+	    ;;
 	--help)
 	    usage
 	    ;;
@@ -213,6 +220,27 @@ if [ "$efi" ] && [ "$arch" != "x86_64" ] && [ "$arch" != "arm64" ]; then
     usage
 fi
 
+if [ "$dirty_ring_size" ]; then
+    if [ "$arch" != "arm64" ]; then
+        echo "--dirty-ring-size is not supported for $arch"
+        usage
+    fi
+    _size=$dirty_ring_size
+    if [ ! "${_size//[0-9]}" ]; then
+        if (( _size < 1024 )); then
+            echo "--dirty-ring-size suggest minimum value is 1024"
+            usage
+        fi
+        if (( _size & (_size - 1) )); then
+            echo "--dirty-ring-size must be a power of two"
+            usage
+        fi
+    else
+        echo "--dirty-ring-size must be positive number and a power of two"
+        usage
+    fi
+fi
+
 if [ -z "$page_size" ]; then
     if [ "$efi" = 'y' ] && [ "$arch" = "arm64" ]; then
         page_size="4096"
@@ -419,6 +447,9 @@ EOF
 if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then
     echo "TARGET=$target" >> config.mak
 fi
+if [ "$arch" = "arm64" ] && [ "$dirty_ring_size" ]; then
+    echo "ACCEL=kvm,dirty-ring-size=$dirty_ring_size" >> config.mak
+fi
 
 cat <<EOF > lib/config.h
 #ifndef _CONFIG_H_
-- 
2.40.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux