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

[libvirt] [PATCHv8 00/17] Introduce x86 Cache Monitoring Technology (CMT)

This series of patches and the series already been merged introduce
the x86 Cache Monitoring Technology (CMT) to libvirt by interacting
with kernel resource control (resctrl) interface. CMT is one of the
Intel(R) x86 CPU feature which belongs to the Resource Director
Technology (RDT). CMT reports the occupancy of the last level cache,
which is shared by all CPU cores.

In the v1 series, an original and complete feature for CMT was introduced
The v2 and v3 patches address the feature for the host capability of CMT.
v4 is addressing the feature for monitoring VM vcpu thread set cache
occupancy and reporting it through a virsh command.

We have serval discussion about the enabling of CMT, please refer to
following links for the RFCs.

And the merged commits are list as below, for host capability of CMT.

1. About reason why CMT is necessary in libvirt?
The perf events of 'CMT, MBML, MBMT' have been phased out since Linux
kernel commit c39a0e2c8850f08249383f2425dbd8dbe4baad69, in libvirt
the perf based cmt,mbm will not work with the latest linux kernel. These
patches add CMT feature to libvirt through kernel resctrlfs interface.

2 Create cache monitoring group (cache monitor).

    The main interface for creating monitoring group is through XML file. The
proposed configuration is like:

        <cachetune vcpus='1'>
          <cache id='0' level='3' type='code' size='7680' unit='KiB'/>
          <cache id='1' level='3' type='data' size='3840' unit='KiB'/>
    +     <monitor level='3' vcpus='1'/>
        <cachetune vcpus='4-7'>
    +     <monitor level='3' vcpus='4-6'/>

In above XML, created 2 cache resctrl allocation groups and 2 resctrl
monitoring groups.
The changes of cache monitor will be effective in next booting of VM.

2 Show CMT result through command 'domstats'

Adding the interface in qemu to report this information for resource
monitor group through command 'virsh domstats --cpu-total'.
Below is a typical output:

     # virsh domstats 1 --cpu-total
     Domain: 'ubuntu16.04-base'

Changes in v8:
- Addressing John's review comments for v7.
- Add patch for refactoring virRresctrlAllocSetID and a separate patch
for virResctrlMonitorSetID.
- Removed patch for 'resctrl->id'.
- Removed patch for validating monitor through checking *tasks file.
- Removed patch for setup vcpu in libvirt re-reconnection.
- Re-designed the functions for showing the result for command 'virsh domstats'.
- Move virResctrlMonitorGetCacheOccupancy and its local helper functions to 

Changes in v7:
- Add several lines removed by mistake.

Changes in v6:
- Addressing John's review comments for v5.
- Removed and cleaned the concepts of 'default allocation' and
'default monitor'.
- qemu: virsh domstats --cpu-total output for CMT, add identifier
'monitor' for each itm.

Changes in v5:
- qemu: Setting up vcpu and adding pids to resctrl monitor groups during
- Add the document for domain configuration related to resctrl monitor.

Changes in v4:
v4 is addressing the feature for monitoring VM vcpu
thread set cache occupancy and reporting it through a
virsh command.
- Introduced resctrl default allocation
- Introduced resctrl monitor and default monitor

Changes in v3:
- Addressed John Ferlan's review.
- Typo fixed.
- Removed VIR_ENUM_DECL(virMonitor);

Changes in v2:
- Introduced MBM capability.
- Capability layout changed
    * Moved <monitor> from cahe <bank> to <cache>
    * Renamed <Threshold> to <reuseThreshold>
- Document for 'reuseThreshold' changed.
- Introduced API virResctrlInfoGetMonitorPrefix
- Added more tests, covering standalone CMT, fake new
- Creating CMT resource control group will be
  subsequent job.

Wang Huaqiang (17):
  docs,util: Refactor schemas and virresctrl to support optional cache
  util: Introduce resctrl monitor for CMT
  util: Refactor code for determining allocation path
  util: Add interface to determine monitor path
  util: Refactor code for adding PID to the resource group
  util: Add interface for adding PID to the monitor
  util: Refactor code for creating resctrl group
  util: Add interface for creating monitor group
  util: Refactor virResctrlAllocSetID to set allocation ID
  util: Add interface for setting monitor ID.
  util: Add more interfaces for resctrl monitor
  conf: Remove virDomainResctrlAppend and introduce virDomainResctrlNew
  conf: Introduce cache monitor element in cachetune
  qemu: enable resctrl monitor in qemu
  qemu: Refactor qemuDomainGetStatsCpu
  qemu: Report cache occupancy (CMT) with domstats
  docs: Updated news.xml about the CMT support

 docs/formatdomain.html.in                          |  30 +-
 docs/news.xml                                      |  11 +
 docs/schemas/domaincommon.rng                      |  14 +-
 src/conf/domain_conf.c                             | 286 +++++++++++-
 src/conf/domain_conf.h                             |  11 +
 src/libvirt-domain.c                               |   9 +
 src/libvirt_private.syms                           |   9 +
 src/qemu/qemu_driver.c                             | 219 +++++++++-
 src/qemu/qemu_process.c                            |  49 ++-
 src/util/virresctrl.c                              | 484 +++++++++++++++++++--
 src/util/virresctrl.h                              |  46 ++
 tests/genericxml2xmlindata/cachetune-cdp.xml       |   3 +
 .../cachetune-colliding-monitor.xml                |  30 ++
 tests/genericxml2xmlindata/cachetune-small.xml     |   7 +
 tests/genericxml2xmltest.c                         |   2 +
 15 files changed, 1142 insertions(+), 68 deletions(-)
 create mode 100644 tests/genericxml2xmlindata/cachetune-colliding-monitor.xml


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