mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
perf: reenable perf events when libvirtd restart
When libvirtd daemon restart, this patch will reenable those perf events previously enabled. Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com> Message-id: 1459171833-26416-7-git-send-email-qiaowei.ren@intel.com
This commit is contained in:
parent
afe833e9bd
commit
bf9bc04683
@ -3419,6 +3419,34 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDomainPerfRestart(virDomainObjPtr vm)
|
||||
{
|
||||
size_t i;
|
||||
virDomainDefPtr def = vm->def;
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
|
||||
virPerfFree(priv->perf);
|
||||
|
||||
priv->perf = virPerfNew();
|
||||
if (!priv->perf)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < VIR_PERF_EVENT_LAST; i++) {
|
||||
if (def->perf->events[i] &&
|
||||
def->perf->events[i] == VIR_TRISTATE_BOOL_YES) {
|
||||
if (virPerfEventEnable(priv->perf, i, vm->pid))
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
cleanup:
|
||||
virPerfFree(priv->perf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct qemuProcessReconnectData {
|
||||
virConnectPtr conn;
|
||||
virQEMUDriverPtr driver;
|
||||
@ -3495,6 +3523,9 @@ qemuProcessReconnect(void *opaque)
|
||||
if (qemuConnectCgroup(driver, obj) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuDomainPerfRestart(obj) < 0)
|
||||
goto error;
|
||||
|
||||
/* XXX: Need to change as long as lock is introduced for
|
||||
* qemu_driver->sharedDevices.
|
||||
*/
|
||||
@ -6090,6 +6121,9 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
if (virSecurityManagerGenLabel(driver->securityManager, vm->def) < 0)
|
||||
goto error;
|
||||
|
||||
if (qemuDomainPerfRestart(vm) < 0)
|
||||
goto error;
|
||||
|
||||
VIR_DEBUG("Creating domain log file");
|
||||
if (!(logCtxt = qemuDomainLogContextNew(driver, vm,
|
||||
QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user