All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description
@ 2018-04-16 13:23 Thomas Richter
  2018-04-16 14:31 ` Arnaldo Carvalho de Melo
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Richter @ 2018-04-16 13:23 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: brueckner, schwidefsky, heiko.carstens, Thomas Richter

From: Thomas Richter <tmricht@linux.vnet.ibm.com>

Perf list with flags -d and -v print a description (-d) or
a very verbose explanation (-v) of CPU specific counter events.
These descriptions are provided with the json files in
directory pmu-events/arch/s390/*.json.

Display of these descriptions on s390 requires the
corresponding json files.

On s390 this does not work because function is_pmu_core()
does not detect the s390 directory name where the
CPU specific events are listed. On x86 it is
  /sys/bus/event_source/devices/cpu
whereas on s390 it is
  /sys/bus/event_source/devices/cpum_cf
  /sys/bus/event_source/devices/cpum_sf

Fix this by adding s390 directory name testing to
function is_pmu_core(). This is the same approach as taken for
arm platform.

Output before:
[root@s35lp76 perf]# ./perf list -d pmu
List of pre-defined events (to be used in -e):

  cpum_cf/AES_BLOCKED_CYCLES/      [Kernel PMU event]
  cpum_cf/AES_BLOCKED_FUNCTIONS/   [Kernel PMU event]
  cpum_cf/AES_CYCLES/              [Kernel PMU event]
  cpum_cf/AES_FUNCTIONS/           [Kernel PMU event]
  ....
  cpum_cf/TX_NC_TEND/              [Kernel PMU event]
  cpum_cf/VX_BCD_EXECUTION_SLOTS/  [Kernel PMU event]
  cpum_sf/SF_CYCLES_BASIC/         [Kernel PMU event]

Output after:
[root@s35lp76 perf]# ./perf list -d pmu
List of pre-defined events (to be used in -e):

  cpum_cf/AES_BLOCKED_CYCLES/      [Kernel PMU event]
  cpum_cf/AES_BLOCKED_FUNCTIONS/   [Kernel PMU event]
  cpum_cf/AES_CYCLES/              [Kernel PMU event]
  cpum_cf/AES_FUNCTIONS/           [Kernel PMU event]
  ....
  cpum_cf/TX_NC_TEND/              [Kernel PMU event]
  cpum_cf/VX_BCD_EXECUTION_SLOTS/  [Kernel PMU event]
  cpum_sf/SF_CYCLES_BASIC/         [Kernel PMU event]

3906:
  bcd_dfp_execution_slots
       [BCD DFP Execution Slots]
  decimal_instructions
       [Decimal Instructions]
  dtlb2_gpage_writes
       [DTLB2 GPAGE Writes]
  dtlb2_hpage_writes
       [DTLB2 HPAGE Writes]
  dtlb2_misses
       [DTLB2 Misses]
  dtlb2_writes
       [DTLB2 Writes]
  itlb2_misses
       [ITLB2 Misses]
  itlb2_writes
       [ITLB2 Writes]
  l1c_tlb2_misses
       [L1C TLB2 Misses]
  .....

cfvn 3:
  cpu_cycles
       [CPU Cycles]
  instructions
       [Instructions]
  l1d_dir_writes
       [L1D Directory Writes]
  l1d_penalty_cycles
       [L1D Penalty Cycles]
  l1i_dir_writes
       [L1I Directory Writes]
  l1i_penalty_cycles
       [L1I Penalty Cycles]
  problem_state_cpu_cycles
       [Problem State CPU Cycles]
  problem_state_instructions
       [Problem State Instructions]
  ....

csvn generic:
  aes_blocked_cycles
       [AES Blocked Cycles]
  aes_blocked_functions
       [AES Blocked Functions]
  aes_cycles
       [AES Cycles]
  aes_functions
       [AES Functions]
  dea_blocked_cycles
       [DEA Blocked Cycles]
  dea_blocked_functions
       [DEA Blocked Functions]
  ....

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
 tools/perf/util/pmu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 1111d5bf15ca..8675ddf558c6 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -562,6 +562,12 @@ static int is_pmu_core(const char *name)
 	if (stat(path, &st) == 0)
 		return 1;
 
+	/* Look for cpu sysfs (specific to s390) */
+	scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s",
+		  sysfs, name);
+	if (stat(path, &st) == 0 && !strncmp(name, "cpum_", 5))
+		return 1;
+
 	return 0;
 }
 
-- 
2.14.3

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

* Re: [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description
  2018-04-16 13:23 [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description Thomas Richter
@ 2018-04-16 14:31 ` Arnaldo Carvalho de Melo
  2018-04-16 14:43 ` Mark Rutland
  2018-04-21  7:48 ` [tip:perf/urgent] perf list: Add s390 support for detailed/verbose PMU " tip-bot for Thomas Richter
  2 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-04-16 14:31 UTC (permalink / raw)
  To: Thomas Richter, Mark Rutland
  Cc: linux-kernel, linux-perf-users, brueckner, schwidefsky,
	heiko.carstens, Thomas Richter

