On 11/05/2015 12:03 PM, Stephane Eranian wrote:

> Ok, then send mea patch that fixes this for both the perf and x86_arch
> PMUs in their init function and I will apply
> it today.
> Thanks for tracking this down.
> 

Hi Staphane,

I reviewed the code in pfmlib_intel_arch.c for creating the table. The intel 
architected events code doesn't appear to suffer from the problem that the perf 
event table does as a result of cloning, so it doesn't need to be patched.  
Attached is the patch for libpfm4 git.

-Will
>From 526337c17ff7cdf8595f685ce6180c65f5960e73 Mon Sep 17 00:00:00 2001
From: William Cohen <wco...@redhat.com>
Date: Thu, 5 Nov 2015 16:37:54 -0500
Subject: [PATCH] Reset the number of elements in the perf_pe array

Reading in the tracepoints causes the perf_static_events array to be
cloned and adds elements to the the end of the cloned array.  The
number of elements in the array is tracked by the pme_count field in
perf_event_support.  In addition to reverting to the
perf_static_events array the pme_count field needs to be restored to
the original count of elements in the perf_static_events array.

Signed-off-by: William Cohen <wco...@redhat.com>
---
 lib/pfmlib_perf_event_pmu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/pfmlib_perf_event_pmu.c b/lib/pfmlib_perf_event_pmu.c
index c854535..874cc72 100644
--- a/lib/pfmlib_perf_event_pmu.c
+++ b/lib/pfmlib_perf_event_pmu.c
@@ -485,6 +485,7 @@ pfm_perf_init(void *this)
 {
 	pfmlib_pmu_t *pmu = this;
 	perf_pe = perf_static_events;
+	perf_event_support.pme_count = PME_PERF_EVENT_COUNT;
 
 	/* must dynamically add tracepoints */
 	gen_tracepoint_table();
-- 
2.4.3

------------------------------------------------------------------------------
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to