[PATCH v7 0/2] Dirty Ring support (Libvirt)

huangy81@chinatelecom.cn posted 2 patches 2 years, 4 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1637676900.git.huangy81@chinatelecom.cn
docs/formatdomain.rst                         | 18 ++++---
docs/schemas/domaincommon.rng                 | 10 ++++
src/conf/domain_conf.c                        | 54 +++++++++++++++++++
src/conf/domain_conf.h                        |  4 ++
src/qemu/qemu_command.c                       | 12 +++++
tests/qemuxml2argvdata/kvm-features-off.xml   |  1 +
tests/qemuxml2argvdata/kvm-features.args      |  2 +-
tests/qemuxml2argvdata/kvm-features.xml       |  1 +
tests/qemuxml2xmloutdata/kvm-features-off.xml |  1 +
tests/qemuxml2xmloutdata/kvm-features.xml     |  1 +
10 files changed, 95 insertions(+), 9 deletions(-)
[PATCH v7 0/2] Dirty Ring support (Libvirt)
Posted by huangy81@chinatelecom.cn 2 years, 4 months ago
From: "Hyman Huang(黄勇)" <huangy81@chinatelecom.cn>

v7
- rebase on master
- modify the following points according to the advice given by Peter
  1. skip the -accel switch and reuse the existing commit d20ebdda2 
     'qemu: Switch to -accel'
  2. remove the post-parse function and do the parse work in 
     virDomainFeaturesKVMDefParse once for all
  3. throw an error if "size" not specified when kvm-dirty-ring
     feature enabled in xml
  4. fix the memory leak when parsing xml
  5. use macro VIR_ROUND_UP_POWER_OF_TWO to check power-of-two
  6. put error messages in one line
  7. squash the last 2 commit into 1
  8. add test for kvm-dirty-ring feature

Thanks for the careful reviews made by Peter.

Please review, Thanks!

Hyman

Ping for this series.

I still keep thinking the dirty ring feature is something good to
have for libvirt.

qemu-6.1 has supported dirty ring feature and followed up with the
commit 0e21bf24 "support dirtyrate at the granualrity of vcpu",
which is a typical usage scenario of dirty ring. another usage
scenario may be the implementation of per-vcpu auto-converge during
live migration which is already being reviewed. so we can make full
use of dirty ring feature if libvirt supports. and any corrections
and comments about this series would be very appreciated.

Please review, Thanks!

Hyman

v6
- rebase on master

v5,v4: blank, just make v6 be the the latest version.

v3
- rebase master and fix the confilict when apply
  "conf: introduce dirty_ring_size in struct "_virDomainDef" to current 
  master.

v2
- split patchset into 4 patches

- leave out the tcg case when building commandline. 

- handle the VIR_DOMAIN_KVM_DIRTY_RING case independently in ,
  virDomainFeatureDefParse and virDomainDefFeaturesCheckABIStability,
  do not integrate it with other cases...

- add dirty ring size check in virDomainDefFeaturesCheckABIStability

- modify zero checks on integers of dirty ring size in a explicit way.

- set the default value of dirty ring size in a post-parser callback.

- check the absence of kvm_feature in a explicit way.

- code clean of virTristateSwitchTypeToString function.

this version's modification base on Peter's advices mostly, thanks
a lot, please review !

v1
since qemu has introduced a dirty ring feature in 6.1.0, may be it's
the right time to introduce dirty ring in libvirt meanwhile.

this patch add feature named 'dirty-ring', which enable dirty ring
feature when starting vm. to try this out, three things has done
in this patchset:

- introduce QEMU_CAPS_ACCEL so the the libvirt can use it to select 
  the right option when specifying the accelerator type.

- switch the option "-machine accel=xxx" to "-accel xxx" when specifying
  accelerator type once libvirt build QEMU command line, so that 
  dirty-ring-size property can be passed to qemu when start vm.

- introduce dirty_ring_size to hold the ring size configured by user
  and pass dirty_ring_size when building qemu commandline if dirty 
  ring feature enabled.

though dirty ring is per-cpu logically, the size of dirty ring is 
registered by 'struct kvm' in QEMU. so we would like to place the 
dirty_ring_size as a property of vm in Libvirt as the QEMU do.

the dirty ring feature is disabled by default, and if enabled, the
default value of ring size if 4096 if size not configured. 

for more details about dirty ring and "-accel" option, please refer to:
https://lore.kernel.org/qemu-devel/20210108165050.406906-10-peterx@redhat.com/
https://lore.kernel.org/qemu-devel/3aa73987-40e8-3619-0723-9f17f73850bd@redhat.com/

please review, Thanks!

Best Regards !

Hyman Huang(黄勇) (2):
  qemu: support dirty ring feature
  tests: add test for kvm-dirty-ring feature

 docs/formatdomain.rst                         | 18 ++++---
 docs/schemas/domaincommon.rng                 | 10 ++++
 src/conf/domain_conf.c                        | 54 +++++++++++++++++++
 src/conf/domain_conf.h                        |  4 ++
 src/qemu/qemu_command.c                       | 12 +++++
 tests/qemuxml2argvdata/kvm-features-off.xml   |  1 +
 tests/qemuxml2argvdata/kvm-features.args      |  2 +-
 tests/qemuxml2argvdata/kvm-features.xml       |  1 +
 tests/qemuxml2xmloutdata/kvm-features-off.xml |  1 +
 tests/qemuxml2xmloutdata/kvm-features.xml     |  1 +
 10 files changed, 95 insertions(+), 9 deletions(-)