Em Mon, Apr 16, 2018 at 03:23:14PM +0200, Thomas Richter escreveu:
> From: Thomas Richter <tmricht@linux.vnet.ibm.com>
> 
> Perf list with flags -d and -v print a description (-d) or
> a very verbose explanation (-v) of CPU specific counter events.
> These descriptions are provided with the json files in
> directory pmu-events/arch/s390/*.json.

Wasn't this a patch being reviewed by Mark?

- Arnaldo
 
> Display of these descriptions on s390 requires the
> corresponding json files.
> 
> On s390 this does not work because function is_pmu_core()
> does not detect the s390 directory name where the
> CPU specific events are listed. On x86 it is
>   /sys/bus/event_source/devices/cpu
> whereas on s390 it is
>   /sys/bus/event_source/devices/cpum_cf
>   /sys/bus/event_source/devices/cpum_sf
> 
> Fix this by adding s390 directory name testing to
> function is_pmu_core(). This is the same approach as taken for
> arm platform.
> 
> Output before:
> [root@s35lp76 perf]# ./perf list -d pmu
> List of pre-defined events (to be used in -e):
> 
>   cpum_cf/AES_BLOCKED_CYCLES/      [Kernel PMU event]
>   cpum_cf/AES_BLOCKED_FUNCTIONS/   [Kernel PMU event]
>   cpum_cf/AES_CYCLES/              [Kernel PMU event]
>   cpum_cf/AES_FUNCTIONS/           [Kernel PMU event]
>   ....
>   cpum_cf/TX_NC_TEND/              [Kernel PMU event]
>   cpum_cf/VX_BCD_EXECUTION_SLOTS/  [Kernel PMU event]
>   cpum_sf/SF_CYCLES_BASIC/         [Kernel PMU event]
> 
> Output after:
> [root@s35lp76 perf]# ./perf list -d pmu
> List of pre-defined events (to be used in -e):
> 
>   cpum_cf/AES_BLOCKED_CYCLES/      [Kernel PMU event]
>   cpum_cf/AES_BLOCKED_FUNCTIONS/   [Kernel PMU event]
>   cpum_cf/AES_CYCLES/              [Kernel PMU event]
>   cpum_cf/AES_FUNCTIONS/           [Kernel PMU event]
>   ....
>   cpum_cf/TX_NC_TEND/              [Kernel PMU event]
>   cpum_cf/VX_BCD_EXECUTION_SLOTS/  [Kernel PMU event]
>   cpum_sf/SF_CYCLES_BASIC/         [Kernel PMU event]
> 
> 3906:
>   bcd_dfp_execution_slots
>        [BCD DFP Execution Slots]
>   decimal_instructions
>        [Decimal Instructions]
>   dtlb2_gpage_writes
>        [DTLB2 GPAGE Writes]
>   dtlb2_hpage_writes
>        [DTLB2 HPAGE Writes]
>   dtlb2_misses
>        [DTLB2 Misses]
>   dtlb2_writes
>        [DTLB2 Writes]
>   itlb2_misses
>        [ITLB2 Misses]
>   itlb2_writes
>        [ITLB2 Writes]
>   l1c_tlb2_misses
>        [L1C TLB2 Misses]
>   .....
> 
> cfvn 3:
>   cpu_cycles
>        [CPU Cycles]
>   instructions
>        [Instructions]
>   l1d_dir_writes
>        [L1D Directory Writes]
>   l1d_penalty_cycles
>        [L1D Penalty Cycles]
>   l1i_dir_writes
>        [L1I Directory Writes]
>   l1i_penalty_cycles
>        [L1I Penalty Cycles]
>   problem_state_cpu_cycles
>        [Problem State CPU Cycles]
>   problem_state_instructions
>        [Problem State Instructions]
>   ....
> 
> csvn generic:
>   aes_blocked_cycles
>        [AES Blocked Cycles]
>   aes_blocked_functions
>        [AES Blocked Functions]
>   aes_cycles
>        [AES Cycles]
>   aes_functions
>        [AES Functions]
>   dea_blocked_cycles
>        [DEA Blocked Cycles]
>   dea_blocked_functions
>        [DEA Blocked Functions]
>   ....
> 
> Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
> Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
> ---
>  tools/perf/util/pmu.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 1111d5bf15ca..8675ddf558c6 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -562,6 +562,12 @@ static int is_pmu_core(const char *name)
>  	if (stat(path, &st) == 0)
>  		return 1;
>  
> +	/* Look for cpu sysfs (specific to s390) */
> +	scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s",
> +		  sysfs, name);
> +	if (stat(path, &st) == 0 && !strncmp(name, "cpum_", 5))
> +		return 1;
> +
>  	return 0;
>  }
>  
> -- 
> 2.14.3

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

