[Qemu-devel] [PATCH v7 0/3] High downtime with 95+ throttle pct

Yury Kotov posted 3 patches 4 years, 7 months ago
Test docker-clang@ubuntu passed
Test FreeBSD passed
Test checkpatch passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190909131335.16848-1-yury-kotov@yandex-team.ru
Maintainers: Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Stefan Weil <sw@weilnetz.de>, Paolo Bonzini <pbonzini@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Juan Quintela <quintela@redhat.com>, Richard Henderson <rth@twiddle.net>
cpus.c                   |  25 +++++---
include/qemu/thread.h    |  19 ++++++
tests/migration-test.c   | 130 +++++++++++++++++++++++++++++++++++----
util/qemu-thread-posix.c |  41 ++++++++----
util/qemu-thread-win32.c |  17 +++++
util/qsp.c               |  20 ++++++
6 files changed, 221 insertions(+), 31 deletions(-)
[Qemu-devel] [PATCH v7 0/3] High downtime with 95+ throttle pct
Posted by Yury Kotov 4 years, 7 months ago
Hi,

V7:
* Fix memory leak in the auto converge test

V6:
* Fix "Add qemu_cond_timedwait" patch:
  - Changed return type for qemu_cond_timedwait (void -> bool)
  - Added details in commit message

V5:
* Updated sleep loop in throttle_thread at the suggestion of Paolo Bonzini
* Fixed hanging of test

V4:
* The test was simplified to prevent false fails.

V3:
* Rebase fixes (migrate_set_parameter -> migrate_set_parameter_int)

V2:
* Added a test
* Fixed qemu_cond_timedwait for qsp

I wrote a test for migration auto converge and found out a strange thing:
1. Enable auto converge
2. Set max-bandwidth 1Gb/s
3. Set downtime-limit 1ms
4. Run standard test (just writes a byte per page)
5. Wait for converge
6. It's converged with 99% throttle percentage
7. The result downtime was about 300-600ms   <<<<

It's much higher than expected 1ms. I figured out that cpu_throttle_thread()
function sleeps for 100ms+ for high throttle percentage (>=95%) in VCPU thread.
And it sleeps even after a cpu kick.

Fixed it by using timedwait for ms part of sleep.
E.g timedwait(halt_cond, 1ms) + usleep(500).

Regards,
Yury

Yury Kotov (3):
  qemu-thread: Add qemu_cond_timedwait
  cpus: Fix throttling during vm_stop
  tests/migration: Add a test for auto converge

 cpus.c                   |  25 +++++---
 include/qemu/thread.h    |  19 ++++++
 tests/migration-test.c   | 130 +++++++++++++++++++++++++++++++++++----
 util/qemu-thread-posix.c |  41 ++++++++----
 util/qemu-thread-win32.c |  17 +++++
 util/qsp.c               |  20 ++++++
 6 files changed, 221 insertions(+), 31 deletions(-)

-- 
2.23.0