[pve-devel] live migration : add option for new auto-convergence capability ?

Alexandre DERUMIER aderumier at odiso.com
Thu Dec 12 17:59:09 CET 2013


>>I would prefer to enable that by default - but how stable is it? 
I need to test it.

Code seem quite small, so I think it should break migration.

http://git.qemu.org/?p=qemu.git;a=blobdiff;f=arch_init.c;h=e9dd96fb28177f32ea1f5d3db9ababf35c74a38a;hp=0e553c92854b10b48e8b5d3bf155f924339f62f6;hb=7ca1dfad952d8a8655b32e78623edcc38a51b14a;hpb=bde1e2ec2176c363c1783bf8887b6b1beb08dfee 

+        if (migrate_auto_converge()) {
+            /* The following detection logic can be refined later. For now:
+               Check to see if the dirtied bytes is 50% more than the approx.
+               amount of bytes that just got transferred since the last time we
+               were in this routine. If that happens >N times (for now N==4)
+               we turn on the throttle down logic */
+            bytes_xfer_now = ram_bytes_transferred();
+            if (s->dirty_pages_rate &&
+               (num_dirty_pages_period * TARGET_PAGE_SIZE >
+                   (bytes_xfer_now - bytes_xfer_prev)/2) &&
+               (dirty_rate_high_cnt++ > 4)) {
+                    trace_migration_throttle();
+                    mig_throttle_on = true;
+                    dirty_rate_high_cnt = 0;
+             }
+             bytes_xfer_prev = bytes_xfer_now;
+        } else {
+             mig_throttle_on = false;
+        }

...
+static void mig_sleep_cpu(void *opq)
+{
+    qemu_mutex_unlock_iothread();
+    g_usleep(30*1000);
+    qemu_mutex_lock_iothread();
+}
+
+/* To reduce the dirty rate explicitly disallow the VCPUs from spending
+   much time in the VM. The migration thread will try to catchup.
+   Workload will experience a performance drop.
+*/
+static void mig_throttle_cpu_down(CPUState *cpu, void *data)
+{
+    async_run_on_cpu(cpu, mig_sleep_cpu, NULL);
+}
+
+static void mig_throttle_guest_down(void)
+{
+    qemu_mutex_lock_iothread();
+    qemu_for_each_cpu(mig_throttle_cpu_down, NULL);
+    qemu_mutex_unlock_iothread();
+}


----- Mail original ----- 

De: "Dietmar Maurer" <dietmar at proxmox.com> 
À: "Alexandre DERUMIER" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com> 
Envoyé: Jeudi 12 Décembre 2013 16:41:50 
Objet: RE: [pve-devel] live migration : add option for new auto-convergence capability ? 

> This "reduce" cpu speed in guest when qemu detect that live migration will take 
> too much time. 
> (too many memory changes when migrating). 
> 
> Maybe could we add an option in the migration form ? 
> 
> Or enable it by default? (don't known if it's a good idea) 

I would prefer to enable that by default - but how stable is it? 


More information about the pve-devel mailing list