[libvirt] [jenkins-ci PATCH] projects: restrict virt-viewer RPMs to Fedora >= 28
by Daniel P. Berrangé
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
projects/virt-viewer.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/projects/virt-viewer.yaml b/projects/virt-viewer.yaml
index 12335f3..25474f2 100644
--- a/projects/virt-viewer.yaml
+++ b/projects/virt-viewer.yaml
@@ -13,7 +13,9 @@
parent_jobs: 'virt-viewer-master-syntax-check'
- autotools-rpm-job:
parent_jobs: 'virt-viewer-master-check'
- machines: '{rpm_machines}'
+ machines:
+ - libvirt-fedora-28
+ - libvirt-fedora-rawhide
- autotools-build-job:
parent_jobs: 'libvirt-glib-master-build-mingw32'
variant: -mingw32
--
2.17.1
6 years, 3 months
[libvirt] [PATCH for v4.6.0] cgroups: Don't leave stale pointers around after virCgroupFree
by Michal Privoznik
One of the attributes that original virCgroupFree() had was it
set passed pointer to NULL. For instance in the following code
the latter call would be practically a no-op:
virCgroupFree(&var);
virCgroupFree(&var);
However, this behaviour of the function was changed in
0f80c71822d824 but corresponding 'var = NULL' lines were not
added leading to double free:
Invalid read of size 8
at 0x52CA3DA: virFree (viralloc.c:582)
by 0x52D5272: virCgroupFree (vircgroup.c:1700)
by 0x230CE113: qemuDomainObjPrivateDataClear (qemu_domain.c:1923)
by 0x230CE2F3: qemuDomainObjPrivateFree (qemu_domain.c:1973)
by 0x53922D7: virDomainObjDispose (domain_conf.c:3192)
by 0x533B8ED: virObjectUnref (virobject.c:350)
by 0x533BE39: virObjectFreeHashData (virobject.c:591)
by 0x5305C23: virHashFree (virhash.c:304)
by 0x53EAFA7: virDomainObjListDispose (virdomainobjlist.c:92)
by 0x533B8ED: virObjectUnref (virobject.c:350)
by 0x2315E2AE: qemuStateCleanup (qemu_driver.c:1067)
by 0x557CFF6: virStateCleanup (libvirt.c:699)
Address 0x29fbbdd0 is 16 bytes inside a block of size 328 free'd
at 0x4C2E13B: free (vg_replace_malloc.c:530)
by 0x52CA3E4: virFree (viralloc.c:582)
by 0x52D52D4: virCgroupFree (vircgroup.c:1706)
by 0x230CE113: qemuDomainObjPrivateDataClear (qemu_domain.c:1923)
by 0x2311CFE9: qemuProcessStop (qemu_process.c:7144)
by 0x2311BF1C: qemuProcessStart (qemu_process.c:6745)
by 0x2316E634: qemuDomainObjStart (qemu_driver.c:7293)
by 0x2316E8A2: qemuDomainCreateWithFlags (qemu_driver.c:7346)
by 0x2316E925: qemuDomainCreate (qemu_driver.c:7365)
by 0x5594E9F: virDomainCreate (libvirt-domain.c:6534)
by 0x1367D1: remoteDispatchDomainCreate (remote_daemon_dispatch_stubs.h:4434)
by 0x1366EA: remoteDispatchDomainCreateHelper (remote_daemon_dispatch_stubs.h:4410)
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/lxc/lxc_process.c | 1 +
src/qemu/qemu_cgroup.c | 2 ++
src/qemu/qemu_domain.c | 1 +
src/util/vircgroup.c | 5 +++++
4 files changed, 9 insertions(+)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 5d8fa63c67..4d118cb6fd 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -221,6 +221,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver,
if (priv->cgroup) {
virCgroupRemove(priv->cgroup);
virCgroupFree(priv->cgroup);
+ priv->cgroup = NULL;
}
/* Get machined to terminate the machine as it may not have cleaned it
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 8a00ffcd45..cd1e01262b 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -921,6 +921,7 @@ qemuInitCgroup(virDomainObjPtr vm,
goto done;
virCgroupFree(priv->cgroup);
+ priv->cgroup = NULL;
if (!vm->def->resource) {
virDomainResourceDefPtr res;
@@ -1058,6 +1059,7 @@ qemuConnectCgroup(virDomainObjPtr vm)
goto done;
virCgroupFree(priv->cgroup);
+ priv->cgroup = NULL;
if (virCgroupNewDetectMachine(vm->def->name,
"qemu",
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index bda53814a3..bfffd3da27 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1921,6 +1921,7 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv)
priv->qemuDevices = NULL;
virCgroupFree(priv->cgroup);
+ priv->cgroup = NULL;
virPerfFree(priv->perf);
priv->perf = NULL;
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 472a8167f5..6e2e06bae3 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -1371,6 +1371,7 @@ virCgroupNewDomainPartition(virCgroupPtr partition,
VIR_CGROUP_MEM_HIERACHY) < 0) {
virCgroupRemove(*group);
virCgroupFree(*group);
+ *group = NULL;
return -1;
}
@@ -1428,6 +1429,7 @@ virCgroupNewThread(virCgroupPtr domain,
if (virCgroupMakeGroup(domain, *group, create, VIR_CGROUP_NONE) < 0) {
virCgroupRemove(*group);
virCgroupFree(*group);
+ *group = NULL;
return -1;
}
@@ -1466,6 +1468,7 @@ virCgroupNewDetectMachine(const char *name,
VIR_DEBUG("Failed to validate machine name for '%s' driver '%s'",
name, drivername);
virCgroupFree(*group);
+ *group = NULL;
return 0;
}
@@ -1566,6 +1569,7 @@ virCgroupNewMachineSystemd(const char *name,
virErrorPtr saved = virSaveLastError();
virCgroupRemove(*group);
virCgroupFree(*group);
+ *group = NULL;
if (saved) {
virSetError(saved);
virFreeError(saved);
@@ -1617,6 +1621,7 @@ virCgroupNewMachineManual(const char *name,
virErrorPtr saved = virSaveLastError();
virCgroupRemove(*group);
virCgroupFree(*group);
+ *group = NULL;
if (saved) {
virSetError(saved);
virFreeError(saved);
--
2.16.4
6 years, 3 months
[libvirt] [PATCH for 4.6.0 0/3] Revert VIR_AUTOPTR work in cgroup
by Michal Privoznik
Turns out, our code relies on virCgroupFree(&var) setting
var = NULL. Otherwise a double free can occur:
https://www.redhat.com/archives/libvir-list/2018-July/msg02004.html
Rather than inserting var = NULL after each virCgroupFree() call lets
revert the patches. The ideal solution would be to use virCgroupFree
both directly and as attribute cleanup.
Michal Prívozník (3):
Revert "util: cgroup: use VIR_AUTOPTR for aggregate types"
Revert "util: cgroup: define cleanup function using
VIR_DEFINE_AUTOPTR_FUNC"
Revert "util: cgroup: modify virCgroupFree to take virCgroupPtr"
src/libvirt-lxc.c | 4 +-
src/lxc/lxc_cgroup.c | 4 +-
src/lxc/lxc_container.c | 2 +-
src/lxc/lxc_controller.c | 2 +-
src/lxc/lxc_domain.c | 2 +-
src/lxc/lxc_process.c | 10 +-
src/qemu/qemu_cgroup.c | 16 ++--
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 34 +++----
src/qemu/qemu_process.c | 2 +-
src/util/vircgroup.c | 233 +++++++++++++++++++++++++++++------------------
src/util/vircgroup.h | 11 +--
src/util/vircgrouppriv.h | 2 +-
tests/vircgrouptest.c | 42 ++++-----
14 files changed, 209 insertions(+), 157 deletions(-)
--
2.16.4
6 years, 3 months
[libvirt] [jenkins-ci PATCH] hosts_vars: drop virt-viewer from platforms with old spice-gtk
by Daniel P. Berrangé
git master requires spice-gtk >= 0.35
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
guests/host_vars/libvirt-centos-7/main.yml | 1 -
guests/host_vars/libvirt-debian-8/main.yml | 1 -
guests/host_vars/libvirt-debian-9/main.yml | 1 -
guests/host_vars/libvirt-debian-sid/main.yml | 1 -
guests/host_vars/libvirt-fedora-27/main.yml | 1 -
guests/host_vars/libvirt-freebsd-10/main.yml | 1 -
guests/host_vars/libvirt-freebsd-11/main.yml | 1 -
guests/host_vars/libvirt-freebsd-current/main.yml | 1 -
guests/host_vars/libvirt-ubuntu-14/main.yml | 1 -
guests/host_vars/libvirt-ubuntu-16/main.yml | 1 -
guests/host_vars/libvirt-ubuntu-18/main.yml | 1 -
11 files changed, 11 deletions(-)
diff --git a/guests/host_vars/libvirt-centos-7/main.yml b/guests/host_vars/libvirt-centos-7/main.yml
index c147830..19e905e 100644
--- a/guests/host_vars/libvirt-centos-7/main.yml
+++ b/guests/host_vars/libvirt-centos-7/main.yml
@@ -12,4 +12,3 @@ projects:
- libvirt-sandbox
- osinfo-db
- osinfo-db-tools
- - virt-viewer
diff --git a/guests/host_vars/libvirt-debian-8/main.yml b/guests/host_vars/libvirt-debian-8/main.yml
index 954a037..62abfd3 100644
--- a/guests/host_vars/libvirt-debian-8/main.yml
+++ b/guests/host_vars/libvirt-debian-8/main.yml
@@ -10,4 +10,3 @@ projects:
- libvirt-tck
- osinfo-db
- osinfo-db-tools
- - virt-viewer
diff --git a/guests/host_vars/libvirt-debian-9/main.yml b/guests/host_vars/libvirt-debian-9/main.yml
index a588c09..032572f 100644
--- a/guests/host_vars/libvirt-debian-9/main.yml
+++ b/guests/host_vars/libvirt-debian-9/main.yml
@@ -13,4 +13,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
diff --git a/guests/host_vars/libvirt-debian-sid/main.yml b/guests/host_vars/libvirt-debian-sid/main.yml
index a588c09..032572f 100644
--- a/guests/host_vars/libvirt-debian-sid/main.yml
+++ b/guests/host_vars/libvirt-debian-sid/main.yml
@@ -13,4 +13,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
diff --git a/guests/host_vars/libvirt-fedora-27/main.yml b/guests/host_vars/libvirt-fedora-27/main.yml
index 00b0848..bc13420 100644
--- a/guests/host_vars/libvirt-fedora-27/main.yml
+++ b/guests/host_vars/libvirt-fedora-27/main.yml
@@ -14,4 +14,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
diff --git a/guests/host_vars/libvirt-freebsd-10/main.yml b/guests/host_vars/libvirt-freebsd-10/main.yml
index 2ad4584..903dd45 100644
--- a/guests/host_vars/libvirt-freebsd-10/main.yml
+++ b/guests/host_vars/libvirt-freebsd-10/main.yml
@@ -14,4 +14,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
diff --git a/guests/host_vars/libvirt-freebsd-11/main.yml b/guests/host_vars/libvirt-freebsd-11/main.yml
index 2ad4584..903dd45 100644
--- a/guests/host_vars/libvirt-freebsd-11/main.yml
+++ b/guests/host_vars/libvirt-freebsd-11/main.yml
@@ -14,4 +14,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
diff --git a/guests/host_vars/libvirt-freebsd-current/main.yml b/guests/host_vars/libvirt-freebsd-current/main.yml
index 2ad4584..903dd45 100644
--- a/guests/host_vars/libvirt-freebsd-current/main.yml
+++ b/guests/host_vars/libvirt-freebsd-current/main.yml
@@ -14,4 +14,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
diff --git a/guests/host_vars/libvirt-ubuntu-14/main.yml b/guests/host_vars/libvirt-ubuntu-14/main.yml
index 839c668..8b59152 100644
--- a/guests/host_vars/libvirt-ubuntu-14/main.yml
+++ b/guests/host_vars/libvirt-ubuntu-14/main.yml
@@ -7,4 +7,3 @@ projects:
- libvirt-tck
- osinfo-db
- osinfo-db-tools
- - virt-viewer
diff --git a/guests/host_vars/libvirt-ubuntu-16/main.yml b/guests/host_vars/libvirt-ubuntu-16/main.yml
index a588c09..032572f 100644
--- a/guests/host_vars/libvirt-ubuntu-16/main.yml
+++ b/guests/host_vars/libvirt-ubuntu-16/main.yml
@@ -13,4 +13,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
diff --git a/guests/host_vars/libvirt-ubuntu-18/main.yml b/guests/host_vars/libvirt-ubuntu-18/main.yml
index a588c09..032572f 100644
--- a/guests/host_vars/libvirt-ubuntu-18/main.yml
+++ b/guests/host_vars/libvirt-ubuntu-18/main.yml
@@ -13,4 +13,3 @@ projects:
- osinfo-db
- osinfo-db-tools
- virt-manager
- - virt-viewer
--
2.17.1
6 years, 3 months
[libvirt] [PATCH] Remove unnecessary virQEMUDriverPtr arguments
by Steven Albertson
Signed-off-by Steven Albertson <sralbert42(a)gmail.com>
---
src/qemu/qemu_block.c | 15 +++++++--------
src/qemu/qemu_block.h | 6 ++----
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 66e6301210..8081bced9d 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -339,8 +339,7 @@ qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
int
-qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
+qemuBlockNodeNamesDetect(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -354,13 +353,13 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_NAMED_BLOCK_NODES))
return 0;
- if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
return -1;
data = qemuMonitorQueryNamedBlockNodes(qemuDomainGetMonitor(vm));
blockstats = qemuMonitorQueryBlockstats(qemuDomainGetMonitor(vm), false);
- if (qemuDomainObjExitMonitor(driver, vm) < 0 || !data || !blockstats)
+ if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || !data || !blockstats)
goto cleanup;
if (!(disktable = qemuBlockNodeNameGetBackingChain(data, blockstats)))
@@ -1689,14 +1688,14 @@ qemuBlockStorageSourceAttachRollback(qemuMonitorPtr mon,
* monitor internally.
*/
int
-qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
+qemuBlockStorageSourceDetachOneBlockdev(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
virStorageSourcePtr src)
{
+ qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
- if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
return -1;
ret = qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->nodeformat);
@@ -1704,7 +1703,7 @@ qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver,
if (ret == 0)
ret = qemuMonitorBlockdevDel(qemuDomainGetMonitor(vm), src->nodestorage);
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ if (qemuDomainObjExitMonitor(priv->driver, vm) < 0)
return -1;
return ret;
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index fd8984e60b..725ce936d5 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -47,8 +47,7 @@ qemuBlockNodeNameGetBackingChain(virJSONValuePtr namednodesdata,
virJSONValuePtr blockstats);
int
-qemuBlockNodeNamesDetect(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
+qemuBlockNodeNamesDetect(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob);
virHashTablePtr
@@ -112,8 +111,7 @@ qemuBlockStorageSourceAttachRollback(qemuMonitorPtr mon,
qemuBlockStorageSourceAttachDataPtr data);
int
-qemuBlockStorageSourceDetachOneBlockdev(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
+qemuBlockStorageSourceDetachOneBlockdev(virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
virStorageSourcePtr src);
--
2.17.1
6 years, 3 months
[libvirt] libvirt-dbus build for virt-preview
by Vasiliy Tolstov
Hi! Does it possible to add libvirt-dbus building for virt-preview repo?
My use case - get latest libvirt-dbus in current fedora stable release.
--
Vasiliy Tolstov,
e-mail: v.tolstov(a)selfip.ru
6 years, 3 months
[libvirt] [PATCH v2 00/17] Introduce RDT memory bandwidth allocation support
by bing.niu@intel.com
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 main parts:
Part 1: Add two new structures virResctrlInfoMemMB and virResctrlAllocMemBW 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_bandwidth>
<node id='0' cpus='0-19'>
<control granularity='10' min ='10' maxAllocs='8'/>
</node>
</memory_bandwidth>
</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
----------------------------------------------------------------------------------------------
With this extension of the virresctrl, the overall working follow of CAT and MBA is described by below
picture. XML parser will aggregate MBA and CAT configuration and represents it in one virresctrl object.
The methods of virresctrl class will manipulate resctrl interface to allocate corresponding resources.
<memorytune cpus='0-3'>
+---------+
| <cachetune vcpus='0-3'>
XML | +
parser +-----------+
|
|
+------------------------------+
|
|
internal object +------v--------------+
virResctrlAlloc | backing object |
+------+--------------+
|
|
+------------------------------+
|
+--v-------+
| |
| schemata |
/sys/fs/resctrl | tasks |
| . |
| . |
| |
+----------+
---------------------------------------------------------------------
previous versions and discussion can be found at
v1: https://www.redhat.com/archives/libvir-list/2018-July/msg01144.html
RFC v2: https://www.redhat.com/archives/libvir-list/2018-June/msg01268.html
RFC v1: https://www.redhat.com/archives/libvir-list/2018-May/msg02101.html
Changelog:
v1 -> this: John's comment: 1. Split calculation of number of memory bandwidth control
to one patch.
2. Split virResctrlAllocMemBW relating methods to 5 patch, each
provides one kind of function, eg: schemata processing, memory
bandwidth calculation.....
3. Use resctrl to replace cachetune in domain conf.
4. Split refactor virDomainCachetuneDefParse into 3 patches. And
adjust some logic, eg: use %s format error log, renaming
functions.....
5. Complete doc description. eg: update cachetune part about vcpus
overlapping with memorytune, update libvirt version info for memory
bandwidth control availability.
6. Some coding style fix.
RFC_v2->v1: John's comment: 1. use name MemBW to replace MB for a more clear description.
2. split rename patch and put refactor function part separately.
3. split virResctrlInfoMemMB and virResctrlAllocMemBW to different
patches.
4. add docs/schemas/*.rng for XML related patches.
5. some cleanup for coding conventions.
RFC_ v1->RFC_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 (17):
util: Rename some functions of virresctrl
util: Refactor virResctrlGetInfo in virresctrl
util: Refactor virResctrlAllocFormat of virresctrl
util: Add MBA capability information query to resctrl
util: Add MBA check to virResctrlInfoGetCache
util: Add MBA allocation to virresctrl
util: Add MBA schemata parse and format methods
util: Add support to calculate MBA utilization
util: Introduce virResctrlAllocForeachMemory
util: Introduce virResctrlAllocSetMemoryBandwidth
conf: Rename cachetune to resctrl
conf: Factor out vcpus parsing part from virDomainCachetuneDefParse
conf: Factor out vcpus overlapping from virDomainCachetuneDefParse
conf: Factor out virDomainResctrlDef update from
virDomainCachetuneDefParse
conf: Add support for memorytune XML processing for resctrl MBA
conf: Add return value check to virResctrlAllocForeachCache
conf: Add memory bandwidth allocation capability of host
docs/formatdomain.html.in | 39 +-
docs/schemas/capability.rng | 33 ++
docs/schemas/domaincommon.rng | 17 +
src/conf/capabilities.c | 107 ++++
src/conf/capabilities.h | 11 +
src/conf/domain_conf.c | 427 +++++++++++---
src/conf/domain_conf.h | 10 +-
src/libvirt_private.syms | 6 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_process.c | 18 +-
src/util/virresctrl.c | 611 +++++++++++++++++++--
src/util/virresctrl.h | 55 +-
.../memorytune-colliding-allocs.xml | 30 +
.../memorytune-colliding-cachetune.xml | 32 ++
tests/genericxml2xmlindata/memorytune.xml | 33 ++
tests/genericxml2xmltest.c | 5 +
.../linux-resctrl/resctrl/info/MB/bandwidth_gran | 1 +
.../linux-resctrl/resctrl/info/MB/min_bandwidth | 1 +
.../linux-resctrl/resctrl/info/MB/num_closids | 1 +
tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml | 8 +
tests/virresctrldata/resctrl.schemata | 1 +
21 files changed, 1279 insertions(+), 169 deletions(-)
create mode 100644 tests/genericxml2xmlindata/memorytune-colliding-allocs.xml
create mode 100644 tests/genericxml2xmlindata/memorytune-colliding-cachetune.xml
create mode 100644 tests/genericxml2xmlindata/memorytune.xml
create mode 100644 tests/vircaps2xmldata/linux-resctrl/resctrl/info/MB/bandwidth_gran
create mode 100644 tests/vircaps2xmldata/linux-resctrl/resctrl/info/MB/min_bandwidth
create mode 100644 tests/vircaps2xmldata/linux-resctrl/resctrl/info/MB/num_closids
--
2.7.4
6 years, 3 months
[libvirt] [PATCH 0/9] Introduce RDT memory bandwidth allocation support
by bing.niu@intel.com
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 main parts:
Part 1: Add two new structures virResctrlInfoMemMB and virResctrlAllocMemBW 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_bandwidth>
<node id='0' cpus='0-19'>
<control granularity='10' min ='10' maxAllocs='8'/>
</node>
</memory_bandwidth>
</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
----------------------------------------------------------------------------------------------
With this extension of the virresctrl, the overall working follow of CAT and MBA is described by below
picture. XML parser will aggregate MBA and CAT configuration and represents it in one virresctrl object.
The methods of virresctrl class will manipulate resctrl interface to allocate corresponding resources.
<memorytune cpus='0-3'>
+---------+
| <cachetune vcpus='0-3'>
XML | +
parser +-----------+
|
|
+------------------------------+
|
|
internal object +------v--------------+
virResctrlAlloc | backing object |
+------+--------------+
|
|
+------------------------------+
|
+--v-------+
| |
| schemata |
/sys/fs/resctrl | tasks |
| . |
| . |
| |
+----------+
---------------------------------------------------------------------
previous RFC versions and discussion can be found at
v2: https://www.redhat.com/archives/libvir-list/2018-June/msg01268.html
v1: https://www.redhat.com/archives/libvir-list/2018-May/msg02101.html
Changelog:
RFC_v2->this: John's comment: 1. use name MemBW to replace MB for a more clear description.
2. split rename patch and put refactor function part separately.
3. split virResctrlInfoMemMB and virResctrlAllocMemBW to different
patches.
4. add docs/schemas/*.rng for XML related patches.
5. some cleanup for coding conventions.
RFC_ v1->RFC_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 (9):
util: Rename some functions of virresctrl
util: Refactor virResctrlGetInfo in virresctrl
util: Refactor virResctrlAllocFormat of virresctrl
util: Add MBA capability information query to resctrl
util: Add MBA allocation to virresctrl
conf: Rename cachetune to restune
conf: Refactor virDomainCachetuneDefParse
conf: Introduce cputune/memorytune to support memory bandwidth
allocation
conf: Add memory bandwidth allocation capability of host
docs/formatdomain.html.in | 35 ++
docs/schemas/capability.rng | 33 ++
docs/schemas/domaincommon.rng | 17 +
src/conf/capabilities.c | 108 ++++
src/conf/capabilities.h | 11 +
src/conf/domain_conf.c | 408 ++++++++++++---
src/conf/domain_conf.h | 10 +-
src/libvirt_private.syms | 4 +-
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_process.c | 18 +-
src/util/virresctrl.c | 574 +++++++++++++++++++--
src/util/virresctrl.h | 54 +-
.../memorytune-colliding-allocs.xml | 30 ++
.../memorytune-colliding-cachetune.xml | 32 ++
tests/genericxml2xmlindata/memorytune.xml | 33 ++
tests/genericxml2xmltest.c | 5 +
.../linux-resctrl/resctrl/info/MB/bandwidth_gran | 1 +
.../linux-resctrl/resctrl/info/MB/min_bandwidth | 1 +
.../linux-resctrl/resctrl/info/MB/num_closids | 1 +
tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml | 8 +
tests/virresctrldata/resctrl.schemata | 1 +
21 files changed, 1233 insertions(+), 153 deletions(-)
create mode 100644 tests/genericxml2xmlindata/memorytune-colliding-allocs.xml
create mode 100644 tests/genericxml2xmlindata/memorytune-colliding-cachetune.xml
create mode 100644 tests/genericxml2xmlindata/memorytune.xml
create mode 100644 tests/vircaps2xmldata/linux-resctrl/resctrl/info/MB/bandwidth_gran
create mode 100644 tests/vircaps2xmldata/linux-resctrl/resctrl/info/MB/min_bandwidth
create mode 100644 tests/vircaps2xmldata/linux-resctrl/resctrl/info/MB/num_closids
--
2.7.4
6 years, 3 months
[libvirt] [PATCH v2] util: clang is failing to compile due to unused variables.
by Julio Faracco
After some recent patches, clang is throwing some errors related to
unused variables. This is not happening when we use GCC with -Werror
enabled. Only clang reports this warning.
make[3]: Entering directory '/home/julio/Desktop/virt/libvirt/src'
CC util/libvirt_util_la-virscsivhost.lo
CC util/libvirt_util_la-virusb.lo
CC util/libvirt_util_la-virmdev.lo
util/virmdev.c:373:36: error: unused variable 'ret' [-Werror,-Wunused-variable]
VIR_AUTOPTR(virMediatedDevice) ret = virMediatedDeviceListSteal(list, dev);
^
1 error generated.
Makefile:11579: recipe for target 'util/libvirt_util_la-virmdev.lo' failed
make[3]: *** [util/libvirt_util_la-virmdev.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
util/virscsivhost.c:112:37: error: unused variable 'tmp' [-Werror,-Wunused-variable]
VIR_AUTOPTR(virSCSIVHostDevice) tmp = virSCSIVHostDeviceListSteal(list, dev);
^
1 error generated.
Makefile:11411: recipe for target 'util/libvirt_util_la-virscsivhost.lo' failed
make[3]: *** [util/libvirt_util_la-virscsivhost.lo] Error 1
util/virusb.c:511:31: error: unused variable 'ret' [-Werror,-Wunused-variable]
VIR_AUTOPTR(virUSBDevice) ret = virUSBDeviceListSteal(list, dev);
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/util/virmdev.c | 2 +-
src/util/virscsivhost.c | 2 +-
src/util/virusb.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/virmdev.c b/src/util/virmdev.c
index 4050835cc1..4492fd673e 100644
--- a/src/util/virmdev.c
+++ b/src/util/virmdev.c
@@ -370,7 +370,7 @@ void
virMediatedDeviceListDel(virMediatedDeviceListPtr list,
virMediatedDevicePtr dev)
{
- VIR_AUTOPTR(virMediatedDevice) ret = virMediatedDeviceListSteal(list, dev);
+ virMediatedDeviceListSteal(list, dev);
}
diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c
index 280d0dc2fd..1a069e67ff 100644
--- a/src/util/virscsivhost.c
+++ b/src/util/virscsivhost.c
@@ -109,7 +109,7 @@ void
virSCSIVHostDeviceListDel(virSCSIVHostDeviceListPtr list,
virSCSIVHostDevicePtr dev)
{
- VIR_AUTOPTR(virSCSIVHostDevice) tmp = virSCSIVHostDeviceListSteal(list, dev);
+ virSCSIVHostDeviceListSteal(list, dev);
}
diff --git a/src/util/virusb.c b/src/util/virusb.c
index 609d54836f..d14b7623cc 100644
--- a/src/util/virusb.c
+++ b/src/util/virusb.c
@@ -508,7 +508,7 @@ void
virUSBDeviceListDel(virUSBDeviceListPtr list,
virUSBDevicePtr dev)
{
- VIR_AUTOPTR(virUSBDevice) ret = virUSBDeviceListSteal(list, dev);
+ virUSBDeviceListSteal(list, dev);
}
virUSBDevicePtr
--
2.17.1
6 years, 3 months