-- 
2.27.0


Re: [PATCH v7 0/2] Dirty Ring support (Libvirt)
Posted by Hyman 2 years, 3 months ago
Ping

Any corrections and suggetions are welcome.

Please review, thanks!

在 2021/11/23 22:36, huangy81@chinatelecom.cn 写道:
> From: "Hyman Huang(黄勇)" <huangy81@chinatelecom.cn>
> 
> v7
> - rebase on master
> - modify the following points according to the advice given by Peter
>    1. skip the -accel switch and reuse the existing commit d20ebdda2
>       'qemu: Switch to -accel'
>    2. remove the post-parse function and do the parse work in
>       virDomainFeaturesKVMDefParse once for all
>    3. throw an error if "size" not specified when kvm-dirty-ring
>       feature enabled in xml
>    4. fix the memory leak when parsing xml
>    5. use macro VIR_ROUND_UP_POWER_OF_TWO to check power-of-two
>    6. put error messages in one line
>    7. squash the last 2 commit into 1
>    8. add test for kvm-dirty-ring feature
> 
> Thanks for the careful reviews made by Peter.
> 
> Please review, Thanks!
> 
> Hyman
> 
> Ping for this series.
> 
> I still keep thinking the dirty ring feature is something good to
> have for libvirt.
> 
> qemu-6.1 has supported dirty ring feature and followed up with the
> commit 0e21bf24 "support dirtyrate at the granualrity of vcpu",
> which is a typical usage scenario of dirty ring. another usage
> scenario may be the implementation of per-vcpu auto-converge during
> live migration which is already being reviewed. so we can make full
> use of dirty ring feature if libvirt supports. and any corrections
> and comments about this series would be very appreciated.
> 
> Please review, Thanks!
> 
> Hyman
> 
> v6
> - rebase on master
> 
> v5,v4: blank, just make v6 be the the latest version.
> 
> v3
> - rebase master and fix the confilict when apply
>    "conf: introduce dirty_ring_size in struct "_virDomainDef" to current
>    master.
> 
> v2
> - split patchset into 4 patches
> 
> - leave out the tcg case when building commandline.
> 
> - handle the VIR_DOMAIN_KVM_DIRTY_RING case independently in ,
>    virDomainFeatureDefParse and virDomainDefFeaturesCheckABIStability,
>    do not integrate it with other cases...
> 
> - add dirty ring size check in virDomainDefFeaturesCheckABIStability
> 
> - modify zero checks on integers of dirty ring size in a explicit way.
> 
> - set the default value of dirty ring size in a post-parser callback.
> 
> - check the absence of kvm_feature in a explicit way.
> 
> - code clean of virTristateSwitchTypeToString function.
> 
> this version's modification base on Peter's advices mostly, thanks
> a lot, please review !
> 
> v1
> since qemu has introduced a dirty ring feature in 6.1.0, may be it's
> the right time to introduce dirty ring in libvirt meanwhile.
> 
> this patch add feature named 'dirty-ring', which enable dirty ring
> feature when starting vm. to try this out, three things has done
> in this patchset:
> 
> - introduce QEMU_CAPS_ACCEL so the the libvirt can use it to select
>    the right option when specifying the accelerator type.
> 
> - switch the option "-machine accel=xxx" to "-accel xxx" when specifying
>    accelerator type once libvirt build QEMU command line, so that
>    dirty-ring-size property can be passed to qemu when start vm.
> 
> - introduce dirty_ring_size to hold the ring size configured by user
>    and pass dirty_ring_size when building qemu commandline if dirty
>    ring feature enabled.
> 
> though dirty ring is per-cpu logically, the size of dirty ring is
> registered by 'struct kvm' in QEMU. so we would like to place the
> dirty_ring_size as a property of vm in Libvirt as the QEMU do.
> 
> the dirty ring feature is disabled by default, and if enabled, the
> default value of ring size if 4096 if size not configured.
> 
> for more details about dirty ring and "-accel" option, please refer to:
> https://lore.kernel.org/qemu-devel/20210108165050.406906-10-peterx@redhat.com/
> https://lore.kernel.org/qemu-devel/3aa73987-40e8-3619-0723-9f17f73850bd@redhat.com/
> 
> please review, Thanks!
> 
> Best Regards !
> 
> Hyman Huang(黄勇) (2):
>    qemu: support dirty ring feature
>    tests: add test for kvm-dirty-ring feature
> 
>   docs/formatdomain.rst                         | 18 ++++---
>   docs/schemas/domaincommon.rng                 | 10 ++++
>   src/conf/domain_conf.c                        | 54 +++++++++++++++++++
>   src/conf/domain_conf.h                        |  4 ++
>   src/qemu/qemu_command.c                       | 12 +++++
>   tests/qemuxml2argvdata/kvm-features-off.xml   |  1 +
>   tests/qemuxml2argvdata/kvm-features.args      |  2 +-
>   tests/qemuxml2argvdata/kvm-features.xml       |  1 +
>   tests/qemuxml2xmloutdata/kvm-features-off.xml |  1 +
>   tests/qemuxml2xmloutdata/kvm-features.xml     |  1 +
>   10 files changed, 95 insertions(+), 9 deletions(-)
>