[libvirt] [PATCH] qemuTestDriverInit: Don't access live data
by Michal Privoznik
Some of our tests (e.g. qemuhotplugtest) call
virDomainSaveConfig(). Now the problem is, qemuTestDriverInit()
creates a fake qemu driver and fills it with some fake
configuration. At least so we hoped. The truth is, it calls
regular virQEMUDriverConfigNew() and then fix couple of paths.
Literally. Therefore our tests see regular stateDir and configDir
for the user that is running the tests. Directories, where live
domain XMLs are stored. Let's just hope our test suite hasn't
mangled any of them.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/testutilsqemu.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 56a89c913..0726cd317 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -513,6 +513,10 @@ qemuTestParseCapabilities(virCapsPtr caps,
void qemuTestDriverFree(virQEMUDriver *driver)
{
virMutexDestroy(&driver->lock);
+ if (driver->config) {
+ virFileDeleteTree(driver->config->stateDir);
+ virFileDeleteTree(driver->config->configDir);
+ }
virQEMUCapsCacheFree(driver->qemuCapsCache);
virObjectUnref(driver->xmlopt);
virObjectUnref(driver->caps);
@@ -548,9 +552,14 @@ int qemuTestCapsCacheInsert(virQEMUCapsCachePtr cache, const char *binary,
return ret;
}
+# define STATEDIRTEMPLATE abs_builddir "/qemustatedir-XXXXXX"
+# define CONFIGDIRTEMPLATE abs_builddir "/qemuconfigdir-XXXXXX"
+
int qemuTestDriverInit(virQEMUDriver *driver)
{
virSecurityManagerPtr mgr = NULL;
+ char statedir[] = STATEDIRTEMPLATE;
+ char configdir[] = CONFIGDIRTEMPLATE;
memset(driver, 0, sizeof(*driver));
@@ -561,6 +570,11 @@ int qemuTestDriverInit(virQEMUDriver *driver)
if (!driver->config)
goto error;
+ /* Do this early so that qemuTestDriverFree() doesn't see (unlink) the real
+ * dirs. */
+ VIR_FREE(driver->config->stateDir);
+ VIR_FREE(driver->config->configDir);
+
/* Overwrite some default paths so it's consistent for tests. */
VIR_FREE(driver->config->libDir);
VIR_FREE(driver->config->channelTargetDir);
@@ -568,6 +582,26 @@ int qemuTestDriverInit(virQEMUDriver *driver)
VIR_STRDUP(driver->config->channelTargetDir, "/tmp/channel") < 0)
goto error;
+ if (!mkdtemp(statedir)) {
+ virFilePrintf(stderr, "Cannot create fake stateDir");
+ goto error;
+ }
+
+ if (VIR_STRDUP(driver->config->stateDir, statedir) < 0) {
+ rmdir(statedir);
+ goto error;
+ }
+
+ if (!mkdtemp(configdir)) {
+ virFilePrintf(stderr, "Cannot create fake configDir");
+ goto error;
+ }
+
+ if (VIR_STRDUP(driver->config->configDir, configdir) < 0) {
+ rmdir(configdir);
+ goto error;
+ }
+
driver->caps = testQemuCapsInit();
if (!driver->caps)
goto error;
--
2.11.0
7 years, 8 months
[libvirt] [PATCH] qemu_process: don't probe iothreads if it's not supported by QEMU
by Pavel Hrdina
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1430258
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_process.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 78d10099af..fcba7d3097 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2098,6 +2098,11 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver,
int ret = -1;
size_t i;
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
+ ret = 0;
+ goto cleanup;
+ }
+
/* Get the list of IOThreads from qemu */
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
--
2.12.0
7 years, 8 months
[libvirt] [PATCH] libvirt-remote:fix use-after-free when sending event message
by Caoxinhua
>From 6b42792cfee124a742999e698e348e99b382ba16 Mon Sep 17 00:00:00 2001
From: c00207022 <caoxinhua(a)huawei.com>
Date: Thu, 2 Mar 2017 12:07:27 +0800
Subject: [PATCH] libvirt-remote:fix use-after-free when sending event message
[Changelog]:If there is a process with a client which registers event callbacks,
and it calls libvirt's API which uses the same virConnectPtr in that
callback function. When this process exit abnormally lead to client
disconnect, there is a possibility that the libvirtd's main thread is use
virServerClient to send event just after the virServerClient been freed by job
thread.
Following is backtrace:
#0 0x00007fda223d66d8 in virClassIsDerivedFrom (klass=0xdeadbeef, parent=0x7fda24c81b40) at util/virobject.c:169
#1 0x00007fda223d6a1e in virObjectIsClass (anyobj=anyobj@entry=0x7fd9e575b400, klass=<optimized out>) at util/virobject.c:365
#2 0x00007fda223d6a44 in virObjectLock (anyobj=0x7fd9e575b400) at util/virobject.c:317
#3 0x00007fda22507f71 in virNetServerClientSendMessage (client=client@entry=0x7fd9e575b400, msg=msg@entry=0x7fd9ec30de90)
at rpc/virnetserverclient.c:1422
#4 0x00007fda230d714d in remoteDispatchObjectEventSend (client=0x7fd9e575b400, program=0x7fda24c844e0, procnr=348,
proc=0x7fda2310e5e0 <xdr_remote_domain_event_callback_tunable_msg>, data=0x7ffc3857fdb0) at remote.c:3803
#5 0x00007fda230dd71b in remoteRelayDomainEventTunable (conn=<optimized out>, dom=0x7fda27cd7660, params=0x7fda27f3aae0, nparams=1,
opaque=0x7fd9e6c99e00) at remote.c:1033
#6 0x00007fda224484cb in virDomainEventDispatchDefaultFunc (conn=0x7fda27cd0120, event=0x7fda2736ea00,
cb=0x7fda230dd610 <remoteRelayDomainEventTunable>, cbopaque=0x7fd9e6c99e00) at conf/domain_event.c:1910
#7 0x00007fda22446871 in virObjectEventStateDispatchCallbacks (callbacks=<optimized out>, callbacks=<optimized out>, event=0x7fda2736ea00,
state=0x7fda24ca3960) at conf/object_event.c:722
#8 virObjectEventStateQueueDispatch (callbacks=0x7fda24c65800, queue=0x7ffc3857fe90, state=0x7fda24ca3960) at conf/object_event.c:736
#9 virObjectEventStateFlush (state=0x7fda24ca3960) at conf/object_event.c:814
#10 virObjectEventTimer (timer=<optimized out>, opaque=0x7fda24ca3960) at conf/object_event.c:560
#11 0x00007fda223ae8b9 in virEventPollDispatchTimeouts () at util/vireventpoll.c:458
#12 virEventPollRunOnce () at util/vireventpoll.c:654
#13 0x00007fda223ad1d2 in virEventRunDefaultImpl () at util/virevent.c:314
#14 0x00007fda225046cd in virNetDaemonRun (dmn=0x7fda24c775c0) at rpc/virnetdaemon.c:818
#15 0x00007fda230d6351 in main (argc=<optimized out>, argv=<optimized out>) at libvirtd.c:1623
Let's clean all event callback when client close.
Signed-off-by: Caoxinhua <caoxinhua(a)huawei.com>
---
daemon/remote.c | 76 +++++++++++++++++++++------------------------------------
1 file changed, 28 insertions(+), 48 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 23c9de4..fb7cd50 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -101,6 +101,7 @@ static void make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNod
static void make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src);
static void make_nonnull_nwfilter(remote_nonnull_nwfilter *net_dst, virNWFilterPtr nwfilter_src);
static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src);
+static void remoteClientCleanEventCallbacks(struct daemonClientPrivate *priv);
static int
remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
@@ -1483,24 +1484,15 @@ void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int r
&msg);
}
-/*
- * You must hold lock for at least the client
- * We don't free stuff here, merely disconnect the client's
- * network socket & resources.
- * We keep the libvirt connection open until any async
- * jobs have finished, then clean it up elsewhere
- */
-void remoteClientFreeFunc(void *data)
+static void remoteClientCleanEventCallbacks(struct daemonClientPrivate *priv)
{
- struct daemonClientPrivate *priv = data;
-
/* Deregister event delivery callback */
- if (priv->conn) {
- virIdentityPtr sysident = virIdentityGetSystem();
+ if (priv && priv->conn) {
size_t i;
-
+ virIdentityPtr sysident = virIdentityGetSystem();
virIdentitySetCurrent(sysident);
+ virMutexLock(&priv->lock);
for (i = 0; i < priv->ndomainEventCallbacks; i++) {
int callbackID = priv->domainEventCallbacks[i]->callbackID;
if (callbackID < 0) {
@@ -1514,6 +1506,7 @@ void remoteClientFreeFunc(void *data)
VIR_WARN("unexpected domain event deregister failure");
}
VIR_FREE(priv->domainEventCallbacks);
+ priv->ndomainEventCallbacks = 0;
for (i = 0; i < priv->nnetworkEventCallbacks; i++) {
int callbackID = priv->networkEventCallbacks[i]->callbackID;
@@ -1529,36 +1522,7 @@ void remoteClientFreeFunc(void *data)
VIR_WARN("unexpected network event deregister failure");
}
VIR_FREE(priv->networkEventCallbacks);
-
- for (i = 0; i < priv->nstorageEventCallbacks; i++) {
- int callbackID = priv->storageEventCallbacks[i]->callbackID;
- if (callbackID < 0) {
- VIR_WARN("unexpected incomplete storage pool callback %zu", i);
- continue;
- }
- VIR_DEBUG("Deregistering remote storage pool event relay %d",
- callbackID);
- priv->storageEventCallbacks[i]->callbackID = -1;
- if (virConnectStoragePoolEventDeregisterAny(priv->conn,
- callbackID) < 0)
- VIR_WARN("unexpected storage pool event deregister failure");
- }
- VIR_FREE(priv->storageEventCallbacks);
-
- for (i = 0; i < priv->nnodeDeviceEventCallbacks; i++) {
- int callbackID = priv->nodeDeviceEventCallbacks[i]->callbackID;
- if (callbackID < 0) {
- VIR_WARN("unexpected incomplete node device callback %zu", i);
- continue;
- }
- VIR_DEBUG("Deregistering remote node device event relay %d",
- callbackID);
- priv->nodeDeviceEventCallbacks[i]->callbackID = -1;
- if (virConnectNodeDeviceEventDeregisterAny(priv->conn,
- callbackID) < 0)
- VIR_WARN("unexpected node device event deregister failure");
- }
- VIR_FREE(priv->nodeDeviceEventCallbacks);
+ priv->nnetworkEventCallbacks = 0;
for (i = 0; i < priv->nqemuEventCallbacks; i++) {
int callbackID = priv->qemuEventCallbacks[i]->callbackID;
@@ -1574,31 +1538,47 @@ void remoteClientFreeFunc(void *data)
VIR_WARN("unexpected qemu monitor event deregister failure");
}
VIR_FREE(priv->qemuEventCallbacks);
+ priv->nqemuEventCallbacks = 0;
if (priv->closeRegistered) {
if (virConnectUnregisterCloseCallback(priv->conn,
remoteRelayConnectionClosedEvent) < 0)
VIR_WARN("unexpected close callback event deregister failure");
}
-
- virConnectClose(priv->conn);
-
+ virMutexUnlock(&priv->lock);
virIdentitySetCurrent(NULL);
virObjectUnref(sysident);
}
+}
+
+
+/*
+ * You must hold lock for at least the client
+ * We don't free stuff here, merely disconnect the client's
+ * network socket & resources.
+ * We keep the libvirt connection open until any async
+ * jobs have finished, then clean it up elsewhere
+ */
+void remoteClientFreeFunc(void *data)
+{
+ struct daemonClientPrivate *priv = data;
+ if (!priv || !priv->conn)
+ return;
+
+ remoteClientCleanEventCallbacks(priv);
+ virConnectClose(priv->conn);
VIR_FREE(priv);
}
-
static void remoteClientCloseFunc(virNetServerClientPtr client)
{
struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
daemonRemoveAllClientStreams(priv->streams);
+ remoteClientCleanEventCallbacks(priv);
}
-
void *remoteClientInitHook(virNetServerClientPtr client,
void *opaque ATTRIBUTE_UNUSED)
{
--
1.8.3.1
7 years, 8 months
[libvirt] [PATCH] network: don't use dhcp-authoritative on static networks
by Martin Wilck
"Static" DHCP networks are those where no dynamic DHCP range is
defined, only a list of host entries is used to serve permanent
IP addresses. On such networks, we don't want dnsmasq to reply
to other requests than those statically defined. But
"dhcp-authoritative" will cause dnsmasq to do just that.
Therefore we can't use "dhcp-authoritative" for static networks.
Fixes: 4ac20b3ae "network: add dnsmasq option 'dhcp-authoritative'"
Signed-off-by: Martin Wilck <mwilck(a)suse.com>
---
src/network/bridge_driver.c | 9 ++++++++-
tests/networkxml2confdata/dhcp6host-routed-network.conf | 1 -
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index ae1589d8c..17c6f3a0f 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1355,7 +1355,14 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET)) {
if (ipdef->nranges || ipdef->nhosts) {
virBufferAddLit(&configbuf, "dhcp-no-override\n");
- virBufferAddLit(&configbuf, "dhcp-authoritative\n");
+ /*
+ * Use "dhcp-authoritative" only for dynamic DHCP.
+ * In a static-only network, it would cause dnsmasq
+ * to reply to requests from other hosts than those
+ * statically defined.
+ */
+ if (ipdef->nranges || !ipdef->nhosts)
+ virBufferAddLit(&configbuf, "dhcp-authoritative\n");
}
if (ipdef->tftproot) {
diff --git a/tests/networkxml2confdata/dhcp6host-routed-network.conf b/tests/networkxml2confdata/dhcp6host-routed-network.conf
index 87a149880..5728ee430 100644
--- a/tests/networkxml2confdata/dhcp6host-routed-network.conf
+++ b/tests/networkxml2confdata/dhcp6host-routed-network.conf
@@ -10,7 +10,6 @@ bind-dynamic
interface=virbr1
dhcp-range=192.168.122.1,static
dhcp-no-override
-dhcp-authoritative
dhcp-range=2001:db8:ac10:fd01::1,static,64
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/local.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
--
2.11.0
7 years, 8 months
[libvirt] [PATCH] qemuDomainSaveImageUpdateDef: Don't overwrite errors from virDomainDefCheckABIStability
by Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1379200
When we are restoring a domain from a saved image, or just
updating its XML in the saved image - we have to make sure that
the ABI guests sees will not change. We have a function for that
which reports errors. But for some reason if this function fails,
we call it again with slightly different argument. Therefore it
might happen that we overwrite the original error and leave user
with less helpful one.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_driver.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 77d81755a..2bef0f200 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6109,7 +6109,7 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
goto cleanup;
if (!virDomainDefCheckABIStability(def, newdef_migr)) {
- virResetLastError();
+ virErrorPtr err = virSaveLastError();
/* Due to a bug in older version of external snapshot creation
* code, the XML saved in the save image was not a migratable
@@ -6117,8 +6117,12 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
* saved XML type, we need to check the ABI compatibility against
* the user provided XML if the check against the migratable XML
* fails. Snapshots created prior to v1.1.3 have this issue. */
- if (!virDomainDefCheckABIStability(def, newdef))
+ if (!virDomainDefCheckABIStability(def, newdef)) {
+ virSetError(err);
+ virFreeError(err);
goto cleanup;
+ }
+ virFreeError(err);
/* use the user provided XML */
ret = newdef;
--
2.11.0
7 years, 8 months
[libvirt] [PATCH go v3] Add support for perf events
by Nitesh Konkar
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
connect.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
domain.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
domain_compat.h | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 144 insertions(+)
diff --git a/connect.go b/connect.go
index 3c53485..a4dd21b 100644
--- a/connect.go
+++ b/connect.go
@@ -2264,6 +2264,24 @@ type DomainStatsPerf struct {
StalledCyclesBackend uint64
RefCpuCyclesSet bool
RefCpuCycles uint64
+ CpuClockSet bool
+ CpuClock uint64
+ TaskClockSet bool
+ TaskClock uint64
+ PageFaultsSet bool
+ PageFaults uint64
+ ContextSwitchesSet bool
+ ContextSwitches uint64
+ CpuMigrationsSet bool
+ CpuMigrations uint64
+ PageFaultsMinSet bool
+ PageFaultsMin uint64
+ PageFaultsMajSet bool
+ PageFaultsMaj uint64
+ AlignmentFaultsSet bool
+ AlignmentFaults uint64
+ EmulationFaultsSet bool
+ EmulationFaults uint64
}
func getDomainStatsPerfFieldInfo(params *DomainStatsPerf) map[string]typedParamsFieldInfo {
@@ -2320,6 +2338,42 @@ func getDomainStatsPerfFieldInfo(params *DomainStatsPerf) map[string]typedParams
set: ¶ms.RefCpuCyclesSet,
ul: ¶ms.RefCpuCycles,
},
+ "perf.cpu_clock": typedParamsFieldInfo{
+ set: ¶ms.CpuClockSet,
+ ul: ¶ms.CpuClock,
+ },
+ "perf.task_clock": typedParamsFieldInfo{
+ set: ¶ms.TaskClockSet,
+ ul: ¶ms.TaskClock,
+ },
+ "perf.page_faults": typedParamsFieldInfo{
+ set: ¶ms.PageFaultsSet,
+ ul: ¶ms.PageFaults,
+ },
+ "perf.context_switches": typedParamsFieldInfo{
+ set: ¶ms.ContextSwitchesSet,
+ ul: ¶ms.ContextSwitches,
+ },
+ "perf.cpu_migrations": typedParamsFieldInfo{
+ set: ¶ms.CpuMigrationsSet,
+ ul: ¶ms.CpuMigrations,
+ },
+ "perf.page_faults_min": typedParamsFieldInfo{
+ set: ¶ms.PageFaultsMinSet,
+ ul: ¶ms.PageFaultsMin,
+ },
+ "perf.page_faults_maj": typedParamsFieldInfo{
+ set: ¶ms.PageFaultsMajSet,
+ ul: ¶ms.PageFaultsMaj,
+ },
+ "perf.alignment_faults": typedParamsFieldInfo{
+ set: ¶ms.AlignmentFaultsSet,
+ ul: ¶ms.AlignmentFaults,
+ },
+ "perf.emulation_faults": typedParamsFieldInfo{
+ set: ¶ms.EmulationFaultsSet,
+ ul: ¶ms.EmulationFaults,
+ },
}
}
diff --git a/domain.go b/domain.go
index 2bd9852..9f3ecc3 100644
--- a/domain.go
+++ b/domain.go
@@ -3195,6 +3195,24 @@ type DomainPerfEvents struct {
StalledCyclesBackend bool
RefCpuCyclesSet bool
RefCpuCycles bool
+ CpuClockSet bool
+ CpuClock bool
+ TaskClockSet bool
+ TaskClock bool
+ PageFaultsSet bool
+ PageFaults bool
+ ContextSwitchesSet bool
+ ContextSwitches bool
+ CpuMigrationsSet bool
+ CpuMigrations bool
+ PageFaultsMinSet bool
+ PageFaultsMin bool
+ PageFaultsMajSet bool
+ PageFaultsMaj bool
+ AlignmentFaultsSet bool
+ AlignmentFaults bool
+ EmulationFaultsSet bool
+ EmulationFaults bool
}
/* Remember to also update DomainStatsPerf in connect.go when adding to the stuct above */
@@ -3253,6 +3271,42 @@ func getDomainPerfEventsFieldInfo(params *DomainPerfEvents) map[string]typedPara
set: ¶ms.RefCpuCyclesSet,
b: ¶ms.RefCpuCycles,
},
+ C.VIR_PERF_PARAM_CPU_CLOCK: typedParamsFieldInfo{
+ set: ¶ms.CpuClockSet,
+ b: ¶ms.CpuClock,
+ },
+ C.VIR_PERF_PARAM_TASK_CLOCK: typedParamsFieldInfo{
+ set: ¶ms.TaskClockSet,
+ b: ¶ms.TaskClock,
+ },
+ C.VIR_PERF_PARAM_PAGE_FAULTS: typedParamsFieldInfo{
+ set: ¶ms.PageFaultsSet,
+ b: ¶ms.PageFaults,
+ },
+ C.VIR_PERF_PARAM_CONTEXT_SWITCHES: typedParamsFieldInfo{
+ set: ¶ms.ContextSwitchesSet,
+ b: ¶ms.ContextSwitches,
+ },
+ C.VIR_PERF_PARAM_CPU_MIGRATIONS: typedParamsFieldInfo{
+ set: ¶ms.CpuMigrationsSet,
+ b: ¶ms.CpuMigrations,
+ },
+ C.VIR_PERF_PARAM_PAGE_FAULTS_MIN: typedParamsFieldInfo{
+ set: ¶ms.PageFaultsMinSet,
+ b: ¶ms.PageFaultsMin,
+ },
+ C.VIR_PERF_PARAM_PAGE_FAULTS_MAJ: typedParamsFieldInfo{
+ set: ¶ms.PageFaultsMajSet,
+ b: ¶ms.PageFaultsMaj,
+ },
+ C.VIR_PERF_PARAM_ALIGNMENT_FAULTS: typedParamsFieldInfo{
+ set: ¶ms.AlignmentFaultsSet,
+ b: ¶ms.AlignmentFaults,
+ },
+ C.VIR_PERF_PARAM_REF_EMULATION_FAULTS: typedParamsFieldInfo{
+ set: ¶ms.EmulationFaultsSet,
+ b: ¶ms.EmulationFaults,
+ },
}
}
diff --git a/domain_compat.h b/domain_compat.h
index 9540435..a114173 100644
--- a/domain_compat.h
+++ b/domain_compat.h
@@ -45,6 +45,42 @@
#define VIR_PERF_PARAM_REF_CPU_CYCLES "ref_cpu_cycles"
#endif
+#ifndef VIR_PERF_PARAM_CPU_CLOCK
+#define VIR_PERF_PARAM_CPU_CLOCK "cpu_clock"
+#endif
+
+#ifndef VIR_PERF_PARAM_TASK_CLOCK
+#define VIR_PERF_PARAM_TASK_CLOCK "task_clock"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS
+#define VIR_PERF_PARAM_PAGE_FAULTS "page_faults"
+#endif
+
+#ifndef VIR_PERF_PARAM_CONTEXT_SWITCHES
+#define VIR_PERF_PARAM_CONTEXT_SWITCHES "context_switches"
+#endif
+
+#ifndef VIR_PERF_PARAM_CPU_MIGRATIONS
+#define VIR_PERF_PARAM_CPU_MIGRATIONS "cpu_migrations"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS_MIN
+#define VIR_PERF_PARAM_PAGE_FAULTS_MIN "page_faults_min"
+#endif
+
+#ifndef VIR_PERF_PARAM_PAGE_FAULTS_MAJ
+#define VIR_PERF_PARAM_PAGE_FAULTS_MAJ "page_faults_maj"
+#endif
+
+#ifndef VIR_PERF_PARAM_ALIGNMENT_FAULTS
+#define VIR_PERF_PARAM__ALIGNMENT_FAULTS "alignment_faults"
+#endif
+
+#ifndef VIR_PERF_PARAM_EMULATION_FAULTS
+#define VIR_PERF_PARAM_EMULATION_FAULTS "emulation_faults"
+#endif
+
#ifndef VIR_DOMAIN_EVENT_ID_METADATA_CHANGE
#define VIR_DOMAIN_EVENT_ID_METADATA_CHANGE 23
#endif
--
1.9.3
7 years, 8 months
[libvirt] [PATCH perl v2] Add constants for new perf event support
by Nitesh Konkar
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
Changes | 9 +++++++++
Virt.xs | 9 +++++++++
lib/Sys/Virt/Domain.pm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 72 insertions(+)
diff --git a/Changes b/Changes
index 842f21f..7d637f5 100644
--- a/Changes
+++ b/Changes
@@ -5,6 +5,15 @@ Revision history for perl module Sys::Virt
- Add VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE constant
- Add VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM constant
- Add virDomainSetVcpu API
+ - Add PERF_PARAM_CPU_CLOCK constant
+ - Add PERF_PARAM_TASK_CLOCK constant
+ - Add PERF_PARAM_PAGE_FAULTS constant
+ - Add PERF_PARAM_CONTEXT_SWITCHES constant
+ - Add PERF_PARAM_CPU_MIGRATIONS constant
+ - Add PERF_PARAM_PAGE_FAULTS_MIN constant
+ - Add PERF_PARAM_PAGE_FAULTS_MAJ constant
+ - Add PERF_PARAM_ALIGNMENT_FAULTS constant
+ - Add PERF_PARAM_EMULATION_FAULTS constant
3.0.0 2017-01-19
diff --git a/Virt.xs b/Virt.xs
index 9728fb0..e80182f 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -8500,6 +8500,15 @@ BOOT:
REGISTER_CONSTANT_STR(VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND, PERF_PARAM_STALLED_CYCLES_FRONTEND);
REGISTER_CONSTANT_STR(VIR_PERF_PARAM_STALLED_CYCLES_BACKEND, PERF_PARAM_STALLED_CYCLES_BACKEND);
REGISTER_CONSTANT_STR(VIR_PERF_PARAM_REF_CPU_CYCLES, PERF_PARAM_REF_CPU_CYCLES);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CPU_CLOCK, PERF_PARAM_CPU_CLOCK);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_TASK_CLOCK, PERF_PARAM_TASK_CLOCK);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS, PERF_PARAM_PAGE_FAULTS);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CONTEXT_SWITCHES, PERF_PARAM_CONTEXT_SWITCHES);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_CPU_MIGRATIONS, PERF_PARAM_CPU_MIGRATIONS);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS_MIN, PERF_PARAM_PAGE_FAULTS_MIN);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_PAGE_FAULTS_MAJ, PERF_PARAM_PAGE_FAULTS_MAJ);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_ALIGNMENT_FAULTS, PERF_PARAM_ALIGNMENT_FAULTS);
+ REGISTER_CONSTANT_STR(VIR_PERF_PARAM_EMULATION_FAULTS, PERF_PARAM_EMULATION_FAULTS);
REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_AVERAGE, BANDWIDTH_IN_AVERAGE);
REGISTER_CONSTANT_STR(VIR_DOMAIN_BANDWIDTH_IN_PEAK, BANDWIDTH_IN_PEAK);
diff --git a/lib/Sys/Virt/Domain.pm b/lib/Sys/Virt/Domain.pm
index 6b36e73..eea8b26 100644
--- a/lib/Sys/Virt/Domain.pm
+++ b/lib/Sys/Virt/Domain.pm
@@ -2814,6 +2814,60 @@ frequency scaling by applications running on the platform.
It corresponds to the "perf.ref_cpu_cycles" field in the
*Stats APIs.
+=item Sys::Virt::Domain::PERF_PARAM_CPU_CLOCK
+The cpu_clock perf event counter which can be used to
+measure the count of cpu clock time by applications
+running on the platform. It corresponds to the
+"perf.cpu_clock" field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_TASK_CLOCK
+The task_clock perf event counter which can be used to
+measure the count of task clock time by applications
+running on the platform. It corresponds to the
+"perf.task_clock" field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS
+The page_faults perf event counter which can be used to
+measure the count of page faults by applications running
+on the platform. It corresponds to the "perf.page_faults"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_CONTEXT_SWITCHES
+The context_switches perf event counter which can be used to
+measure the count of context switches by applications running
+on the platform. It corresponds to the "perf.context_switches"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_CPU_MIGRATIONS
+The cpu_migrations perf event counter which can be used to
+measure the count of cpu migrations by applications running
+on the platform. It corresponds to the "perf.cpu_migrations"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS_MIN
+The page_faults_min perf event counter which can be used to
+measure the count of minor page faults by applications running
+on the platform. It corresponds to the "perf.page_faults_min"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_PAGE_FAULTS_MAJ
+The page_faults_maj perf event counter which can be used to
+measure the count of major page faults by applications running
+on the platform. It corresponds to the "perf.page_faults_maj"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_ALIGNMENT_FAULTS
+The alignment_faults perf event counter which can be used to
+measure the count of alignment faults by applications running
+on the platform. It corresponds to the "perf.alignment_faults"
+field in the *Stats APIs.
+
+=item Sys::Virt::Domain::PERF_PARAM_EMULATION_FAULTS
+The emulation_faults perf event counter which can be used to
+measure the count of emulation faults by applications running
+on the platform. It corresponds to the "perf.emulation_faults"
+field in the *Stats APIs.
+
=back
=head2 VCPU FLAGS
--
1.9.3
7 years, 8 months
[libvirt] [PATCH 0/6] Split out nwfilter object into its own module
by John Ferlan
Continuing down the pile of drivers from my RFC for making a common pool
object - we're now at nwfilter (still have storage and network to go).
For reference see patch 3 of:
http://www.redhat.com/archives/libvir-list/2017-February/msg00519.html
This series works through the nwfilter conf adjustments. We start by
fixing a couple of API's that aren't using objects, then launch into
the repetitive type actions of moving the code into it's own module,
fixing up the "style", altering the function prototypes, and finally
using virNWFilterObj prefix for any API's in virnwfilterobj.
John Ferlan (6):
conf: Change virNWFilterObjSaveDef to virNWFilterSaveDef
conf: Change virNWFilterObjDeleteDef to virNWFilterDeleteDef
conf: Introduce virnwfilterobj
conf: Adjust coding style for nwfilter conf sources
conf: Alter coding style of nwfilter function prototypes
conf: Use consistent function name prefixes for virnwfilterobj
po/POTFILES.in | 1 +
src/Makefile.am | 6 +-
src/conf/nwfilter_conf.c | 498 +++++++--------------------------
src/conf/nwfilter_conf.h | 157 +++++------
src/conf/virnwfilterobj.c | 388 +++++++++++++++++++++++++
src/conf/virnwfilterobj.h | 94 +++++++
src/libvirt_private.syms | 26 +-
src/nwfilter/nwfilter_driver.c | 13 +-
src/nwfilter/nwfilter_gentech_driver.h | 2 +-
src/nwfilter/nwfilter_tech_driver.h | 2 +-
10 files changed, 676 insertions(+), 511 deletions(-)
create mode 100644 src/conf/virnwfilterobj.c
create mode 100644 src/conf/virnwfilterobj.h
--
2.9.3
7 years, 8 months
[libvirt] [PATCH 0/3] use USB nec-usb-xhci controller as default if possible for ppc64
by Pavel Hrdina
Pavel Hrdina (3):
qemu_domain: move controller post parse code into its own function
qemu_domain: cleanup the controller post parse code
qemu_domain: use correct default USB controller on ppc64
src/qemu/qemu_domain.c | 218 +++++++++++++++++++++++++++----------------------
1 file changed, 120 insertions(+), 98 deletions(-)
--
2.12.0
7 years, 8 months