All of lore.kernel.org
 help / color / mirror / Atom feed
* [perf] enable raw OFFCORE_EVENTS for non-perf userspace
@ 2011-08-03 16:05 Vince Weaver
  2011-08-03 17:00 ` Vince Weaver
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Vince Weaver @ 2011-08-03 16:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, Arnaldo Carvalho de Melo

Hello

I propose we just enable raw OFFCORE_EVENT support and get it over with.

There is a lot of demand for this from PAPI users, and so we encourage 
them to apply the below patch.  PAPI supports this out of the box.

The current "block" against using this feature *DOES NOT WORK*.
It silently fails if you try to use the config1 field to set it.

Even worse, if some previous user has set the OFFCORE_RSP_0 msr
(say by running "perf stat -e LLC-load-misses") then
the msr *stays set* and if you try to set the config1 field on your own
it looks like it worked, but instead it is using whatever value the
kernel last used.

So there's a lot of userspace confusion about this, and you can't even 
reliably tell if the feature is turned off or not because it fails 
silently in unpredictable ways.

Thanks

Vince
vweaver1@eecs.utk.edu

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 4ee3abf..28f9ca9 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -604,12 +604,8 @@ static int x86_setup_perfctr(struct perf_event *event)
 			return -EOPNOTSUPP;
 	}
 
-	/*
-	 * Do not allow config1 (extended registers) to propagate,
-	 * there's no sane user-space generalization yet:
-	 */
 	if (attr->type == PERF_TYPE_RAW)
-		return 0;
+		return x86_pmu_extra_regs(event->attr.config, event);
 
 	if (attr->type == PERF_TYPE_HW_CACHE)
 		return set_ext_hw_attr(hwc, event);


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-11-21 22:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 16:05 [perf] enable raw OFFCORE_EVENTS for non-perf userspace Vince Weaver
2011-08-03 17:00 ` Vince Weaver
2011-08-04 15:55 ` Peter Zijlstra
2011-08-05  2:24   ` Vince Weaver
2011-08-05  9:49   ` Ingo Molnar
2011-11-07 18:30   ` Vince Weaver
2011-11-18 23:34 ` [tip:perf/urgent] perf/x86: Enable raw event access to Intel offcore events tip-bot for Peter Zijlstra
2011-11-21 18:24   ` Vince Weaver
2011-11-21 18:52     ` Peter Zijlstra
2011-11-21 19:01       ` Vince Weaver
2011-11-21 19:04         ` Stephane Eranian
2011-11-21 21:04           ` Vince Weaver
2011-11-21 21:39             ` Stephane Eranian
2011-11-21 21:42               ` Peter Zijlstra
2011-11-21 21:45                 ` Stephane Eranian
2011-11-21 21:48                   ` Peter Zijlstra
2011-11-21 22:05             ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.