support dirty restraint on vCPU
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v25 Latest8 patches 0 repliesNew
- v248 patches 0 repliesSuperseded
- v238 patches 1 replySuperseded
Earlier versions · 23
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v22 | 8 patches | 4 replies | Superseded | |
| v21 | 9 patches | 5 replies | Superseded | |
| v20 | 9 patches | 2 replies | Superseded | |
| v19 | 9 patches | 0 replies | Superseded | |
| v18 | 7 patches | 2 replies | Superseded | |
| v17 | 8 patches | 13 replies | Superseded | |
| v16 | 7 patches | 3 replies | Applied | |
| v15 | 7 patches | 3 replies | Superseded | |
| v13 | 2 of 7 patches | 1 reply | Superseded | |
| v14 | 7 patches | 14 replies | Superseded | |
| v12 | 5 patches | 7 replies | Superseded | |
| v11 | 4 patches | 28 replies | Superseded | |
| v10 | 3 patches | 26 replies | Superseded | |
| v9 | 3 patches | 17 replies | Superseded | |
| v8 | 3 patches | 0 replies | Superseded | |
| v7 posting 2/2 | 3 patches | 9 replies | Superseded | |
| v7 posting 1/2 | 2 of 3 patches | 0 replies | Superseded | |
| v6 | 3 patches | 3 replies | Superseded | |
| v5 | 3 patches | 4 replies | Superseded | |
| v4 | 3 patches | 0 replies | Superseded | |
| v3 | 3 patches | 6 replies | Superseded | |
| v2 | 3 patches | 1 reply | Superseded | |
| v1 | 3 patches | 1 reply | Superseded |
Changes in v25 from the cover letter
- rebase master
- fix 32-bit and non-Linux(freebsd) build failures
use qatomic_read_i64() to replace qatomic_read()
move the DIRTYLIMIT_TOLERANCE_RANGE MARCO out of 'linux' scope.
Patches in v25 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | accel/kvm/kvm-all: Refactor per-vcpu dirty ring reapingaccel/ | +13 | 0 replies | |
| 2/8 | cpus: Introduce cpu_list_generation_idcpus-common.c include/ | +9 | 0 replies | |
| 3/8 | migration/dirtyrate: Refactor dirty page rate calculationinclude/ migration/ migration/ | +174 | 0 replies | |
| 4/8 | softmmu/dirtylimit: Implement vCPU dirtyrate calculation periodicallyinclude/ include/ softmmu/ +1 more | +143 | 0 replies | |
| 5/8 | accel/kvm/kvm-all: Introduce kvm_dirty_ring_size functionaccel/ accel/ include/ | +12 | 0 replies | |
| 6/8 | softmmu/dirtylimit: Implement virtual CPU throttleaccel/ include/ include/ +2 more | +338 | 0 replies | |
| 7/8 | softmmu/dirtylimit: Implement dirty page rate limithmp-commands-info.hx hmp-commands.hx include/ +3 more | +324 | 0 replies | |
| 8/8 | tests: Add dirty page rate limit testtests/ tests/ tests/ | +280 | 0 replies |
Reviews trailers per patch
All 8 patches have a Reviewed-by or Acked-by.
| Patch | Peter Xu | Markus Armbruster |
|---|---|---|
| 1/8 | R-b | |
| 2/8 | R-b | |
| 3/8 | R-b | |
| 4/8 | R-b | |
| 5/8 | A-b | |
| 6/8 | R-b | |
| 7/8 | R-b | A-b |
| 8/8 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v25 0/8] support dirty restraint on vCPU
From: Hyman Huang(黄勇) <[email protected]>
v25:
- rebase master
- fix 32-bit and non-Linux(freebsd) build failures
use qatomic_read_i64() to replace qatomic_read()
move the DIRTYLIMIT_TOLERANCE_RANGE MARCO out of 'linux' scope.
Please review, thanks !
Yong.
v24:
- add "Acked-by: Peter Xu <[email protected]>" tag in (PATCH [8/8])
v23:
This is v23 of dirtylimit series. Since v22 posted abount 1 month ago, i did some modifications to make sure it's ready to be queued:
- rebased the master and changed the qapi version tag from 7.0 to 7.1
- do not set error if when query_vcpu_dirty_limit find dirtylimit not in service, returning NULL is sufficient. (PATCH v22 [7/8]).
The following is the history of the patchset, since v22 kind of different from the original version, i made abstracts of changelog:
RFC and v1: https://lore.kernel.org/qemu-devel/[email protected]/
v2: https://lore.kernel.org/qemu-devel/[email protected]/v1->v2 changelog:
- rename some function and variables. refactor the original algo of dirtylimit. Thanks for the comments given by Juan Quintela.
v3: https://lore.kernel.org/qemu-devel/[email protected]/
v4: https://lore.kernel.org/qemu-devel/[email protected]/
v5: https://lore.kernel.org/qemu-devel/[email protected]/
v6: https://lore.kernel.org/qemu-devel/[email protected]/
v7: https://lore.kernel.org/qemu-devel/[email protected]/v2->v7 changelog:
- refactor the docs, annotation and fix bugs of the original algo of dirtylimit. Thanks for the review given by Markus Armbruster.
v8: https://lore.kernel.org/qemu-devel/[email protected]/
v9: https://lore.kernel.org/qemu-devel/[email protected]/
v10: https://lore.kernel.org/qemu-devel/[email protected]/v7->v10 changelog:
- introduce a simpler but more efficient algo of dirtylimit inspired by Peter Xu.
- keep polishing the annotation suggested by Markus Armbruster.
v11: https://lore.kernel.org/qemu-devel/[email protected]/
v12: https://lore.kernel.org/qemu-devel/[email protected]/
v13: https://lore.kernel.org/qemu-devel/[email protected]/v10->v13 changelog:
- handle the hotplug/unplug scenario.
- refactor the new algo, split the commit and make the code more clean.
v14: https://lore.kernel.org/qemu-devel/[email protected]/v13->v14 changelog:
- sent by accident.
v15: https://lore.kernel.org/qemu-devel/[email protected]/
v16: https://lore.kernel.org/qemu-devel/[email protected]/
v17: https://lore.kernel.org/qemu-devel/[email protected]/v14->v17 changelog:
- do some code clean and fix test bug reported by Dr. David Alan Gilbert.
v18: https://lore.kernel.org/qemu-devel/[email protected]/
v19: https://lore.kernel.org/qemu-devel/[email protected]/
v20: https://lore.kernel.org/qemu-devel/[email protected]/
v21: https://lore.kernel.org/qemu-devel/[email protected]/v17->v21 changelog:
- add qtest, fix bug and do code clean.v21->v22 changelog:
- move the vcpu dirty limit test into migration-test and do some modification suggested by Peter.
Please review.
Yong.
Abstract
========
This patchset introduce a mechanism to impose dirty restraint on vCPU, aiming to keep the vCPU running in a certain dirtyrate given by user. dirty restraint on vCPU maybe an alternative method to implement convergence logic for live migration, which could improve guest memory performance during migration compared with traditional method in theory.
For the current live migration implementation, the convergence logic throttles all vCPUs of the VM, which has some side effects. -'read processes' on vCPU will be unnecessarily penalized
- throttle increase percentage step by step, which seems struggling to find the optimal throttle percentage when dirtyrate is high.
- hard to predict the remaining time of migration if the throttling percentage reachs 99%
to a certain extent, the dirty restraint machnism can fix these effects by throttling at vCPU granularity during migration.
the implementation is rather straightforward, we calculate vCPU dirtyrate via the Dirty Ring mechanism periodically as the commit 0e21bf246 "implement dirty-ring dirtyrate calculation" does, for vCPU that be specified to impose dirty restraint, we throttle it periodically as the auto-converge does, once after throttling, we compare the quota dirtyrate with current dirtyrate, if current dirtyrate is not under the quota, increase the throttling percentage until current dirtyrate is under the quota.
this patchset is the basis of implmenting a new auto-converge method for live migration, we introduce two qmp commands for impose/cancel the dirty restraint on specified vCPU, so it also can be an independent api to supply the upper app such as libvirt, which can use it to implement the convergence logic during live migration, supplemented with the qmp 'calc-dirty-rate' command or whatever.
we post this patchset for RFC and any corrections and suggetions about the implementation, api, throttleing algorithm or whatever are very appreciated!
Please review, thanks !
Best Regards !
Hyman Huang (8):
accel/kvm/kvm-all: Refactor per-vcpu dirty ring reaping
cpus: Introduce cpu_list_generation_id migration/dirtyrate: Refactor dirty page rate calculation softmmu/dirtylimit: Implement vCPU dirtyrate calculation periodically accel/kvm/kvm-all: Introduce kvm_dirty_ring_size function softmmu/dirtylimit: Implement virtual CPU throttle softmmu/dirtylimit: Implement dirty page rate limit
tests: Add dirty page rate limit test
accel/kvm/kvm-all.c | 46 ++- accel/stubs/kvm-stub.c | 5 + cpus-common.c | 8 + hmp-commands-info.hx | 13 + hmp-commands.hx | 32 +++ include/exec/cpu-common.h | 1 + include/exec/memory.h | 5 +- include/hw/core/cpu.h | 6 + include/monitor/hmp.h | 3 + include/sysemu/dirtylimit.h | 37 +++ include/sysemu/dirtyrate.h | 28 ++ include/sysemu/kvm.h | 2 + migration/dirtyrate.c | 227 +++++++++------ migration/dirtyrate.h | 7 +- qapi/migration.json | 80 ++++++ softmmu/dirtylimit.c | 601 ++++++++++++++++++++++++++++++++++++++++ softmmu/meson.build | 1 + softmmu/trace-events | 7 + tests/qtest/migration-helpers.c | 22 ++ tests/qtest/migration-helpers.h | 2 + tests/qtest/migration-test.c | 256 +++++++++++++++++ tests/qtest/qmp-cmd-test.c | 2 + 22 files changed, 1292 insertions(+), 99 deletions(-) create mode 100644 include/sysemu/dirtylimit.h create mode 100644 include/sysemu/dirtyrate.h create mode 100644 softmmu/dirtylimit.c
Signature · 1 line
1.8.3.1