[libvirt] [RFC PATCH 0/2] nodeinfo: PPC64: Fix topology and siblings info on capabilities and nodeinfo
by Shivaprasad G Bhat
The nodeinfo output was fixed earlier to reflect the actual cpus available in
KVM mode on PPC64. The earlier fixes covered the aspect of not making a host
look overcommitted when its not. The current fixes are aimed at helping the
users make better decisions on the kind of guest cpu topology that can be
supported on the given sucore_per_core setting of KVM host and also hint the
way to pin the guest vcpus efficiently.
I am planning to add some test cases once the approach is accepted.
With respect to Patch 2:
The second patch adds a new element to the cpus tag and I need your inputs on
if that is okay. Also if there is a better way. I am not sure if the existing
clients have RNG checks that might fail with the approach. Or if the checks
are not enoforced on the elements but only on the tags.
With my approach if the rng checks pass, the new element "capacity" even if
ignored by many clients would have no impact except for PPC64.
To the extent I looked at code, the siblings changes dont affect existing
libvirt functionality. Please do let me know otherwise.
---
Shivaprasad G Bhat (2):
nodeinfo: Reflect guest usable host topology on PPC64
Introduce capacity to virCapsHostNUMACellCPU to help vcpu pinning decisions
src/conf/capabilities.c | 3 +
src/conf/capabilities.h | 1
src/nodeinfo.c | 51 ++++++++++++++++++++++--
tests/vircaps2xmldata/vircaps-basic-4-4-2G.xml | 32 ++++++++-------
tests/vircaps2xmltest.c | 1
5 files changed, 67 insertions(+), 21 deletions(-)
--
Signature
8 years, 8 months
[libvirt] RFC: disk tray opened event and changing media API cooperation
by Nikolay Shirokovskiy
Hi, all.
I want to remove media if disk is ejected from guest. I can leverage tray
opened event for it but this event generated if i change media thru API call
too. Thus I can't just remove media on any such event. However it would be
possible if libvirt do not propagate tray opened event that originates from
qemuDomainUpdateDeviceFlags actions. On this way we need also to close tray
back if it was originally closed so state visible to client is in sync with
actual. I can imagine other cases when closing tray at the end of
qemuDomainUpdateDeviceFlags will be useful. Say implementing a kind of changer
in mgmt layer so that if guest ejects disk mgmt insert next media from some
playlist. In this case tray should be closed so that guest will see that media
is changed.
In short I suggest:
1. close tray at the end of chaning/ejecting media
2. if tray is opened during the operation than mask this event from client
Nikolay
8 years, 8 months
[libvirt] [PATCH 0/3] vz: make vz driver more responsive
by Nikolay Shirokovskiy
Patches 1 and 2 are tiny fixes and cleanups. 3 has the essence.
Nikolay Shirokovskiy (3):
vz: use state variable sdkdom in prlsdkApplyConfig
vz: remove redundant variable in prlsdkHandleVmAddedEvent
vz: make vz driver more responsive
src/vz/vz_driver.c | 183 ++++++++++++++++++++++++++++++++++---------------
src/vz/vz_sdk.c | 195 ++++++++++++++++++++++++++++++++++-------------------
src/vz/vz_utils.c | 50 ++++++++++++++
src/vz/vz_utils.h | 7 ++
4 files changed, 310 insertions(+), 125 deletions(-)
--
1.8.3.1
8 years, 8 months
[libvirt] [PATCH 0/2] vz: add tcp and udp serial device support
by Nikolay Shirokovskiy
Nikolay Shirokovskiy (2):
vz: add mode of unix socket serial device to xml dump
vz: add tcp and udp serial device support
src/vz/vz_sdk.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 96 insertions(+), 15 deletions(-)
--
1.8.3.1
8 years, 8 months
[libvirt] [PATCH 0/9] vz: define and other cleanups
by Nikolay Shirokovskiy
'vz: cleanup loading domain code' is main patch and
'vz: use domain list infrastructure to deal with private domain' is a
preparation for it. Other patches are mostly minor bugfixes and cleanups.
After the main patch driver lock is locked for very small time so massively
parallel domain definition is not serialized by vz driver anymore.
NOTE:
Applied on top of:
[PATCH] vz: get rid of unused home state variable in private domain obj
[PATCH 0/5] fix destination domain synchronization
Nikolay Shirokovskiy (9):
vz: remove unnecessary labels in simple API calls
vz: restore accidentally removed locks around close callback calls
vz: fix leaks in prlsdkCreate* functions
vz: make error handling idiomatic in prlsdkCreateVm
vz: use domain list infrastructure to deal with private domain
vz: cleanup loading domain code
vz: dont remove domain from list on client object error
vz: use single variable for domain
vz: don't fail unregister on sending event error
src/vz/vz_driver.c | 154 +++++++++++++----------------------
src/vz/vz_sdk.c | 229 ++++++++++++++++++++++++-----------------------------
src/vz/vz_sdk.h | 11 +--
src/vz/vz_utils.c | 58 ++++++--------
src/vz/vz_utils.h | 7 +-
5 files changed, 194 insertions(+), 265 deletions(-)
--
1.8.3.1
8 years, 8 months
[libvirt] [PATCH] vz: fix
by Olga Krishtal
Please, ignore previous patch.
Olga Krishtal (1):
vz: fixed null-pointer dereference in applying graphic params
src/vz/vz_sdk.c | 1 +
1 file changed, 1 insertion(+)
--
1.8.3.1
8 years, 8 months
[libvirt] [PATCH 0/5] fix destination domain synchronization
by Nikolay Shirokovskiy
Patch 4 is main one. Others are fixes and ground works.
Nikolay Shirokovskiy (5):
vz: don't pass empty and unused fields in migration cookie
vz: fix missed defined domain event
vz: fix memory leaks in prlsdkLoadDomains
vz: fix destination domain synchronization
vz: issue domain undefined event on finish step if needed
src/vz/vz_driver.c | 175 ++++++++++++++++++++++++++++-------------------------
src/vz/vz_sdk.c | 28 ++++++---
src/vz/vz_sdk.h | 5 ++
3 files changed, 118 insertions(+), 90 deletions(-)
--
1.8.3.1
8 years, 8 months
[libvirt] [PATCH 1/1] perf: add more perf events support
by Qiaowei Ren
With current perf framework, this patch adds support to more perf
events, including cache missing, cache peference, cpu cycles,
instrction, etc..
Signed-off-by: Qiaowei Ren <qiaowei.ren(a)intel.com>
---
docs/formatdomain.html.in | 24 +++++++++++
docs/schemas/domaincommon.rng | 4 ++
include/libvirt/libvirt-domain.h | 39 +++++++++++++++++
src/libvirt-domain.c | 8 ++++
src/qemu/qemu_driver.c | 23 +++++-----
src/util/virperf.c | 65 ++++++++++++++++++++++++++++-
src/util/virperf.h | 4 ++
tests/genericxml2xmlindata/generic-perf.xml | 4 ++
8 files changed, 158 insertions(+), 13 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f660aa6..7999e43 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1839,6 +1839,10 @@
<event name='cmt' enabled='yes'/>
<event name='mbmt' enabled='no'/>
<event name='mbml' enabled='yes'/>
+ <event name='cache_misses' enabled='no'/>
+ <event name='cache_peferences' enabled='no'/>
+ <event name='instructions' enabled='no'/>
+ <event name='cpu_cycles' enabled='no'/>
</perf>
...
</pre>
@@ -1864,6 +1868,26 @@
<td>bandwidth of memory traffic for a memory controller</td>
<td><code>perf.mbml</code></td>
</tr>
+ <tr>
+ <td><code>cache_misses</code></td>
+ <td>the amount of cache missing by applications running on the platform</td>
+ <td><code>perf.cache_misses</code></td>
+ </tr>
+ <tr>
+ <td><code>cache_peferences</code></td>
+ <td>the amount of cache hit by applications running on the platform</td>
+ <td><code>perf.cache_peferences</code></td>
+ </tr>
+ <tr>
+ <td><code>instructions</code></td>
+ <td>the amount of instructions by applications running on the platform</td>
+ <td><code>perf.instructions</code></td>
+ </tr>
+ <tr>
+ <td><code>cpu_cycles</code></td>
+ <td>the amount of cycles one instruction needs</td>
+ <td><code>perf.cpu_cycles</code></td>
+ </tr>
</table>
<h3><a name="elementsDevices">Devices</a></h3>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 563cb3c..e41dc3a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -414,6 +414,10 @@
<value>cmt</value>
<value>mbmt</value>
<value>mbml</value>
+ <value>cache_misses</value>
+ <value>cache_peferences</value>
+ <value>instructions</value>
+ <value>cpu_cycles</value>
</choice>
</attribute>
<attribute name="enabled">
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 7ea93aa..b79cdb0 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -1947,6 +1947,45 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
*/
# define VIR_PERF_PARAM_MBML "mbml"
+/**
+ * VIR_PERF_PARAM_CACHE_MISSES:
+ *
+ * Macro for typed parameter name that represents cache_misses perf
+ * event which can be used to measure the amount of cache missing by
+ * applications running on the platform. It corresponds to the
+ * "perf.cache_misses" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_CACHE_MISSES "cache_misses"
+
+/**
+ * VIR_PERF_PARAM_CACHE_REFERENCES:
+ *
+ * Macro for typed parameter name that represents cache_peferences
+ * perf event which can be used to measure the amount of cache hit
+ * by applications running on the platform. It corresponds to the
+ * "perf.cache_peferences" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_CACHE_REFERENCES "cache_peferences"
+
+/**
+ * VIR_PERF_PARAM_INSTRUCTIONS:
+ *
+ * Macro for typed parameter name that represents instructions perf
+ * event which can be used to measure the amount of instructions
+ * by applications running on the platform. It corresponds to the
+ * "perf.instructions" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_INSTRUCTIONS "instructions"
+
+/**
+ * VIR_PERF_PARAM_CPU_CYCLES:
+ *
+ * Macro for typed parameter name that represents cpu_cycles perf event
+ * which can be used to measure how many cycles one instruction needs.
+ * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs.
+ */
+# define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles"
+
int virDomainGetPerfEvents(virDomainPtr dom,
virTypedParameterPtr *params,
int *nparams,
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 4e71a94..b817e4b 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -11452,6 +11452,14 @@ virConnectGetDomainCapabilities(virConnectPtr conn,
* "perf.mbml" - the amount of data (bytes/s) sent through the memory controller
* on the socket as unsigned long long. It is produced by mbml
* perf event.
+ * "perf.cache_misses" - the amount of cache missing as unsigned long long.
+ * It is produced by cache_misses perf event.
+ * "perf.cache_peferences" - the amount of cache hit as unsigned long long.
+ * It is produced by cache_peferences perf event.
+ * "perf.instructions" - the amount of instructions as unsigned long long.
+ * It is produced by instructions perf event.
+ * "perf.cpu_cycles" - the amount of cycles one instruction needs as unsigned
+ * long long. It is produced by cpu_cycles perf event.
*
* Note that entire stats groups or individual stat fields may be missing from
* the output in case they are not supported by the given hypervisor, are not
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 61d184b..bea753f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9613,6 +9613,10 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
VIR_PERF_PARAM_CMT, VIR_TYPED_PARAM_BOOLEAN,
VIR_PERF_PARAM_MBMT, VIR_TYPED_PARAM_BOOLEAN,
VIR_PERF_PARAM_MBML, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_CACHE_MISSES, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_CACHE_REFERENCES, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_INSTRUCTIONS, VIR_TYPED_PARAM_BOOLEAN,
+ VIR_PERF_PARAM_CPU_CYCLES, VIR_TYPED_PARAM_BOOLEAN,
NULL) < 0)
return -1;
@@ -18941,10 +18945,10 @@ qemuDomainGetStatsBlock(virQEMUDriverPtr driver,
#undef QEMU_ADD_COUNT_PARAM
static int
-qemuDomainGetStatsPerfRdt(virPerfPtr perf,
- virPerfEventType type,
- virDomainStatsRecordPtr record,
- int *maxparams)
+qemuDomainGetStatsPerfOneEvent(virPerfPtr perf,
+ virPerfEventType type,
+ virDomainStatsRecordPtr record,
+ int *maxparams)
{
char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
uint64_t value = 0;
@@ -18980,14 +18984,9 @@ qemuDomainGetStatsPerf(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
if (!virPerfEventIsEnabled(priv->perf, i))
continue;
- switch (i) {
- case VIR_PERF_EVENT_CMT:
- case VIR_PERF_EVENT_MBMT:
- case VIR_PERF_EVENT_MBML:
- if (qemuDomainGetStatsPerfRdt(priv->perf, i, record, maxparams) < 0)
- goto cleanup;
- break;
- }
+ if (qemuDomainGetStatsPerfOneEvent(priv->perf, i,
+ record, maxparams) < 0)
+ goto cleanup;
}
ret = 0;
diff --git a/src/util/virperf.c b/src/util/virperf.c
index 4661ba3..a3d2bc6 100644
--- a/src/util/virperf.c
+++ b/src/util/virperf.c
@@ -38,7 +38,9 @@ VIR_LOG_INIT("util.perf");
#define VIR_FROM_THIS VIR_FROM_PERF
VIR_ENUM_IMPL(virPerfEvent, VIR_PERF_EVENT_LAST,
- "cmt", "mbmt", "mbml");
+ "cmt", "mbmt", "mbml",
+ "cache_misses", "cache_peferences",
+ "instructions", "cpu_cycles");
struct virPerfEvent {
int type;
@@ -189,6 +191,60 @@ virPerfRdtEnable(virPerfEventPtr event,
return -1;
}
+static int
+virPerfGeneralEnable(virPerfEventPtr event,
+ pid_t pid)
+{
+ struct perf_event_attr attr;
+
+ memset(&attr, 0, sizeof(attr));
+ attr.size = sizeof(attr);
+ attr.inherit = 1;
+ attr.disabled = 1;
+ attr.enable_on_exec = 0;
+
+ switch (event->type) {
+ case VIR_PERF_EVENT_CACHE_MISSES:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_CACHE_MISSES;
+ break;
+ case VIR_PERF_EVENT_CACHE_REFERENCES:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_CACHE_REFERENCES;
+ break;
+ case VIR_PERF_EVENT_INSTRUCTIONS:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_INSTRUCTIONS;
+ break;
+ case VIR_PERF_EVENT_CPU_CYCLES:
+ attr.type = PERF_TYPE_HARDWARE;
+ attr.config = PERF_COUNT_HW_CPU_CYCLES;
+ break;
+ }
+
+ event->fd = syscall(__NR_perf_event_open, &attr, pid, -1, -1, 0);
+ if (event->fd < 0) {
+ virReportSystemError(errno,
+ _("Unable to open perf event for %s"),
+ virPerfEventTypeToString(event->type));
+ goto error;
+ }
+
+ if (ioctl(event->fd, PERF_EVENT_IOC_ENABLE) < 0) {
+ virReportSystemError(errno,
+ _("Unable to enable perf event for %s"),
+ virPerfEventTypeToString(event->type));
+ goto error;
+ }
+
+ event->enabled = true;
+ return 0;
+
+ error:
+ VIR_FORCE_CLOSE(event->fd);
+ return -1;
+}
+
int
virPerfEventEnable(virPerfPtr perf,
virPerfEventType type,
@@ -205,6 +261,13 @@ virPerfEventEnable(virPerfPtr perf,
if (virPerfRdtEnable(event, pid) < 0)
return -1;
break;
+ case VIR_PERF_EVENT_CACHE_MISSES:
+ case VIR_PERF_EVENT_CACHE_REFERENCES:
+ case VIR_PERF_EVENT_INSTRUCTIONS:
+ case VIR_PERF_EVENT_CPU_CYCLES:
+ if (virPerfGeneralEnable(event, pid) < 0)
+ return -1;
+ break;
case VIR_PERF_EVENT_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected perf event type=%d"), type);
diff --git a/src/util/virperf.h b/src/util/virperf.h
index 7163410..7129370 100644
--- a/src/util/virperf.h
+++ b/src/util/virperf.h
@@ -28,6 +28,10 @@ typedef enum {
VIR_PERF_EVENT_CMT,
VIR_PERF_EVENT_MBMT,
VIR_PERF_EVENT_MBML,
+ VIR_PERF_EVENT_CACHE_MISSES,
+ VIR_PERF_EVENT_CACHE_REFERENCES,
+ VIR_PERF_EVENT_INSTRUCTIONS,
+ VIR_PERF_EVENT_CPU_CYCLES,
VIR_PERF_EVENT_LAST
} virPerfEventType;
diff --git a/tests/genericxml2xmlindata/generic-perf.xml b/tests/genericxml2xmlindata/generic-perf.xml
index 394d2a6..6428ebd 100644
--- a/tests/genericxml2xmlindata/generic-perf.xml
+++ b/tests/genericxml2xmlindata/generic-perf.xml
@@ -16,6 +16,10 @@
<event name='cmt' enabled='yes'/>
<event name='mbmt' enabled='no'/>
<event name='mbml' enabled='yes'/>
+ <event name='cache_misses' enabled='no'/>
+ <event name='cache_peferences' enabled='no'/>
+ <event name='instructions' enabled='no'/>
+ <event name='cpu_cycles' enabled='no'/>
</perf>
<devices>
</devices>
--
1.9.1
8 years, 8 months
[libvirt] [PATCH 0/4] Speed up hvsupport.pl
by Ján Tomko
This reduces the script execution time from 14.7s to 60 ms.
Since this was by far the longest taking target from the docs/ directory
and make does not parallelize across Makefiles, the savings are similar
for a complete build from a fresh git checkout.
The second patch shaves off 8.2s, the third 6.4s and the last one shaves
off half of the remaining time.
Ján Tomko (4):
hvsupport: Introduce parseSymsFile
hvsupport: drop XML::XPath
hvsupport: construct regex up front
hvsupport: skip non-matching lines early
bootstrap.conf | 1 -
docs/hvsupport.pl | 218 +++++++++++++++++++++---------------------------------
2 files changed, 85 insertions(+), 134 deletions(-)
--
2.7.3
8 years, 8 months
[libvirt] [PATCH] qemu: don't set fake reboot if it will not be used
by Nikolay Shirokovskiy
The use case is similar to e2b86f580. First call shutdown with
reboot semantics in agent mode. As a result fake reboot flag is set.
Next issue shutdown from guest and you will get reboot due to fake
reboot flag set.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/qemu/qemu_driver.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 61d184b..f9562bd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1997,8 +1997,6 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
useAgent = false;
}
- qemuDomainSetFakeReboot(driver, vm, isReboot);
-
if (useAgent) {
qemuDomainObjEnterAgent(vm);
ret = qemuAgentShutdown(priv->agent, agentFlag);
@@ -2018,6 +2016,7 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
goto endjob;
}
+ qemuDomainSetFakeReboot(driver, vm, isReboot);
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorSystemPowerdown(priv->mon);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
--
1.8.3.1
8 years, 8 months