Support set the CPU affinity of the live migration threads to improve
the migration performance in specific cases. By default, the migration
thread shares CPU resources with the VM process. With those API, support
pin migration thread to expected CPU list to avoid preempting CPU
resources of VM process.

Use the following methods to implement migration thread pin:
 - set the cpulist by virsh command 'virsh migrationpin' or
   migration param 'migration.pin'. These settings affect
   only the next migration
 - continuously query migration thread information[1] during the
   migration process until matches the thread number desired or
   migration finished unexpectedly
 - pin migration thread to expected cpulist, we can set/change
   the cpulist by 'virsh migrationpin' during migration at anytime

Note that only support pin main thread of migration(live migration)
and parallel send threads now.

diff to v1:
 - add qmp command to query migration thread information
 - change the method of get qemu's migration thread info, from qemu
   event to qmp commands.
 - unified the interface of common migration and parallel migration.

ref:
[1]https://patchew.org/QEMU/20230203073519.2969147-1-jiangjiach...@huawei.com/

Jiang Jiacheng (8):
  migration/migration-pin: Implemente the interface of obtaining
    migration thread information
  migration/migration-pin: get migration pid for migration pin
  migration/migration-pin: Introduce virDomainPinMigrationThread API
  migration/migration-pin: Implement qemuDomainPinMigrationThread
  migration/migration-pin: support migration pin by virsh command
  migration/migration-pin: add migrationpin for migration parameters
  migration/migration-pin: pin migration thread immediately after get
    thread info
  migration/migration-pin/multifd-pin: add migration pin status handle

 include/libvirt/libvirt-domain.h |  15 +++
 src/conf/domain_conf.c           |   9 ++
 src/conf/domain_conf.h           |  10 ++
 src/conf/virconftypes.h          |   2 +
 src/driver-hypervisor.h          |   6 +
 src/libvirt-domain.c             |  65 ++++++++++
 src/libvirt_private.syms         |   1 +
 src/libvirt_public.syms          |   4 +
 src/qemu/qemu_domain.c           |  26 ++++
 src/qemu/qemu_domain.h           |  13 ++
 src/qemu/qemu_driver.c           |  56 +++++++++
 src/qemu/qemu_migration.c        | 111 +++++++++++++++++
 src/qemu/qemu_migration.h        |  33 +++---
 src/qemu/qemu_migration_params.c |  40 +++++++
 src/qemu/qemu_migration_params.h |   9 ++
 src/qemu/qemu_monitor.c          |  25 ++++
 src/qemu/qemu_monitor.h          |  11 ++
 src/qemu/qemu_monitor_json.c     |  62 ++++++++++
 src/qemu/qemu_monitor_json.h     |   5 +
 src/qemu/qemu_process.c          | 198 +++++++++++++++++++++++++++++++
 src/qemu/qemu_process.h          |  13 ++
 src/remote/remote_driver.c       |   1 +
 src/remote/remote_protocol.x     |  13 +-
 src/remote_protocol-structs      |   5 +
 src/util/vircgroup.c             |   3 +
 src/util/vircgroup.h             |   1 +
 tools/virsh-domain.c             |  69 +++++++++++
 27 files changed, 789 insertions(+), 17 deletions(-)

-- 
2.33.0

Reply via email to