[PATCH v4 00/12] Support hypervisor-threads-pin in vcpupin.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Users can use vcpupin command to bind a vcpu thread to a specific physical cpu.
But besides vcpu threads, there are alse some other threads created by qemu 
(known as hypervisor threads) that could not be explicitly bound to physical cpus.

The first 3 patches are from Wen Congyang, which implement Cgroup for differrent
hypervisors.

The other 10 patches implemented hypervisor threads binding, in two ways:
    1) Use sched_setaffinity() function;
    2) Use cpuset cgroup.

A new xml element is introduced, and vcpupin command is improved, see below.

1. Introduce new xml elements:
  <cputune>
      ......
      <hypervisorpin cpuset='1'/>
  </cputune>

2. Improve vcpupin command to support hypervisor threads binding.

For example, vm1 has the following configuration:
  <cputune>
      <vcpupin vcpu='1' cpuset='1'/>
          <vcpupin vcpu='0' cpuset='0'/>
      <hypervisorpin cpuset='1'/>
  </cputune>

  1) query all threads pining

     # vcpupin vm1
     VCPU: CPU Affinity
     ----------------------------------
        0: 0
        1: 1

     Hypervisor: CPU Affinity
     ----------------------------------
        *: 1

  2) query hypervisor threads pining only

     # vcpupin vm1 --hypervisor
     Hypervisor: CPU Affinity
     ----------------------------------
        *: 1

  3) change hypervisor threads pining

     # vcpupin vm1 --hypervisor 0-1

     # vcpupin vm1 --hypervisor
     Hypervisor: CPU Affinity
     ----------------------------------
        *: 0-1

     # taskset -p 397
     pid 397's current affinity mask: 3


Note: If users want to pin a vcpu thread to pcpu, --vcpu option could no longer be omitted.


Tang Chen (9):
  Enable cpuset cgroup and synchronous vcpupin info to cgroup.
  Support hypervisorpin xml parse.
  Introduce qemuSetupCgroupHypervisorPin and synchronize hypervisorpin
    info to cgroup.
  Add qemuProcessSetHypervisorAffinites and set hypervisor threads
    affinities
  Introduce virDomainHypervisorPinAdd and virDomainHypervisorPinDel
    functions
  Introduce virDomainPinHypervisorFlags and
    virDomainGetHypervisorPinInfo functions.
  Introduce qemudDomainPinHypervisorFlags and
    qemudDomainGetHypervisorPinInfo in qemu driver.
  Introduce remoteDomainPinHypervisorFlags and
    remoteDomainGetHypervisorPinInfo functions in remote driver.
  Improve vcpupin to support hypervisorpin dynically.

Wen Congyang (3):
  Introduce the function virCgroupForHypervisor
  Introduce the function virCgroupMoveTask
  create a new cgroup and move all hypervisor threads to the new cgroup

 daemon/remote.c                                 |  103 +++++++++
 docs/schemas/domaincommon.rng                   |    7 +
 include/libvirt/libvirt.h.in                    |   10 +
 src/conf/domain_conf.c                          |  169 +++++++++++++-
 src/conf/domain_conf.h                          |    7 +
 src/driver.h                                    |   13 +-
 src/libvirt.c                                   |  147 +++++++++++++
 src/libvirt_private.syms                        |    7 +
 src/libvirt_public.syms                         |    2 +
 src/qemu/qemu_cgroup.c                          |  151 ++++++++++++-
 src/qemu/qemu_cgroup.h                          |    5 +
 src/qemu/qemu_driver.c                          |  267 ++++++++++++++++++++++-
 src/qemu/qemu_process.c                         |   60 ++++-
 src/remote/remote_driver.c                      |  102 +++++++++
 src/remote/remote_protocol.x                    |   23 +-
 src/remote_protocol-structs                     |   24 ++
 src/util/cgroup.c                               |  188 +++++++++++++++-
 src/util/cgroup.h                               |   15 ++
 tests/qemuxml2argvdata/qemuxml2argv-cputune.xml |    1 +
 tests/vcpupin                                   |    6 +-
 tools/virsh.c                                   |  147 ++++++++-----
 tools/virsh.pod                                 |   16 +-
 22 files changed, 1393 insertions(+), 77 deletions(-)

-- 
1.7.10.2

-- 
Best Regards,
Tang chen

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]