Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-03-27 Thread Kim Phillips
crickets.

How do we make progress in this area?

(a) can we assume Andi's json format is acceptable?  We would like
to know this so we don't have to reformat our data more than once.

(b) Would an acceptable interim resolution the 'download area'
problem be to take Andi's perf: Add support for full Intel event
lists v8 and change the 'download' to refer to
tools/perf/event-tables/?

(c) If not, given we don't know how to get us out of the current
status quo, can this patchseries still be applied, given the
original complaint was the size of our events-list.h (whereas
power7-events-list.h is almost twice the size)?  If not, patch 3/3
in this series is still valid, no matter what, and it should still
be applied (let us know if we need to resubmit).

Thanks,

Kim


On Mon, 16 Feb 2015 10:10:45 -0600
Tom Huynh tommy.xhu...@gmail.com wrote:

 On Mon, Feb 09, 2015 at 09:40:19PM +0100, Andi Kleen wrote:
   I'll NAK any external 'download area' (and I told that Andi 
   before): tools/perf/event-tables/ or so is a good enough 
   'download area' with fast enough update cycles.
  
  The proposal was to put it on kernel.org, similar to how
  external firmware blobs are distributed. CPU event lists
  are data sheets, so are like firmware. They do not
  follow the normal kernel code licenses. They are not 
  source code. They cannot be reviewed in the normal way.
  
 Could you provide more details about the license and review 
 concern? How are the event list files different from hardware-
 specific information (e.g. reg mapping) in header files?
 
   If any 'update' of event descriptions is needed it can 
   happen through the distro package mechanism, or via a 
   simple 'git pull' if it's compiled directly.
   
   Lets not overengineer this with any dependence on an 
   external site and with a separate update mechanism - lets 
   just get the tables into tools/ and see it from there...
  
  That experiment has been already done for oprofile,
  didn't work very well.
 
 Please excuse my ignorance, could you say exactly what didn't
 work well for oprofile?
 
 Ingo's suggestion seems good to me because these event files 
 will be transparent to the users, and it's just more 
 convenient not having to go to a website to look for 
 the event file that matches the machine to download.
 The distro package or the perf make mechanism can put these
 files into the appropriate directory. The users who are not
 perf developers won't need to know about these files.
 
 - Tom
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-03-27 Thread Andi Kleen

Thanks for supporting the JSON format too.

 (c) If not, given we don't know how to get us out of the current
 status quo, can this patchseries still be applied, given the
 original complaint was the size of our events-list.h (whereas

The Intel core event lists are far larger even
(and will grow even more when uncore gets added)

 power7-events-list.h is almost twice the size)?  If not, patch 3/3
 in this series is still valid, no matter what, and it should still
 be applied (let us know if we need to resubmit).

Could also just leave out the downloader for now, so that you have
to get your own event file and set it up with export EVENTMAP=...

That's basically the patchkit, minus one patch.

-Andi
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-18 Thread Andi Kleen

Well I'm tired of discussing this. I don't think what you
proposed makes sense, putting 3.4MB[1] of changing blob into perf.

I'll resubmit the JSON parser without the downloader. Then users
have the option to get their own events and use that.

If you don't like that, standard perf just has to stay with limited 
events and r as before, with users having to use external
tools or libraries for names for more events[2][3].

-Andi

[1] Current size of https://download.01.org/perfmon/
[2] ocperf in https://github.com/andikleen/pmu-tools
[3] http://perfmon2.sourceforge.net/
-- 
a...@linux.intel.com -- Speaking for myself only.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-18 Thread Ingo Molnar

* Scott Wood scottw...@freescale.com wrote:

 On Mon, 2015-02-09 at 21:40 +0100, Andi Kleen wrote:
   I'll NAK any external 'download area' (and I told that Andi 
   before): tools/perf/event-tables/ or so is a good enough 
   'download area' with fast enough update cycles.
  
  The proposal was to put it on kernel.org, similar to how
  external firmware blobs are distributed. [...]

Fortunately perf is not an external firmware blob ...

  [...] CPU event lists are data sheets, so are like 
  firmware. [...]

What an absolute, idiotic, nonsense argument!

CPU event lists are human readable descriptions for events. 
If they aren't then they have no place in tooling.

