[PATCH Libvirt 00/11] Support dirty page rate upper limit

~hyman posted 11 patches 9 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/169071243700.22823.6002973365882521706-0@git.sr.ht
There is a newer version of this series
NEWS.rst                                      |  16 ++
include/libvirt/libvirt-domain.h              |  22 +++
src/driver-hypervisor.h                       |  13 ++
src/libvirt-domain.c                          | 106 ++++++++++++
src/libvirt_public.syms                       |   6 +
src/qemu/qemu_capabilities.c                  |   2 +
src/qemu/qemu_capabilities.h                  |   1 +
src/qemu/qemu_driver.c                        | 154 ++++++++++++++++++
src/qemu/qemu_monitor.c                       |  36 ++++
src/qemu/qemu_monitor.h                       |  26 +++
src/qemu/qemu_monitor_json.c                  | 150 +++++++++++++++++
src/qemu/qemu_monitor_json.h                  |  13 ++
src/remote/remote_daemon_dispatch.c           |   2 +
src/remote/remote_driver.c                    |   4 +
src/remote/remote_protocol.x                  |  28 +++-
src/remote_protocol-structs                   |  13 ++
.../qemucapabilitiesdata/caps_7.1.0_ppc64.xml |   1 +
.../caps_7.1.0_x86_64.xml                     |   1 +
tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml |   1 +
.../caps_7.2.0_x86_64+hvf.xml                 |   1 +
.../caps_7.2.0_x86_64.xml                     |   1 +
.../caps_8.0.0_riscv64.xml                    |   1 +
.../caps_8.0.0_x86_64.xml                     |   1 +
.../qemucapabilitiesdata/caps_8.1.0_s390x.xml |   1 +
.../caps_8.1.0_x86_64.xml                     |   1 +
tools/virsh-domain.c                          | 123 ++++++++++++++
26 files changed, 723 insertions(+), 1 deletion(-)
[PATCH Libvirt 00/11] Support dirty page rate upper limit
Posted by ~hyman 9 months, 1 week ago
QEMU introduced the dirty page rate limit feature in 7.1.0, see the
details in the following link:
https://lore.kernel.org/qemu-
devel/cover.1656177590.git.huangy81@chinatelecom.cn/

So maybe it's the right time to enable this feature in libvirt and the
upper user can play with it, expecting the upper app can use this
feature to do a virtual CPU Qos or whatever else.

Introduce the virsh API as follows:
# virsh limit-dirty-page-rate <domain> [--rate <number>] [--vcpu
<number>] [--cancel]

Examples:
To set the dirty page rate upper limit 60MB/s for all virtual CPUs in
c81_node1, use:
# virsh limit-dirty-page-rate c81_node1 --rate 60
Set dirty page rate limit 60(MB/s) on all virtual CPUs successfully

To set the dirty page rate upper limit 35MB/s for virtual CPU 1 in
c81_node1, use:
# virsh limit-dirty-page-rate c81_node1  --rate 35 --vcpu 1
Set vcpu[1] dirty page rate upper limit 35(MB/s) successfully

Specify the 'cancel' option to do the reverse, the optional option
'vcpu' is used to specify the CPU index to be set.

To query the dirty page rate upper limit, use:
# virsh vcpuinfo c81_node1
VCPU:           0
CPU:            14
State:          running
CPU time:       27.1s
CPU Affinity:   yyyyyyyyyyyyyyyy
DirtyRate limit: 60
DirtyRate current: 0

VCPU:           1
CPU:            1
State:          running
CPU time:       25.1s
CPU Affinity:   yyyyyyyyyyyyyyyy
DirtyRate limit: 35
DirtyRate current: 0

VCPU:           2
CPU:            7
State:          running
CPU time:       6.0s
CPU Affinity:   yyyyyyyyyyyyyyyy
DirtyRate limit: 60
DirtyRate current: 0

