[libvirt] [PATCH] virtperf: Revert PERF_COUNT_HW_REF_CPU_CYCLES conditional

Martin Kletzander mkletzan at redhat.com
Tue Mar 14 13:05:37 UTC 2017


On Tue, Mar 14, 2017 at 08:55:30AM +0000, Olaf Hering wrote:
>All PERF_* names are enmus. Enums are ordinary code for CPP.
>An ifdef does not trigger.
>Fixes 1d29c889a ("Make use of PERF_COUNT_HW_REF_CPU_CYCLES conditional")
>

Well, it *reverts* that commit.  If that is desired, it should rather be
reverted with git-revert(1).  However without that commit we'll be back
to broken code that won't compile on some distros.  So unless I missed
something (if I did, it should be added to the commit message), there
should rather be a configure check that defines something similar to
other code, e.g. HAVE_PERF_CPU_CYCLES and then that should be used in
the conditional.

Anyway it looks like the code is wrong anyway, does it currently error
out for you with "unable to open host cpu perf event ..." even though it
should work?

@Daniel: It seems like you probably wanted to relax the following
condition in virPerfEventEnable():

  if (event_attr->attrType == 0 && (type == VIR_PERF_EVENT_CMT ||
                                    type == VIR_PERF_EVENT_MBMT ||
                                    type == VIR_PERF_EVENT_MBML)) {

am I right?

>Signed-off-by: Olaf Hering <olaf at aepfle.de>
>---
> src/util/virperf.c | 5 -----
> 1 file changed, 5 deletions(-)
>
>diff --git a/src/util/virperf.c b/src/util/virperf.c
>index e39cebbe0..33039544a 100644
>--- a/src/util/virperf.c
>+++ b/src/util/virperf.c
>@@ -108,13 +108,8 @@ static struct virPerfEventAttr attrs[] = {
>      .attrType = PERF_TYPE_HARDWARE,
>      .attrConfig = PERF_COUNT_HW_STALLED_CYCLES_BACKEND},
>     {.type = VIR_PERF_EVENT_REF_CPU_CYCLES,
>-# ifdef PERF_COUNT_HW_REF_CPU_CYCLES
>      .attrType = PERF_TYPE_HARDWARE,
>      .attrConfig = PERF_COUNT_HW_REF_CPU_CYCLES
>-# else
>-     .attrType = 0,
>-     .attrConfig = 0,
>-# endif
>     },
>     {.type = VIR_PERF_EVENT_CPU_CLOCK,
>      .attrType = PERF_TYPE_SOFTWARE,
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170314/5b3e3488/attachment-0001.sig>


More information about the libvir-list mailing list