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

[libvirt] [PATCH 00/10] Support hypervisor-threads-pin in vcpupin.



Hi~

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.

This 10 patches implemented hypervisor threads binding, in two ways:
  1) Use sched_setaffinity() function;
  2) In 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 (10):
  Enable cpuset cgroup and synchronous vcpupin info to cgroup.
  Support hypervisorpin xml parse
  Add qemuSetupCgroupHypervisorPin and synchronize hypervisorpin info
    to cgroup.
  Add qemuProcessSetHypervisorAffinites and set hypervisor threads
    affinities
  Introduce virDomainHypervisorPinAdd and virDomainHypervisorPinDel
    functions
  Introduce qemudDomainPinHypervisorFlags and
    qemudDomainGetHypervisorPinInfo in qemu driver.
  Introduce remoteDomainPinHypervisorFlags and
    remoteDomainGetHypervisorPinInfo functions in remote driver.
  Introduce remoteDispatchDomainPinHypervisorFlags and
    remoteDispatchDomainGetHypervisorPinInfo functions.
  Introduce virDomainPinHypervisorFlags and
    virDomainGetHypervisorPinInfo functions.
  Improve vcpupin to support hypervisorpin dynically.

 daemon/remote.c                                 |  103 +++++++++
 docs/schemas/domaincommon.rng                   |    7 +
 include/libvirt/libvirt.h.in                    |    9 +
 src/conf/domain_conf.c                          |  172 ++++++++++++++-
 src/conf/domain_conf.h                          |    7 +
 src/driver.h                                    |   13 +-
 src/libvirt.c                                   |  147 +++++++++++++
 src/libvirt_private.syms                        |    2 +
 src/libvirt_public.syms                         |    2 +
 src/qemu/qemu_cgroup.c                          |   88 ++++++++
 src/qemu/qemu_cgroup.h                          |    3 +
 src/qemu/qemu_driver.c                          |  266 ++++++++++++++++++++++-
 src/qemu/qemu_process.c                         |   54 +++++
 src/remote/remote_driver.c                      |  102 +++++++++
 src/remote/remote_protocol.x                    |   24 ++-
 src/remote_protocol-structs                     |   24 ++
 src/util/cgroup.c                               |   35 +++-
 src/util/cgroup.h                               |    3 +
 tests/qemuxml2argvdata/qemuxml2argv-cputune.xml |    1 +
 tests/vcpupin                                   |    6 +-
 tools/virsh.c                                   |  145 ++++++++----
 tools/virsh.pod                                 |   16 +-
 22 files changed, 1158 insertions(+), 71 deletions(-)

-- 
1.7.3.1



-- 
Best Regards,
Tang chen


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