VCPU:           3
CPU:            8
State:          running
CPU time:       3.5s
CPU Affinity:   yyyyyyyyyyyyyyyy
DirtyRate limit: 60
DirtyRate current: 0

The patch set adds two new APIs to implement a dirty page rate limit:
1. virDomainSetVcpuDirtyLimit, which set virtual CPU dirty page rate
   limit. virsh command 'limit-dirty-page-rate' correspondingly.
2. virDomainCancelVcpuDirtyLimit, which cancel virtual CPU dirty page
rate
   limit. 'cancel' option was introduced to 'limit-dirty-page-rate' to
cancel
   the limit correspondingly.

In addition, function 'qemuMonitorQueryVcpuDirtyLimit' was implemented
to query the dirty page rate upper limit, the virsh command 'vcpuinfo'
was extended. So that the user can query dirty page rate limit info via
'vcpuinfo'.

This series makes the main modifications as follows:
- introduce QEMU_CAPS_VCPU_DIRTY_LIMIT capability so that libvirt
  can probe before using dirty page rate upper limit feature.

- implement virsh command 'limit-dirty-page-rate' to set/cancel dirty
  page rate upper limit.

- extend 'vcpuinfo' API so that it can display dirty page rate upper
  limit.

- document dirty page rate limit feature.

Please review, and hoping the comments, thanks !

Yong

Hyman Huang(黄勇) (11):
  qemu_capabilities: Introduce QEMU_CAPS_VCPU_DIRTY_LIMIT capability
  libvirt: Add virDomainSetVcpuDirtyLimit API
  qemu_driver: Implement qemuDomainSetVcpuDirtyLimit
  virsh: Introduce limit-dirty-page-rate api
  qemu_monitor: Implement qemuMonitorQueryVcpuDirtyLimit
  qemu_driver: Extend qemuDomainGetVcpus
  virsh: Extend vcpuinfo api
  libvirt: Add virDomainCancelVcpuDirtyLimit API
  qemu_driver: Implement qemuDomainCancelVcpuDirtyLimit
  virsh: Add cancel option of limit-dirty-page-rate api
  NEWS: Document limit dirty page rate APIs

 NEWS.rst                                      |  16 ++
 include/libvirt/libvirt-domain.h              |  22 +++
 src/driver-hypervisor.h                       |  13 ++
 src/libvirt-domain.c                          | 106 ++++++++++++
 src/libvirt_public.syms                       |   6 +
 src/qemu/qemu_capabilities.c                  |   2 +
 src/qemu/qemu_capabilities.h                  |   1 +
 src/qemu/qemu_driver.c                        | 154 ++++++++++++++++++
 src/qemu/qemu_monitor.c                       |  36 ++++
 src/qemu/qemu_monitor.h                       |  26 +++
 src/qemu/qemu_monitor_json.c                  | 150 +++++++++++++++++
 src/qemu/qemu_monitor_json.h                  |  13 ++
 src/remote/remote_daemon_dispatch.c           |   2 +
 src/remote/remote_driver.c                    |   4 +
 src/remote/remote_protocol.x                  |  28 +++-
 src/remote_protocol-structs                   |  13 ++
 .../qemucapabilitiesdata/caps_7.1.0_ppc64.xml |   1 +
 .../caps_7.1.0_x86_64.xml                     |   1 +
 tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml |   1 +
 .../caps_7.2.0_x86_64+hvf.xml                 |   1 +
 .../caps_7.2.0_x86_64.xml                     |   1 +
 .../caps_8.0.0_riscv64.xml                    |   1 +
 .../caps_8.0.0_x86_64.xml                     |   1 +
 .../qemucapabilitiesdata/caps_8.1.0_s390x.xml |   1 +
 .../caps_8.1.0_x86_64.xml                     |   1 +
 tools/virsh-domain.c                          | 123 ++++++++++++++
 26 files changed, 723 insertions(+), 1 deletion(-)

-- 
2.38.5