perf: Prevent enabling of already enabled perf event

Currently, on every --enable perf_event command,
a new event->fd is created and counting of perf
event counter starts from zero and previous
event->fd is lost. This patch prevents this
behaviour.

Signed-off-by: Nitesh Konkar <nitkon12@linux.vnet.ibm.com>
This commit is contained in:
Nitesh Konkar 2017-01-24 14:42:03 +05:30 committed by John Ferlan
parent 4dd19ea913
commit 26ac16f3ce

View File

@ -198,6 +198,9 @@ virPerfEventEnable(virPerfPtr perf,
if (!event || !event_attr)
return -1;
if (event->enabled)
return 0;
if (event_attr->attrType == 0 && (type == VIR_PERF_EVENT_CMT ||
type == VIR_PERF_EVENT_MBMT ||
type == VIR_PERF_EVENT_MBML)) {