Treating them like firmware is as backwards as it gets.

  [...]  They do not follow the normal kernel code 
  licenses. They are not source code. They cannot be 
  reviewed in the normal way.
 
 How is it different from describing registers and bits in 
 driver header files?  What does it mean to talk about a 
 license on information, rather than the expression of 
 information?

Andi is making idiotic arguments, instead of implementing 
the technically sane solution.

Thanks,

Ingo
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-16 Thread Tom Huynh
On Mon, Feb 09, 2015 at 09:40:19PM +0100, Andi Kleen wrote:
  I'll NAK any external 'download area' (and I told that Andi 
  before): tools/perf/event-tables/ or so is a good enough 
  'download area' with fast enough update cycles.
 
 The proposal was to put it on kernel.org, similar to how
 external firmware blobs are distributed. CPU event lists
 are data sheets, so are like firmware. They do not
 follow the normal kernel code licenses. They are not 
 source code. They cannot be reviewed in the normal way.
 
Could you provide more details about the license and review 
concern? How are the event list files different from hardware-
specific information (e.g. reg mapping) in header files?

  If any 'update' of event descriptions is needed it can 
  happen through the distro package mechanism, or via a 
  simple 'git pull' if it's compiled directly.
  
  Lets not overengineer this with any dependence on an 
  external site and with a separate update mechanism - lets 
  just get the tables into tools/ and see it from there...
 
 That experiment has been already done for oprofile,
 didn't work very well.

Please excuse my ignorance, could you say exactly what didn't
work well for oprofile?

Ingo's suggestion seems good to me because these event files 
will be transparent to the users, and it's just more 
convenient not having to go to a website to look for 
the event file that matches the machine to download.
The distro package or the perf make mechanism can put these
files into the appropriate directory. The users who are not
perf developers won't need to know about these files.

- Tom
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-10 Thread Scott Wood
On Mon, 2015-02-09 at 21:40 +0100, Andi Kleen wrote:
  I'll NAK any external 'download area' (and I told that Andi 
  before): tools/perf/event-tables/ or so is a good enough 
  'download area' with fast enough update cycles.
 
 The proposal was to put it on kernel.org, similar to how
 external firmware blobs are distributed. CPU event lists
 are data sheets, so are like firmware. They do not
 follow the normal kernel code licenses. They are not 
 source code. They cannot be reviewed in the normal way.

How is it different from describing registers and bits in driver header
files?  What does it mean to talk about a license on information, rather
than the expression of information?

-Scott

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-09 Thread Peter Zijlstra
On Fri, Feb 06, 2015 at 04:43:54PM -0600, Tom Huynh wrote:
  arch/powerpc/perf/e6500-events-list.h | 289 
 ++

That's a lot of events to stuff in the kernel, would a userspace list
not be more convenient?

ISTR there being various discussions on providing support for that in
tools/perf, Jiri?

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-09 Thread Andi Kleen
 I'll NAK any external 'download area' (and I told that Andi 
 before): tools/perf/event-tables/ or so is a good enough 
 'download area' with fast enough update cycles.

The proposal was to put it on kernel.org, similar to how
external firmware blobs are distributed. CPU event lists
are data sheets, so are like firmware. They do not
follow the normal kernel code licenses. They are not 
source code. They cannot be reviewed in the normal way.

 If any 'update' of event descriptions is needed it can 
 happen through the distro package mechanism, or via a 
 simple 'git pull' if it's compiled directly.
 
 Lets not overengineer this with any dependence on an 
 external site and with a separate update mechanism - lets 
 just get the tables into tools/ and see it from there...

That experiment has been already done for oprofile,
didn't work very well.

-Andi

-- 
a...@linux.intel.com -- Speaking for myself only.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-09 Thread Ingo Molnar

* Peter Zijlstra pet...@infradead.org wrote:

 On Fri, Feb 06, 2015 at 04:43:54PM -0600, Tom Huynh wrote:
   arch/powerpc/perf/e6500-events-list.h | 289 
  ++
 
 That's a lot of events to stuff in the kernel, would a 
 userspace list not be more convenient?
 
 ISTR there being various discussions on providing support 
 for that in tools/perf, Jiri?

As long as it's in a single well organized place in tools/, 
I'd be fine with that solution as well.

