From: Bing Niu <bing.niu(a)intel.com>
This series is to introduce RDT memory bandwidth allocation support by extending
current virresctrl implementation.
The Memory Bandwidth Allocation (MBA) feature provides indirect and approximate
control over memory bandwidth available per-core. This feature provides a method to
control applications which may be over-utilizing bandwidth relative to their priority
in environments such as the data-center. The details can be found in Intel's SDM
17.19.7.
Kernel supports MBA through resctrl file system same as CAT. Each resctrl group have a
MB parameter to control how much memory bandwidth it can utilize in unit of percentage.
In this series, MBA is enabled by enhancing existing virresctrl implementation. The
policy employed for MBA is similar with CAT: The sum of each MBA group's bandwidth
dose not exceed 100%.
The enhancement of virresctrl include two parts:
Part 1: Add two new structures virResctrlInfoMB and virResctrlAllocMB for collecting
host system MBA capability and domain memory bandwidth allocation. Those two
structures are the extension of existing virResctrlInfo and virResctrlAlloc.
With
them, virresctrl framework can support MBA and CAT concurrently. Each
virResctrlAlloc
represent a resource allocation including CAT, or MBA, or CAT&MBA. The policy
of MBA is
that: total memory bandwidth of each resctrl group, created by virresctrl, does
not
exceed to 100%.
Part 2: On XML part, add new elements to host capabilities query and domain allocation to
support
memory bandwidth allocation.
----------------------------------------------------------------------------------------------
For host capabilities XML, new XML format like below example,
<host>
.....
<memory>
<node id='0' cpus='0-19'>
<control granularity='10' min ='10'
maxAllocs='8'/>
</node>
</memory>
</host>
granularity --- memory bandwidth granularity
min --- minimum memory bandwidth allowed
maxAllocs --- maximum concurrent memory bandwidth allocation allowed.
----------------------------------------------------------------------------------------------
For domain XML, new format as below example
<domain type='kvm' id='2'>
......
<cputune>
......
<shares>1024</shares>
<memorytune vcpus='0-1'>
<node id='0' bandwidth='20'/>
</memorytune>
</cputune>
......
</domain>
id --- node where memory bandwidth allocation will happen
bandwidth --- bandwidth allocated in percentage
----------------------------------------------------------------------------------------------
Changelog:
v1->v2:
Jano's comment: 1. put renaming parts into separated patches.
2. set the initial return value as -1.
3. using full name in structure definition.
4. do not use VIR_CACHE_TYPE_LAST for memory bandwidth
allocation formatting.
Pavel's comment: 1. add host capabilities XML for memory bandwidth
allocation.
2. do not mix use cachetune section in XML for memory
bandwidth allocation in
domain XML. define a dedicated one for memory bandwidth
allocation.
Bing Niu (5):
util: Rename and packing parts of virresctrl
util: Add memory bandwidth support to resctrl
conf: rename cachetune to restune
conf: Introduce cputune/memorytune to support memory bandwidth
allocation
conf: add memory bandwidth allocation capability of host
src/conf/capabilities.c | 112 +++++++++++
src/conf/capabilities.h | 11 ++
src/conf/domain_conf.c | 304 ++++++++++++++++++++++++++---
src/conf/domain_conf.h | 10 +-
src/libvirt_private.syms | 4 +-
src/qemu/qemu_process.c | 18 +-
src/util/virresctrl.c | 496 ++++++++++++++++++++++++++++++++++++++++++++---
src/util/virresctrl.h | 35 +++-
8 files changed, 918 insertions(+), 72 deletions(-)
--
2.7.4