Skip to contentSkip to conversation

configure: arm64: Add support for dirty-ring in migration

PATCH In review Shaoqin Huang 3 participants 6 messages Oct 26, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: arm64: Add support for dirty-ring in migration

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.

---
 configure | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
configure +31 -0
index 6ee9b27..54ce38a 100755
@@ -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_
Signature · 1 line
2.40.1
#1 lore raw
Quoted 6 lines · Shaoqin Huang

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
Quoted 8 lines

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.

Do we really need a separate configure switch for this? If it is just about setting a value in the ACCEL variable, you can also run the tests like this:

ACCEL=kvm,dirty-ring-size=65536 ./run_tests.sh

Thomas

#2 lore raw
Quoted 13 lines · Thomas Huth
Quoted 12 lines · Shaoqin Huang

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
Quoted 9 lines
Quoted 2 lines

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

Do we really need a separate configure switch for this? If it is just about setting a value in the ACCEL variable, you can also run the tests like this:

ACCEL=kvm,dirty-ring-size=65536 ./run_tests.sh

 Thomas

Hi Thomas,

You're right. We can do it by simply set the ACCEL when execute ./run_tests.sh. I think maybe add a configure can make auto test to set the dirty-ring easier? but I'm not 100% sure it will benefit to them.

Thanks,
Shaoqin

Signature · 1 line
Shaoqin
#3 lore raw
Quoted 25 lines · Shaoqin Huang
Quoted 22 lines · Thomas Huth
Quoted 6 lines · Shaoqin Huang

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
Quoted 8 lines

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.

Do we really need a separate configure switch for this? If it is just about setting a value in the ACCEL variable, you can also run the tests like this:

ACCEL=kvm,dirty-ring-size=65536 ./run_tests.sh

Quoted 9 lines
Quoted 2 lines

 Thomas

Hi Thomas,

You're right. We can do it by simply set the ACCEL when execute ./run_tests.sh. I think maybe add a configure can make auto test to set the dirty-ring easier? but I'm not 100% sure it will benefit to them.

For unit tests that require specific configurations, those configurations should be added to the unittests.cfg file. As we don't currently support adding accel properties, we should add a new parameter and extend the parsing.

Thanks,
drew

#4 lore raw

Hi drew,

Quoted 36 lines · Andrew Jones
Quoted 25 lines · Shaoqin Huang
Quoted 22 lines · Thomas Huth
Quoted 6 lines · Shaoqin Huang

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
Quoted 8 lines

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.

Do we really need a separate configure switch for this? If it is just about setting a value in the ACCEL variable, you can also run the tests like this:

ACCEL=kvm,dirty-ring-size=65536 ./run_tests.sh

Quoted 9 lines
Quoted 2 lines

 Thomas

Hi Thomas,

You're right. We can do it by simply set the ACCEL when execute ./run_tests.sh. I think maybe add a configure can make auto test to set the dirty-ring easier? but I'm not 100% sure it will benefit to them.

Quoted 4 lines

For unit tests that require specific configurations, those configurations should be added to the unittests.cfg file. As we don't currently support adding accel properties, we should add a new parameter and extend the parsing.

So you mean we add the accel properties into the unittests.cfg like:

accel = kvm,dirty-ring-size=65536

Then let the for_each_unittest to parse the parameter?
In this way, should we copy the migration config to dirty-ring migration? Just like:

[its-migration]
file = gic.flat
smp = $MAX_SMP
extra_params = -machine gic-version=3 -append 'its-migration' groups = its migration
arch = arm64

[its-migration-dirty-ring]
file = gic.flat
smp = $MAX_SMP
extra_params = -machine gic-version=3 -append 'its-migration' groups = its migration
arch = arm64
accel = kvm,dirty-ring-size=65536

So it will test both dirty bitmap and dirty ring.

Thanks,
Shaoqin

Quoted 4 lines

Thanks,
drew

#5 lore raw
Quoted 67 lines · Shaoqin Huang

Hi drew,

Quoted 36 lines · Andrew Jones
Quoted 25 lines · Shaoqin Huang
Quoted 22 lines · Thomas Huth
Quoted 6 lines · Shaoqin Huang

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
Quoted 8 lines

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.

Do we really need a separate configure switch for this? If it is just about setting a value in the ACCEL variable, you can also run the tests like this:

ACCEL=kvm,dirty-ring-size=65536 ./run_tests.sh

Quoted 9 lines
Quoted 2 lines

 Thomas

Hi Thomas,

You're right. We can do it by simply set the ACCEL when execute ./run_tests.sh. I think maybe add a configure can make auto test to set the dirty-ring easier? but I'm not 100% sure it will benefit to them.

Quoted 4 lines

For unit tests that require specific configurations, those configurations should be added to the unittests.cfg file. As we don't currently support adding accel properties, we should add a new parameter and extend the parsing.

So you mean we add the accel properties into the unittests.cfg like:

accel = kvm,dirty-ring-size=65536

Then let the for_each_unittest to parse the parameter?
In this way, should we copy the migration config to dirty-ring migration? Just like:

[its-migration]
file = gic.flat
smp = $MAX_SMP
extra_params = -machine gic-version=3 -append 'its-migration' groups = its migration
arch = arm64

[its-migration-dirty-ring]
file = gic.flat
smp = $MAX_SMP
extra_params = -machine gic-version=3 -append 'its-migration' groups = its migration
arch = arm64
accel = kvm,dirty-ring-size=65536

Quoted 1 line

So it will test both dirty bitmap and dirty ring.

Yup, either like you've outlined above with modifying the definition of 'accel' to take an optional [,params...] or by creating another parameter, e.g. 'accel_props' and then doing

accel = kvm
accel_props = dirty-ring-size=65536

Which of the two approaches to choose depends on how intrusive the modification of 'accel' would be and how well it would preserve its current behavior.

Thanks,
drew