What doesn't work very well is disjunct, disorganized, 
inconsistent event descriptions all across the tooling and 
platform landscape - putting static tables into sysfs is a 
marked improvement over that, despite its memory usage.

Thanks,

Ingo
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-09 Thread Ingo Molnar

* Jiri Olsa jo...@redhat.com wrote:

 On Mon, Feb 09, 2015 at 11:07:38AM +0100, Ingo Molnar wrote:
  
  * Peter Zijlstra pet...@infradead.org wrote:
  
   On Fri, Feb 06, 2015 at 04:43:54PM -0600, Tom Huynh wrote:
 arch/powerpc/perf/e6500-events-list.h | 289 
++
   
   That's a lot of events to stuff in the kernel, would a 
   userspace list not be more convenient?
   
   ISTR there being various discussions on providing support 
   for that in tools/perf, Jiri?
  
  As long as it's in a single well organized place in tools/, 
  I'd be fine with that solution as well.
  
  What doesn't work very well is disjunct, disorganized, 
  inconsistent event descriptions all across the tooling and 
  platform landscape - putting static tables into sysfs is a 
  marked improvement over that, despite its memory usage.
 
 the last version is in here:
 http://marc.info/?l=linux-kernelm=140676269017820w=2
 
 AFAIK Andi is setting up the download area as discussed 
 in the thread and should repost at some point

I'll NAK any external 'download area' (and I told that Andi 
before): tools/perf/event-tables/ or so is a good enough 
'download area' with fast enough update cycles.

If any 'update' of event descriptions is needed it can 
happen through the distro package mechanism, or via a 
simple 'git pull' if it's compiled directly.

Lets not overengineer this with any dependence on an 
external site and with a separate update mechanism - lets 
just get the tables into tools/ and see it from there...

Thanks,

Ingo
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-09 Thread Jiri Olsa
On Mon, Feb 09, 2015 at 11:07:38AM +0100, Ingo Molnar wrote:
 
 * Peter Zijlstra pet...@infradead.org wrote:
 
  On Fri, Feb 06, 2015 at 04:43:54PM -0600, Tom Huynh wrote:
arch/powerpc/perf/e6500-events-list.h | 289 
   ++
  
  That's a lot of events to stuff in the kernel, would a 
  userspace list not be more convenient?
  
  ISTR there being various discussions on providing support 
  for that in tools/perf, Jiri?
 
 As long as it's in a single well organized place in tools/, 
 I'd be fine with that solution as well.
 
 What doesn't work very well is disjunct, disorganized, 
 inconsistent event descriptions all across the tooling and 
 platform landscape - putting static tables into sysfs is a 
 marked improvement over that, despite its memory usage.

the last version is in here:
http://marc.info/?l=linux-kernelm=140676269017820w=2

AFAIK Andi is setting up the download area as discussed
in the thread and should repost at some point

jirka
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 1/3] perf/e6500: Make event translations available in sysfs

2015-02-06 Thread Tom Huynh
Make the perf events in e6500 available via sysfs.

$ ls /sys/devices/cpu/events/
branch-instructions
branch-misses
cache-misses
cpu-cycles
instructions
FSL_0_INST_CMPL
FSL_1_INST_CMPL
...

$ cat /sys/devices/cpu/events/cpu-cycles
event=0x01

Similar to the following commits:
- 1c53a270724d (perf/POWER7: Make generic event translations
  available in sysfs).
- 886c3b2d677f (perf/POWER7: Make some POWER7 events available
  in sysfs)
- cfe0d8ba14a1 (perf tools: Make Power7 events available for perf)

Signed-off-by: Tom Huynh tom.hu...@freescale.com
---
 arch/powerpc/include/asm/perf_event_fsl_emb.h |  20 +-
 arch/powerpc/perf/core-fsl-emb.c  |  12 ++
 arch/powerpc/perf/e6500-events-list.h | 289 ++
 arch/powerpc/perf/e6500-pmu.c |  50 -
 4 files changed, 365 insertions(+), 6 deletions(-)
 create mode 100644 arch/powerpc/perf/e6500-events-list.h

