Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1399590 > unrolled thread

[PATCH v2 23/32] perf/x86/intel/cqm: use PERF_INACTIVE_*_READ_* flags in CQM

Started byDavid Carrillo-Cisneros <davidcc@google.com>
First post2016-05-12 01:10 +0200
Last post2016-05-12 01:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 23/32] perf/x86/intel/cqm: use PERF_INACTIVE_*_READ_* flags in CQM David Carrillo-Cisneros <davidcc@google.com> - 2016-05-12 01:10 +0200

#1399590 — [PATCH v2 23/32] perf/x86/intel/cqm: use PERF_INACTIVE_*_READ_* flags in CQM

FromDavid Carrillo-Cisneros <davidcc@google.com>
Date2016-05-12 01:10 +0200
Subject[PATCH v2 23/32] perf/x86/intel/cqm: use PERF_INACTIVE_*_READ_* flags in CQM
Message-ID<rxLqs-1mv-65@gated-at.bofh.it>
Use newly added pmu_event flags to:
  - Allow thread events to be read from any CPU even if not in
  ACTIVE state. Since inter-package values are polled, a thread's
  occupancy is always:

    local occupancy (read from hw) + remote occupancy (polled values)

  - Allow cpu/cgroup events to be read from any CPU in the package where
  they run. This potentially saves IPIs when the read function runs in the
  same package but in a distinct CPU than the event.

Since reading will always return a new value and inherit_stats is not
supported (due to all children events sharing the same RMID), there is no
need to read during sched_out of an event.

Reviewed-by: Stephane Eranian <eranian@google.com>
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
 arch/x86/events/intel/cqm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c
index 12f563d..9038112 100644
--- a/arch/x86/events/intel/cqm.c
+++ b/arch/x86/events/intel/cqm.c
@@ -2689,6 +2689,16 @@ static int intel_cqm_event_init(struct perf_event *event)
 	 */
 	event->pmu_event_flags |= PERF_CGROUP_NO_RECURSION;
 
+	/* Events in CQM PMU are per-package and can be read even when
+	 * the cpu is not running the event.
+	 */
+	if (event->cpu < 0) {
+		WARN_ON_ONCE(!(event->attach_state & PERF_ATTACH_TASK));
+		event->pmu_event_flags |= PERF_INACTIVE_EV_READ_ANY_CPU;
+	} else	{
+		event->pmu_event_flags |= PERF_INACTIVE_CPU_READ_PKG;
+	}
+
 	mutex_lock(&cqm_mutex);
 
 
-- 
2.8.0.rc3.226.g39d4020

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web