* Re: [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description
  2018-04-16 13:23 [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description Thomas Richter
  2018-04-16 14:31 ` Arnaldo Carvalho de Melo
@ 2018-04-16 14:43 ` Mark Rutland
  2018-04-18 14:09   ` Thomas-Mich Richter
  2018-04-21  7:48 ` [tip:perf/urgent] perf list: Add s390 support for detailed/verbose PMU " tip-bot for Thomas Richter
  2 siblings, 1 reply; 5+ messages in thread
From: Mark Rutland @ 2018-04-16 14:43 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-perf-users, acme, brueckner, schwidefsky,
	heiko.carstens, Thomas Richter

On Mon, Apr 16, 2018 at 03:23:14PM +0200, Thomas Richter wrote:
> From: Thomas Richter <tmricht@linux.vnet.ibm.com>
> 
> Perf list with flags -d and -v print a description (-d) or
> a very verbose explanation (-v) of CPU specific counter events.
> These descriptions are provided with the json files in
> directory pmu-events/arch/s390/*.json.
> 
> Display of these descriptions on s390 requires the
> corresponding json files.
> 
> On s390 this does not work because function is_pmu_core()
> does not detect the s390 directory name where the
> CPU specific events are listed. On x86 it is
>   /sys/bus/event_source/devices/cpu
> whereas on s390 it is
>   /sys/bus/event_source/devices/cpum_cf
>   /sys/bus/event_source/devices/cpum_sf
> 
> Fix this by adding s390 directory name testing to
> function is_pmu_core(). This is the same approach as taken for
> arm platform.

> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 1111d5bf15ca..8675ddf558c6 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -562,6 +562,12 @@ static int is_pmu_core(const char *name)
>  	if (stat(path, &st) == 0)
>  		return 1;
>  
> +	/* Look for cpu sysfs (specific to s390) */
> +	scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s",
> +		  sysfs, name);
> +	if (stat(path, &st) == 0 && !strncmp(name, "cpum_", 5))
> +		return 1;
> +

This shouldn't adversely affect ARM, so FWIW:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

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

* Re: [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description
  2018-04-16 14:43 ` Mark Rutland
@ 2018-04-18 14:09   ` Thomas-Mich Richter
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas-Mich Richter @ 2018-04-18 14:09 UTC (permalink / raw)
  To: Mark Rutland, acme
  Cc: linux-kernel, linux-perf-users, brueckner, schwidefsky,
	heiko.carstens, Thomas Richter

On 04/16/2018 04:43 PM, Mark Rutland wrote:
> On Mon, Apr 16, 2018 at 03:23:14PM +0200, Thomas Richter wrote:
>> From: Thomas Richter <tmricht@linux.vnet.ibm.com>
>>
>> Perf list with flags -d and -v print a description (-d) or
>> a very verbose explanation (-v) of CPU specific counter events.
>> These descriptions are provided with the json files in
>> directory pmu-events/arch/s390/*.json.
>>
>> Display of these descriptions on s390 requires the
>> corresponding json files.
>>
>> On s390 this does not work because function is_pmu_core()
>> does not detect the s390 directory name where the
>> CPU specific events are listed. On x86 it is
>>   /sys/bus/event_source/devices/cpu
>> whereas on s390 it is
>>   /sys/bus/event_source/devices/cpum_cf
>>   /sys/bus/event_source/devices/cpum_sf
>>
>> Fix this by adding s390 directory name testing to
>> function is_pmu_core(). This is the same approach as taken for
>> arm platform.
> 
>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>> index 1111d5bf15ca..8675ddf558c6 100644
>> --- a/tools/perf/util/pmu.c
>> +++ b/tools/perf/util/pmu.c
>> @@ -562,6 +562,12 @@ static int is_pmu_core(const char *name)
>>  	if (stat(path, &st) == 0)
>>  		return 1;
>>  
>> +	/* Look for cpu sysfs (specific to s390) */
>> +	scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s",
>> +		  sysfs, name);
>> +	if (stat(path, &st) == 0 && !strncmp(name, "cpum_", 5))
>> +		return 1;
>> +
> 
> This shouldn't adversely affect ARM, so FWIW:
> 
> Acked-by: Mark Rutland <mark.rutland@arm.com>
> 

Arnaldo,

with Mark Acked-by can you please apply the patch.

Thanks a lot.
-- 
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

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

* [tip:perf/urgent] perf list: Add s390 support for detailed/verbose PMU event description
  2018-04-16 13:23 [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description Thomas Richter
  2018-04-16 14:31 ` Arnaldo Carvalho de Melo
  2018-04-16 14:43 ` Mark Rutland
@ 2018-04-21  7:48 ` tip-bot for Thomas Richter
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Thomas Richter @ 2018-04-21  7:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mark.rutland, heiko.carstens, hpa, brueckner,
	tmricht, mingo, tglx, acme, schwidefsky

Commit-ID:  038586c34301578e538f6c5aa79ca82bce1b9152
Gitweb:     https://git.kernel.org/tip/038586c34301578e538f6c5aa79ca82bce1b9152
Author:     Thomas Richter <tmricht@linux.vnet.ibm.com>
AuthorDate: Mon, 16 Apr 2018 15:23:14 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 17 Apr 2018 09:47:39 -0300

perf list: Add s390 support for detailed/verbose PMU event description

'perf list' with flags -d and -v print a description (-d) or a very
verbose explanation (-v) of CPU specific counter events.  These
descriptions are provided with the json files in directory
pmu-events/arch/s390/*.json.

Display of these descriptions on s390 requires the corresponding json
files.

On s390 this does not work because function is_pmu_core() does not
detect the s390 directory name where the CPU specific events are listed.
On x86 it is:

  /sys/bus/event_source/devices/cpu

whereas on s390 it is:

  /sys/bus/event_source/devices/cpum_cf
  /sys/bus/event_source/devices/cpum_sf

Fix this by adding s390 directory name testing to function
is_pmu_core(). This is the same approach as taken for the ARM platform.

Output before:

[root@s35lp76 perf]# ./perf list -d pmu
List of pre-defined events (to be used in -e):

  cpum_cf/AES_BLOCKED_CYCLES/      [Kernel PMU event]
  cpum_cf/AES_BLOCKED_FUNCTIONS/   [Kernel PMU event]
  cpum_cf/AES_CYCLES/              [Kernel PMU event]
  cpum_cf/AES_FUNCTIONS/           [Kernel PMU event]
  ....
  cpum_cf/TX_NC_TEND/              [Kernel PMU event]
  cpum_cf/VX_BCD_EXECUTION_SLOTS/  [Kernel PMU event]
  cpum_sf/SF_CYCLES_BASIC/         [Kernel PMU event]

Output after:

[root@s35lp76 perf]# ./perf list -d pmu
List of pre-defined events (to be used in -e):

  cpum_cf/AES_BLOCKED_CYCLES/      [Kernel PMU event]
  cpum_cf/AES_BLOCKED_FUNCTIONS/   [Kernel PMU event]
  cpum_cf/AES_CYCLES/              [Kernel PMU event]
  cpum_cf/AES_FUNCTIONS/           [Kernel PMU event]
  ....
  cpum_cf/TX_NC_TEND/              [Kernel PMU event]
  cpum_cf/VX_BCD_EXECUTION_SLOTS/  [Kernel PMU event]
  cpum_sf/SF_CYCLES_BASIC/         [Kernel PMU event]

3906:
  bcd_dfp_execution_slots
       [BCD DFP Execution Slots]
  decimal_instructions
       [Decimal Instructions]
  dtlb2_gpage_writes
       [DTLB2 GPAGE Writes]
  dtlb2_hpage_writes
       [DTLB2 HPAGE Writes]
  dtlb2_misses
       [DTLB2 Misses]
  dtlb2_writes
       [DTLB2 Writes]
  itlb2_misses
       [ITLB2 Misses]
  itlb2_writes
       [ITLB2 Writes]
  l1c_tlb2_misses
       [L1C TLB2 Misses]
  .....

cfvn 3:
  cpu_cycles
       [CPU Cycles]
  instructions
       [Instructions]
  l1d_dir_writes
       [L1D Directory Writes]
  l1d_penalty_cycles
       [L1D Penalty Cycles]
  l1i_dir_writes
       [L1I Directory Writes]
  l1i_penalty_cycles
       [L1I Penalty Cycles]
  problem_state_cpu_cycles
       [Problem State CPU Cycles]
  problem_state_instructions
       [Problem State Instructions]
  ....

csvn generic:
  aes_blocked_cycles
       [AES Blocked Cycles]
  aes_blocked_functions
       [AES Blocked Functions]
  aes_cycles
       [AES Cycles]
  aes_functions
       [AES Functions]
  dea_blocked_cycles
       [DEA Blocked Cycles]
  dea_blocked_functions
       [DEA Blocked Functions]
  ....

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180416132314.33249-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/pmu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 064bdcb7bd78..61a5e5027338 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -562,6 +562,12 @@ static int is_pmu_core(const char *name)
 	if (stat(path, &st) == 0)
 		return 1;
 
+	/* Look for cpu sysfs (specific to s390) */
+	scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s",
+		  sysfs, name);
+	if (stat(path, &st) == 0 && !strncmp(name, "cpum_", 5))
+		return 1;
+
 	return 0;
 }
 

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

end of thread, other threads:[~2018-04-21  7:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16 13:23 [PATCH v2] perf list: Add s390 support for detailed/verbose pmu event description Thomas Richter
2018-04-16 14:31 ` Arnaldo Carvalho de Melo
2018-04-16 14:43 ` Mark Rutland
2018-04-18 14:09   ` Thomas-Mich Richter
2018-04-21  7:48 ` [tip:perf/urgent] perf list: Add s390 support for detailed/verbose PMU " tip-bot for Thomas Richter

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.