diff --git a/arch/powerpc/include/asm/perf_event_fsl_emb.h 
b/arch/powerpc/include/asm/perf_event_fsl_emb.h
index a581654..d76124f 100644
--- a/arch/powerpc/include/asm/perf_event_fsl_emb.h
+++ b/arch/powerpc/include/asm/perf_event_fsl_emb.h
@@ -11,6 +11,7 @@
  */
 
 #include linux/types.h
+#include linux/device.h
 #include asm/hw_irq.h
 
 #define MAX_HWEVENTS 6
@@ -39,7 +40,7 @@ struct fsl_emb_pmu {
 
/* Returns event flags and PMLCb (FSL_EMB_EVENT_*) */
u64 (*xlate_event)(u64 event_id);
-
+   const struct attribute_group**attr_groups;
int n_generic;
int *generic_events;
int (*cache_events)[PERF_COUNT_HW_CACHE_MAX]
@@ -48,3 +49,20 @@ struct fsl_emb_pmu {
 };
 
 int register_fsl_emb_pmu(struct fsl_emb_pmu *);
+
+extern ssize_t fsl_emb_events_sysfs_show(struct device *dev,
+struct device_attribute *attr,
+char *page);
+
+#define EVENT_VAR(_id, _suffix) event_attr_##_id##_suffix
+#define EVENT_PTR(_id, _suffix) (event_attr_##_id##_suffix.attr.attr)
+
+#define EVENT_ATTR(_name, _id, _suffix)   \
+   PMU_EVENT_ATTR(_name, EVENT_VAR(_id, _suffix), PME_##_id, \
+   fsl_emb_events_sysfs_show)
+
+#define GENERIC_EVENT_ATTR(_name, _id)  EVENT_ATTR(_name, _id, _g)
+#define GENERIC_EVENT_PTR(_id)  EVENT_PTR(_id, _g)
+
+#define FSL_EMB_EVENT_ATTR(_name, _id) EVENT_ATTR(_name, _id, _p)
+#define FSL_EMB_EVENT_PTR(_id) EVENT_PTR(_id, _p)
diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c
index 4acaea0..d4af2f3 100644
--- a/arch/powerpc/perf/core-fsl-emb.c
+++ b/arch/powerpc/perf/core-fsl-emb.c
@@ -581,6 +581,16 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
return err;
 }
 
+ssize_t fsl_emb_events_sysfs_show(struct device *dev,
+ struct device_attribute *attr, char *page)
+{
+   struct perf_pmu_events_attr *pmu_attr;
+
+   pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
+
+   return sprintf(page, event=0x%02llx\n, pmu_attr-id);
+}
+
 static struct pmu fsl_emb_pmu = {
.pmu_enable = fsl_emb_pmu_enable,
.pmu_disable= fsl_emb_pmu_disable,
@@ -711,6 +721,8 @@ int register_fsl_emb_pmu(struct fsl_emb_pmu *pmu)
pr_info(%s performance monitor hardware support registered\n,
pmu-name);
 
+   fsl_emb_pmu.attr_groups = ppmu-attr_groups;
+
perf_pmu_register(fsl_emb_pmu, cpu, PERF_TYPE_RAW);
 
return 0;
diff --git a/arch/powerpc/perf/e6500-events-list.h 
b/arch/powerpc/perf/e6500-events-list.h
new file mode 100644
index 000..27be38a
--- /dev/null
+++ b/arch/powerpc/perf/e6500-events-list.h
@@ -0,0 +1,289 @@
+/*
+ * Performance counter support for e6500 family processors.
+ *
+ * Copyright 2015 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+EVENT(FSL_CYC, 1)
+EVENT(FSL_INST_CMPL,   2)
+EVENT(FSL_UOPS_CMPL,   3)
+EVENT(FSL_UOPS_DECODED,5)
+EVENT(FSL_PM_EV_TRANS, 6)
+EVENT(FSL_PM_EV_CYC,   7)
+EVENT(FSL_BR_CMPL, 8)
+EVENT(FSL_BR_TKN,  67)
+EVENT(FSL_BLR_TKN, 68)
+EVENT(FSL_NUM_CQ_REDIR,11)
+EVENT(FSL_LD_UOPS_CMPL,9)
+EVENT(FSL_ST_UOPS_CMPL,10)
+EVENT(FSL_LSU_UOPS_CMPL,   181)
+EVENT(FSL_GPR_LD_CMPL,