* [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files
@ 2017-10-16 18:32 Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 1/5] perf utils: passing pmu as a parameter to function get_cpuid_str Ganapatrao Kulkarni
` (6 more replies)
0 siblings, 7 replies; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-10-16 18:32 UTC (permalink / raw)
To: linux-arm-kernel
Extending json/jevent framework for parsing arm64 event files.
Adding jevents for ThunderX2 implementation defined PMU events.
v9:
- Rebased to [3] and resolved conficts in PATCH 1/5 and reworked PATCH 3/5.
- Added PATCH 5 to fix segmentation fault in perf_pmu__find_map
[3] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
v8:
- Rename thunderx2 directory to cavium
v7:
- Addressed some more comments from Will Deacon.
v6 : Addressed comments [1] [2]
[1] https://patchwork.kernel.org/patch/9903099/
[2] https://patchwork.kernel.org/patch/9853899/
v5:
- Addressed comments from Arnaldo.
- Rebased to 4.13-rc5
v4:
- Rebased to 4.13-rc1
v3:
- Addressed comments from Will Deacon and Jayachandran C.
- Rebased to 4.12-rc1
v2:
- Updated as per Mark Rutland's suggestions.
- Added provision for get_cpuid_str to get cpu id string
from associated cpus of pmu core device.
v1: Initial patchset.
Ganapatrao Kulkarni (5):
perf utils: passing pmu as a parameter to function get_cpuid_str
perf tools arm64: Add support for get_cpuid_str function.
perf utils: use pmu->is_uncore to detect PMU CORE/UNCORE devices
perf vendor events arm64: Add ThunderX2 implementation defined pmu
core events
perf utils: add check for valid cpuid in function perf_pmu__find_map
tools/perf/arch/arm64/util/Build | 1 +
tools/perf/arch/arm64/util/header.c | 65 ++++++++++++++++++++++
tools/perf/arch/powerpc/util/header.c | 2 +-
tools/perf/arch/x86/util/header.c | 2 +-
.../arch/arm64/cavium/thunderx2-imp-def.json | 62 +++++++++++++++++++++
tools/perf/pmu-events/arch/arm64/mapfile.csv | 15 +++++
tools/perf/util/header.h | 3 +-
tools/perf/util/metricgroup.c | 4 +-
tools/perf/util/pmu.c | 39 ++++++++-----
tools/perf/util/pmu.h | 2 +-
10 files changed, 174 insertions(+), 21 deletions(-)
create mode 100644 tools/perf/arch/arm64/util/header.c
create mode 100644 tools/perf/pmu-events/arch/arm64/cavium/thunderx2-imp-def.json
create mode 100644 tools/perf/pmu-events/arch/arm64/mapfile.csv
--
2.9.4
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 1/5] perf utils: passing pmu as a parameter to function get_cpuid_str
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
@ 2017-10-16 18:32 ` Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 2/5] perf tools arm64: Add support for get_cpuid_str function Ganapatrao Kulkarni
` (5 subsequent siblings)
6 siblings, 0 replies; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-10-16 18:32 UTC (permalink / raw)
To: linux-arm-kernel
cpuid string will not be same on all CPUs on heterogeneous
platforms like ARM's big.LITTLE, adding provision(using pmu->cpus)
to find cpuid string from associated CPUs of PMU CORE device.
also optimise arguments to function pmu_add_cpu_aliases.
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
---
| 2 +-
| 2 +-
| 3 ++-
tools/perf/util/metricgroup.c | 4 ++--
tools/perf/util/pmu.c | 22 +++++++++++-----------
tools/perf/util/pmu.h | 2 +-
6 files changed, 18 insertions(+), 17 deletions(-)
--git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
index 9aaa6f5..2953681 100644
--- a/tools/perf/arch/powerpc/util/header.c
+++ b/tools/perf/arch/powerpc/util/header.c
@@ -34,7 +34,7 @@ get_cpuid(char *buffer, size_t sz)
}
char *
-get_cpuid_str(void)
+get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
{
char *bufp;
--git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c
index a74a48d..d52bc27 100644
--- a/tools/perf/arch/x86/util/header.c
+++ b/tools/perf/arch/x86/util/header.c
@@ -65,7 +65,7 @@ get_cpuid(char *buffer, size_t sz)
}
char *
-get_cpuid_str(void)
+get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
{
char *buf = malloc(128);
--git a/tools/perf/util/header.h b/tools/perf/util/header.h
index f7a16ee..3de4be9 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include "event.h"
#include "env.h"
+#include "pmu.h"
enum {
HEADER_RESERVED = 0, /* always cleared */
@@ -165,5 +166,5 @@ int write_padded(struct feat_fd *fd, const void *bf,
*/
int get_cpuid(char *buffer, size_t sz);
-char *get_cpuid_str(void);
+char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused);
#endif /* __PERF_HEADER_H */
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index 0ddd9c1..9b8b671 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -270,7 +270,7 @@ static void metricgroup__print_strlist(struct strlist *metrics, bool raw)
void metricgroup__print(bool metrics, bool metricgroups, char *filter,
bool raw)
{
- struct pmu_events_map *map = perf_pmu__find_map();
+ struct pmu_events_map *map = perf_pmu__find_map(NULL);
struct pmu_event *pe;
int i;
struct rblist groups;
@@ -368,7 +368,7 @@ void metricgroup__print(bool metrics, bool metricgroups, char *filter,
static int metricgroup__add_metric(const char *metric, struct strbuf *events,
struct list_head *group_list)
{
- struct pmu_events_map *map = perf_pmu__find_map();
+ struct pmu_events_map *map = perf_pmu__find_map(NULL);
struct pmu_event *pe;
int ret = -EINVAL;
int i, j;
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 94cf2c2..8b17db5 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -536,12 +536,12 @@ static bool pmu_is_uncore(const char *name)
* Each architecture should provide a more precise id string that
* can be use to match the architecture's "mapfile".
*/
-char * __weak get_cpuid_str(void)
+char * __weak get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
{
return NULL;
}
-static char *perf_pmu__getcpuid(void)
+static char *perf_pmu__getcpuid(struct perf_pmu *pmu)
{
char *cpuid;
static bool printed;
@@ -550,7 +550,7 @@ static char *perf_pmu__getcpuid(void)
if (cpuid)
cpuid = strdup(cpuid);
if (!cpuid)
- cpuid = get_cpuid_str();
+ cpuid = get_cpuid_str(pmu);
if (!cpuid)
return NULL;
@@ -561,10 +561,10 @@ static char *perf_pmu__getcpuid(void)
return cpuid;
}
-struct pmu_events_map *perf_pmu__find_map(void)
+struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
{
struct pmu_events_map *map;
- char *cpuid = perf_pmu__getcpuid();
+ char *cpuid = perf_pmu__getcpuid(pmu);
int i;
i = 0;
@@ -587,13 +587,14 @@ struct pmu_events_map *perf_pmu__find_map(void)
* to the current running CPU. Then, add all PMU events from that table
* as aliases.
*/
-static void pmu_add_cpu_aliases(struct list_head *head, const char *name)
+static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
{
int i;
struct pmu_events_map *map;
struct pmu_event *pe;
+ const char *name = pmu->name;
- map = perf_pmu__find_map();
+ map = perf_pmu__find_map(pmu);
if (!map)
return;
@@ -655,21 +656,20 @@ static struct perf_pmu *pmu_lookup(const char *name)
if (pmu_aliases(name, &aliases))
return NULL;
- pmu_add_cpu_aliases(&aliases, name);
pmu = zalloc(sizeof(*pmu));
if (!pmu)
return NULL;
pmu->cpus = pmu_cpumask(name);
-
+ pmu->name = strdup(name);
+ pmu->type = type;
pmu->is_uncore = pmu_is_uncore(name);
+ pmu_add_cpu_aliases(&aliases, pmu);
INIT_LIST_HEAD(&pmu->format);
INIT_LIST_HEAD(&pmu->aliases);
list_splice(&format, &pmu->format);
list_splice(&aliases, &pmu->aliases);
- pmu->name = strdup(name);
- pmu->type = type;
list_add_tail(&pmu->list, &pmus);
pmu->default_config = perf_pmu__get_default_config(pmu);
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 7ca6755..abc4728 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -91,6 +91,6 @@ int perf_pmu__test(void);
struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu);
-struct pmu_events_map *perf_pmu__find_map(void);
+struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu);
#endif /* __PMU_H */
--
2.9.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v9 2/5] perf tools arm64: Add support for get_cpuid_str function.
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 1/5] perf utils: passing pmu as a parameter to function get_cpuid_str Ganapatrao Kulkarni
@ 2017-10-16 18:32 ` Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices Ganapatrao Kulkarni
` (4 subsequent siblings)
6 siblings, 0 replies; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-10-16 18:32 UTC (permalink / raw)
To: linux-arm-kernel
function get_cpuid_str returns MIDR string of the first online
cpu from the range of cpus associated with the PMU CORE device.
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
---
tools/perf/arch/arm64/util/Build | 1 +
| 65 +++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+)
create mode 100644 tools/perf/arch/arm64/util/header.c
diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build
index cef6fb3..b1ab72d 100644
--- a/tools/perf/arch/arm64/util/Build
+++ b/tools/perf/arch/arm64/util/Build
@@ -1,3 +1,4 @@
+libperf-y += header.o
libperf-$(CONFIG_DWARF) += dwarf-regs.o
libperf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
--git a/tools/perf/arch/arm64/util/header.c b/tools/perf/arch/arm64/util/header.c
new file mode 100644
index 0000000..534cd25
--- /dev/null
+++ b/tools/perf/arch/arm64/util/header.c
@@ -0,0 +1,65 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <api/fs/fs.h>
+#include "header.h"
+
+#define MIDR "/regs/identification/midr_el1"
+#define MIDR_SIZE 19
+#define MIDR_REVISION_MASK 0xf
+#define MIDR_VARIANT_SHIFT 20
+#define MIDR_VARIANT_MASK (0xf << MIDR_VARIANT_SHIFT)
+
+char *get_cpuid_str(struct perf_pmu *pmu)
+{
+ char *buf = NULL;
+ char path[PATH_MAX];
+ const char *sysfs = sysfs__mountpoint();
+ int cpu;
+ u64 midr = 0;
+ struct cpu_map *cpus;
+ FILE *file;
+
+ if (!sysfs || !pmu || !pmu->cpus)
+ return NULL;
+
+ buf = malloc(MIDR_SIZE);
+ if (!buf)
+ return NULL;
+
+ /* read midr from list of cpus mapped to this pmu */
+ cpus = cpu_map__get(pmu->cpus);
+ for (cpu = 0; cpu < cpus->nr; cpu++) {
+ scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR,
+ sysfs, cpus->map[cpu]);
+
+ file = fopen(path, "r");
+ if (!file) {
+ pr_debug("fopen failed for file %s\n", path);
+ continue;
+ }
+
+ if (!fgets(buf, MIDR_SIZE, file)) {
+ fclose(file);
+ continue;
+ }
+ fclose(file);
+
+ /* Ignore/clear Variant[23:20] and
+ * Revision[3:0] of MIDR
+ */
+ midr = strtoul(buf, NULL, 16);
+ midr &= (~(MIDR_VARIANT_MASK | MIDR_REVISION_MASK));
+ scnprintf(buf, MIDR_SIZE, "0x%016lx", midr);
+ /* got midr break loop */
+ break;
+ }
+
+ if (!midr) {
+ pr_err("failed to get cpuid string for PMU %s\n", pmu->name);
+ free(buf);
+ buf = NULL;
+ }
+
+ cpu_map__put(cpus);
+ return buf;
+}
--
2.9.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 1/5] perf utils: passing pmu as a parameter to function get_cpuid_str Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 2/5] perf tools arm64: Add support for get_cpuid_str function Ganapatrao Kulkarni
@ 2017-10-16 18:32 ` Ganapatrao Kulkarni
2017-12-05 2:12 ` Jin, Yao
2017-10-16 18:32 ` [PATCH v9 4/5] perf vendor events arm64: Add ThunderX2 implementation defined pmu core events Ganapatrao Kulkarni
` (3 subsequent siblings)
6 siblings, 1 reply; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-10-16 18:32 UTC (permalink / raw)
To: linux-arm-kernel
PMU CORE devices are identified using sysfs filename cpu, however
on some platforms(like arm/arm64), PMU CORE sysfs name is not cpu.
Hence cpu cannot be used to differentiate PMU CORE/UNCORE devices.
commit:
66ec1191 ("perf pmu: Unbreak perf record for arm/arm64 with events with explicit PMU")
has introduced pmu->is_uncore, which is set to PMU UNCORE devices only.
Adding changes to use pmu->is_uncore to identify UNCORE devices.
Acked-by: Will Deacon <will.deacon@arm.com>
Tested-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
---
tools/perf/util/pmu.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 8b17db5..9110718 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -603,7 +603,6 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
*/
i = 0;
while (1) {
- const char *pname;
pe = &map->table[i++];
if (!pe->name) {
@@ -612,9 +611,13 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
break;
}
- pname = pe->pmu ? pe->pmu : "cpu";
- if (strncmp(pname, name, strlen(pname)))
- continue;
+ if (pmu->is_uncore) {
+ /* check for uncore devices */
+ if (pe->pmu == NULL)
+ continue;
+ if (strncmp(pe->pmu, name, strlen(pe->pmu)))
+ continue;
+ }
/* need type casts to override 'const' */
__perf_pmu__new_alias(head, NULL, (char *)pe->name,
--
2.9.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v9 4/5] perf vendor events arm64: Add ThunderX2 implementation defined pmu core events
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
` (2 preceding siblings ...)
2017-10-16 18:32 ` [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices Ganapatrao Kulkarni
@ 2017-10-16 18:32 ` Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 5/5] perf utils: add check for valid cpuid in function perf_pmu__find_map Ganapatrao Kulkarni
` (2 subsequent siblings)
6 siblings, 0 replies; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-10-16 18:32 UTC (permalink / raw)
To: linux-arm-kernel
This is not a full event list, but a short list of useful events.
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
---
.../arch/arm64/cavium/thunderx2-imp-def.json | 62 ++++++++++++++++++++++
tools/perf/pmu-events/arch/arm64/mapfile.csv | 15 ++++++
2 files changed, 77 insertions(+)
create mode 100644 tools/perf/pmu-events/arch/arm64/cavium/thunderx2-imp-def.json
create mode 100644 tools/perf/pmu-events/arch/arm64/mapfile.csv
diff --git a/tools/perf/pmu-events/arch/arm64/cavium/thunderx2-imp-def.json b/tools/perf/pmu-events/arch/arm64/cavium/thunderx2-imp-def.json
new file mode 100644
index 0000000..2db45c4
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/cavium/thunderx2-imp-def.json
@@ -0,0 +1,62 @@
+[
+ {
+ "PublicDescription": "Attributable Level 1 data cache access, read",
+ "EventCode": "0x40",
+ "EventName": "l1d_cache_rd",
+ "BriefDescription": "L1D cache read",
+ },
+ {
+ "PublicDescription": "Attributable Level 1 data cache access, write ",
+ "EventCode": "0x41",
+ "EventName": "l1d_cache_wr",
+ "BriefDescription": "L1D cache write",
+ },
+ {
+ "PublicDescription": "Attributable Level 1 data cache refill, read",
+ "EventCode": "0x42",
+ "EventName": "l1d_cache_refill_rd",
+ "BriefDescription": "L1D cache refill read",
+ },
+ {
+ "PublicDescription": "Attributable Level 1 data cache refill, write",
+ "EventCode": "0x43",
+ "EventName": "l1d_cache_refill_wr",
+ "BriefDescription": "L1D refill write",
+ },
+ {
+ "PublicDescription": "Attributable Level 1 data TLB refill, read",
+ "EventCode": "0x4C",
+ "EventName": "l1d_tlb_refill_rd",
+ "BriefDescription": "L1D tlb refill read",
+ },
+ {
+ "PublicDescription": "Attributable Level 1 data TLB refill, write",
+ "EventCode": "0x4D",
+ "EventName": "l1d_tlb_refill_wr",
+ "BriefDescription": "L1D tlb refill write",
+ },
+ {
+ "PublicDescription": "Attributable Level 1 data or unified TLB access, read",
+ "EventCode": "0x4E",
+ "EventName": "l1d_tlb_rd",
+ "BriefDescription": "L1D tlb read",
+ },
+ {
+ "PublicDescription": "Attributable Level 1 data or unified TLB access, write",
+ "EventCode": "0x4F",
+ "EventName": "l1d_tlb_wr",
+ "BriefDescription": "L1D tlb write",
+ },
+ {
+ "PublicDescription": "Bus access read",
+ "EventCode": "0x60",
+ "EventName": "bus_access_rd",
+ "BriefDescription": "Bus access read",
+ },
+ {
+ "PublicDescription": "Bus access write",
+ "EventCode": "0x61",
+ "EventName": "bus_access_wr",
+ "BriefDescription": "Bus access write",
+ }
+]
diff --git a/tools/perf/pmu-events/arch/arm64/mapfile.csv b/tools/perf/pmu-events/arch/arm64/mapfile.csv
new file mode 100644
index 0000000..219d675
--- /dev/null
+++ b/tools/perf/pmu-events/arch/arm64/mapfile.csv
@@ -0,0 +1,15 @@
+# Format:
+# MIDR,Version,JSON/file/pathname,Type
+#
+# where
+# MIDR Processor version
+# Variant[23:20] and Revision [3:0] should be zero.
+# Version could be used to track version of of JSON file
+# but currently unused.
+# JSON/file/pathname is the path to JSON file, relative
+# to tools/perf/pmu-events/arch/arm64/.
+# Type is core, uncore etc
+#
+#
+#Family-model,Version,Filename,EventType
+0x00000000420f5160,v1,cavium,core
--
2.9.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v9 5/5] perf utils: add check for valid cpuid in function perf_pmu__find_map
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
` (3 preceding siblings ...)
2017-10-16 18:32 ` [PATCH v9 4/5] perf vendor events arm64: Add ThunderX2 implementation defined pmu core events Ganapatrao Kulkarni
@ 2017-10-16 18:32 ` Ganapatrao Kulkarni
2017-10-18 17:49 ` [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
2017-11-07 1:23 ` Will Deacon
6 siblings, 0 replies; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-10-16 18:32 UTC (permalink / raw)
To: linux-arm-kernel
On some platforms(arm/arm64) which uses cpus map to get corresponding
cpuid string, cpuid can be NULL for PMUs other than CORE PMUs.
Adding check for NULL cpuid in function perf_pmu__find_map to
avoid segmentation fault.
Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.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 9110718..569fb0c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -567,6 +567,12 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu)
char *cpuid = perf_pmu__getcpuid(pmu);
int i;
+ /* on some platforms which uses cpus map, cpuid can be NULL for
+ * PMUs other than CORE PMUs.
+ */
+ if (!cpuid)
+ return NULL;
+
i = 0;
for (;;) {
map = &pmu_events_map[i++];
--
2.9.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
` (4 preceding siblings ...)
2017-10-16 18:32 ` [PATCH v9 5/5] perf utils: add check for valid cpuid in function perf_pmu__find_map Ganapatrao Kulkarni
@ 2017-10-18 17:49 ` Ganapatrao Kulkarni
2017-11-06 9:01 ` John Garry
2017-11-07 1:23 ` Will Deacon
6 siblings, 1 reply; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-10-18 17:49 UTC (permalink / raw)
To: linux-arm-kernel
Hi Arnaldo, Will,
can this be queued to next?
On Tue, Oct 17, 2017 at 12:02 AM, Ganapatrao Kulkarni
<ganapatrao.kulkarni@cavium.com> wrote:
> Extending json/jevent framework for parsing arm64 event files.
> Adding jevents for ThunderX2 implementation defined PMU events.
>
> v9:
> - Rebased to [3] and resolved conficts in PATCH 1/5 and reworked PATCH 3/5.
> - Added PATCH 5 to fix segmentation fault in perf_pmu__find_map
>
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
>
> v8:
> - Rename thunderx2 directory to cavium
>
> v7:
> - Addressed some more comments from Will Deacon.
>
> v6 : Addressed comments [1] [2]
>
> [1] https://patchwork.kernel.org/patch/9903099/
> [2] https://patchwork.kernel.org/patch/9853899/
>
> v5:
> - Addressed comments from Arnaldo.
> - Rebased to 4.13-rc5
>
> v4:
> - Rebased to 4.13-rc1
>
> v3:
> - Addressed comments from Will Deacon and Jayachandran C.
> - Rebased to 4.12-rc1
>
> v2:
> - Updated as per Mark Rutland's suggestions.
> - Added provision for get_cpuid_str to get cpu id string
> from associated cpus of pmu core device.
>
> v1: Initial patchset.
>
>
> Ganapatrao Kulkarni (5):
> perf utils: passing pmu as a parameter to function get_cpuid_str
> perf tools arm64: Add support for get_cpuid_str function.
> perf utils: use pmu->is_uncore to detect PMU CORE/UNCORE devices
> perf vendor events arm64: Add ThunderX2 implementation defined pmu
> core events
> perf utils: add check for valid cpuid in function perf_pmu__find_map
>
> tools/perf/arch/arm64/util/Build | 1 +
> tools/perf/arch/arm64/util/header.c | 65 ++++++++++++++++++++++
> tools/perf/arch/powerpc/util/header.c | 2 +-
> tools/perf/arch/x86/util/header.c | 2 +-
> .../arch/arm64/cavium/thunderx2-imp-def.json | 62 +++++++++++++++++++++
> tools/perf/pmu-events/arch/arm64/mapfile.csv | 15 +++++
> tools/perf/util/header.h | 3 +-
> tools/perf/util/metricgroup.c | 4 +-
> tools/perf/util/pmu.c | 39 ++++++++-----
> tools/perf/util/pmu.h | 2 +-
> 10 files changed, 174 insertions(+), 21 deletions(-)
> create mode 100644 tools/perf/arch/arm64/util/header.c
> create mode 100644 tools/perf/pmu-events/arch/arm64/cavium/thunderx2-imp-def.json
> create mode 100644 tools/perf/pmu-events/arch/arm64/mapfile.csv
>
> --
> 2.9.4
>
thanks
Ganapat
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files
2017-10-18 17:49 ` [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
@ 2017-11-06 9:01 ` John Garry
0 siblings, 0 replies; 23+ messages in thread
From: John Garry @ 2017-11-06 9:01 UTC (permalink / raw)
To: linux-arm-kernel
On 18/10/2017 18:49, Ganapatrao Kulkarni wrote:
> Hi Arnaldo, Will,
>
> can this be queued to next?
>
Is there any update on the status of this patchset? From searching the
acme git, I can only assume that it has not been merged. So we'll have
to work on top of this out-of-tree series.
John
> On Tue, Oct 17, 2017 at 12:02 AM, Ganapatrao Kulkarni
> <ganapatrao.kulkarni@cavium.com> wrote:
>> Extending json/jevent framework for parsing arm64 event files.
>> Adding jevents for ThunderX2 implementation defined PMU events.
>>
>> v9:
>> - Rebased to [3] and resolved conficts in PATCH 1/5 and reworked PATCH 3/5.
>> - Added PATCH 5 to fix segmentation fault in perf_pmu__find_map
>>
>> [3] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
>>
>> v8:
>> - Rename thunderx2 directory to cavium
>>
>> v7:
>> - Addressed some more comments from Will Deacon.
>>
>> v6 : Addressed comments [1] [2]
>>
>> [1] https://patchwork.kernel.org/patch/9903099/
>> [2] https://patchwork.kernel.org/patch/9853899/
>>
>> v5:
>> - Addressed comments from Arnaldo.
>> - Rebased to 4.13-rc5
>>
>> v4:
>> - Rebased to 4.13-rc1
>>
>> v3:
>> - Addressed comments from Will Deacon and Jayachandran C.
>> - Rebased to 4.12-rc1
>>
>> v2:
>> - Updated as per Mark Rutland's suggestions.
>> - Added provision for get_cpuid_str to get cpu id string
>> from associated cpus of pmu core device.
>>
>> v1: Initial patchset.
>>
>>
>> Ganapatrao Kulkarni (5):
>> perf utils: passing pmu as a parameter to function get_cpuid_str
>> perf tools arm64: Add support for get_cpuid_str function.
>> perf utils: use pmu->is_uncore to detect PMU CORE/UNCORE devices
>> perf vendor events arm64: Add ThunderX2 implementation defined pmu
>> core events
>> perf utils: add check for valid cpuid in function perf_pmu__find_map
>>
>> tools/perf/arch/arm64/util/Build | 1 +
>> tools/perf/arch/arm64/util/header.c | 65 ++++++++++++++++++++++
>> tools/perf/arch/powerpc/util/header.c | 2 +-
>> tools/perf/arch/x86/util/header.c | 2 +-
>> .../arch/arm64/cavium/thunderx2-imp-def.json | 62 +++++++++++++++++++++
>> tools/perf/pmu-events/arch/arm64/mapfile.csv | 15 +++++
>> tools/perf/util/header.h | 3 +-
>> tools/perf/util/metricgroup.c | 4 +-
>> tools/perf/util/pmu.c | 39 ++++++++-----
>> tools/perf/util/pmu.h | 2 +-
>> 10 files changed, 174 insertions(+), 21 deletions(-)
>> create mode 100644 tools/perf/arch/arm64/util/header.c
>> create mode 100644 tools/perf/pmu-events/arch/arm64/cavium/thunderx2-imp-def.json
>> create mode 100644 tools/perf/pmu-events/arch/arm64/mapfile.csv
>>
>> --
>> 2.9.4
>>
>
> thanks
> Ganapat
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
> .
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
` (5 preceding siblings ...)
2017-10-18 17:49 ` [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
@ 2017-11-07 1:23 ` Will Deacon
2017-11-27 10:04 ` John Garry
6 siblings, 1 reply; 23+ messages in thread
From: Will Deacon @ 2017-11-07 1:23 UTC (permalink / raw)
To: linux-arm-kernel
Hi Arnaldo,
On Tue, Oct 17, 2017 at 12:02:17AM +0530, Ganapatrao Kulkarni wrote:
> Extending json/jevent framework for parsing arm64 event files.
> Adding jevents for ThunderX2 implementation defined PMU events.
>
> v9:
> - Rebased to [3] and resolved conficts in PATCH 1/5 and reworked PATCH 3/5.
> - Added PATCH 5 to fix segmentation fault in perf_pmu__find_map
>
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
I'm happy with this version of the series (it's all Acked now), so would you
be able to pick it up for mainline, please?
Cheers,
Will
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files
2017-11-07 1:23 ` Will Deacon
@ 2017-11-27 10:04 ` John Garry
2017-12-04 4:41 ` Ganapatrao Kulkarni
0 siblings, 1 reply; 23+ messages in thread
From: John Garry @ 2017-11-27 10:04 UTC (permalink / raw)
To: linux-arm-kernel
On 07/11/2017 01:23, Will Deacon wrote:
> Hi Arnaldo,
>
> On Tue, Oct 17, 2017 at 12:02:17AM +0530, Ganapatrao Kulkarni wrote:
>> Extending json/jevent framework for parsing arm64 event files.
>> Adding jevents for ThunderX2 implementation defined PMU events.
>>
>> v9:
>> - Rebased to [3] and resolved conficts in PATCH 1/5 and reworked PATCH 3/5.
>> - Added PATCH 5 to fix segmentation fault in perf_pmu__find_map
>>
>> [3] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
>
> I'm happy with this version of the series (it's all Acked now), so would you
> be able to pick it up for mainline, please?
>
> Cheers,
>
So this patchset has not been merged.
We have a patchset waiting for HiSilicon hip08 support, which includes
the requested feature for the ARM64 IMP DEFINED recommended events
refactoring-out.
We can send our hip08 patchset now as an RFC, based in this patchset.
Depending on the comments and general acceptance of the approaches, it
may be appropriate to merge the patchsets (or at least merge the
refactoring part).
Thanks,
John
> Will
>
> .
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files
2017-11-27 10:04 ` John Garry
@ 2017-12-04 4:41 ` Ganapatrao Kulkarni
2017-12-04 15:09 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-12-04 4:41 UTC (permalink / raw)
To: linux-arm-kernel
Hi perf maintainers,
can this be queued to -next??
please let me know, if have to rebase to any specific branch and send
next version?
On Mon, Nov 27, 2017 at 3:34 PM, John Garry <john.garry@huawei.com> wrote:
> On 07/11/2017 01:23, Will Deacon wrote:
>>
>> Hi Arnaldo,
>>
>> On Tue, Oct 17, 2017 at 12:02:17AM +0530, Ganapatrao Kulkarni wrote:
>>>
>>> Extending json/jevent framework for parsing arm64 event files.
>>> Adding jevents for ThunderX2 implementation defined PMU events.
>>>
>>> v9:
>>> - Rebased to [3] and resolved conficts in PATCH 1/5 and reworked PATCH
>>> 3/5.
>>> - Added PATCH 5 to fix segmentation fault in perf_pmu__find_map
>>>
>>> [3]
>>> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
>>
>>
>> I'm happy with this version of the series (it's all Acked now), so would
>> you
>> be able to pick it up for mainline, please?
>>
>> Cheers,
>>
>
> So this patchset has not been merged.
>
> We have a patchset waiting for HiSilicon hip08 support, which includes the
> requested feature for the ARM64 IMP DEFINED recommended events
> refactoring-out.
>
> We can send our hip08 patchset now as an RFC, based in this patchset.
> Depending on the comments and general acceptance of the approaches, it may
> be appropriate to merge the patchsets (or at least merge the refactoring
> part).
>
> Thanks,
> John
>
>
>> Will
>>
>> .
>>
>
>
thanks
Ganapat
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files
2017-12-04 4:41 ` Ganapatrao Kulkarni
@ 2017-12-04 15:09 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 23+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-04 15:09 UTC (permalink / raw)
To: linux-arm-kernel
Em Mon, Dec 04, 2017 at 10:11:01AM +0530, Ganapatrao Kulkarni escreveu:
> Hi perf maintainers,
>
> can this be queued to -next??
> please let me know, if have to rebase to any specific branch and send
> next version?
I went over the messages and saw the acks, will try and process it now.
Sorry for the delay, it fell thru the cracks :-\
- Arnaldo
>
> On Mon, Nov 27, 2017 at 3:34 PM, John Garry <john.garry@huawei.com> wrote:
> > On 07/11/2017 01:23, Will Deacon wrote:
> >>
> >> Hi Arnaldo,
> >>
> >> On Tue, Oct 17, 2017 at 12:02:17AM +0530, Ganapatrao Kulkarni wrote:
> >>>
> >>> Extending json/jevent framework for parsing arm64 event files.
> >>> Adding jevents for ThunderX2 implementation defined PMU events.
> >>>
> >>> v9:
> >>> - Rebased to [3] and resolved conficts in PATCH 1/5 and reworked PATCH
> >>> 3/5.
> >>> - Added PATCH 5 to fix segmentation fault in perf_pmu__find_map
> >>>
> >>> [3]
> >>> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=perf/core
> >>
> >>
> >> I'm happy with this version of the series (it's all Acked now), so would
> >> you
> >> be able to pick it up for mainline, please?
> >>
> >> Cheers,
> >>
> >
> > So this patchset has not been merged.
> >
> > We have a patchset waiting for HiSilicon hip08 support, which includes the
> > requested feature for the ARM64 IMP DEFINED recommended events
> > refactoring-out.
> >
> > We can send our hip08 patchset now as an RFC, based in this patchset.
> > Depending on the comments and general acceptance of the approaches, it may
> > be appropriate to merge the patchsets (or at least merge the refactoring
> > part).
> >
> > Thanks,
> > John
> >
> >
> >> Will
> >>
> >> .
> >>
> >
> >
>
> thanks
> Ganapat
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-10-16 18:32 ` [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices Ganapatrao Kulkarni
@ 2017-12-05 2:12 ` Jin, Yao
2017-12-05 7:12 ` Ganapatrao Kulkarni
0 siblings, 1 reply; 23+ messages in thread
From: Jin, Yao @ 2017-12-05 2:12 UTC (permalink / raw)
To: linux-arm-kernel
Hi Kulkarni, Arnaldo,
This patch has been merged in perf/core branch today.
But I see a regression issue when I run the 'perf stat'.
With bisect checking, I locate to this patch.
commit ad8737a08973f5dca632bdd63cf2abc99670e540
Author: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Date: Tue Oct 17 00:02:20 2017 +0530
perf pmu: Use pmu->is_uncore to detect UNCORE devices
For example (on Intel skylake desktop),
1. The correct output should be (without this patch):
root at skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC
^C
Performance counter stats for process id '1754':
vmstat-1754 1,882,798 inst_retired.any
# 0.8 CPI
vmstat-1754 1,589,720 cycles
vmstat-1754 1,882,798 inst_retired.any
# 1.2 IPC
vmstat-1754 1,589,720 cpu_clk_unhalted.thread
2.647443167 seconds time elapsed
2. With this patch, the output will be:
root at skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC
^C
Performance counter stats for process id '1754':
vmstat-1754 1,945,589 inst_retired.any
vmstat-1754 <not supported> inst_retired.any
vmstat-1754 1,609,892 cycles
vmstat-1754 1,945,589 inst_retired.any
vmstat-1754 <not supported> inst_retired.any
vmstat-1754 1,609,892 cpu_clk_unhalted.thread
vmstat-1754 <not supported> cpu_clk_unhalted.thread
3.051274166 seconds time elapsed
Could you please help to take a look?
Thanks
Jin Yao
On 10/17/2017 2:32 AM, Ganapatrao Kulkarni wrote:
> PMU CORE devices are identified using sysfs filename cpu, however
> on some platforms(like arm/arm64), PMU CORE sysfs name is not cpu.
> Hence cpu cannot be used to differentiate PMU CORE/UNCORE devices.
>
> commit:
> 66ec1191 ("perf pmu: Unbreak perf record for arm/arm64 with events with explicit PMU")
>
> has introduced pmu->is_uncore, which is set to PMU UNCORE devices only.
> Adding changes to use pmu->is_uncore to identify UNCORE devices.
>
> Acked-by: Will Deacon <will.deacon@arm.com>
> Tested-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
> ---
> tools/perf/util/pmu.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 8b17db5..9110718 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -603,7 +603,6 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
> */
> i = 0;
> while (1) {
> - const char *pname;
>
> pe = &map->table[i++];
> if (!pe->name) {
> @@ -612,9 +611,13 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
> break;
> }
>
> - pname = pe->pmu ? pe->pmu : "cpu";
> - if (strncmp(pname, name, strlen(pname)))
> - continue;
> + if (pmu->is_uncore) {
> + /* check for uncore devices */
> + if (pe->pmu == NULL)
> + continue;
> + if (strncmp(pe->pmu, name, strlen(pe->pmu)))
> + continue;
> + }
>
> /* need type casts to override 'const' */
> __perf_pmu__new_alias(head, NULL, (char *)pe->name,
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 2:12 ` Jin, Yao
@ 2017-12-05 7:12 ` Ganapatrao Kulkarni
2017-12-05 7:23 ` Jin, Yao
2017-12-05 13:58 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-12-05 7:12 UTC (permalink / raw)
To: linux-arm-kernel
thanks Jin Yao for point this out.
looks like logic of leveraging uncore device type(which i have changed
in v9) does not go well
with some json events of x86.
can you please try below diff(logic used till v8), which keeps the
original logic of identifying core/cpu PMUs.
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 5ad8a18..57e38fd 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
}
/*
+ * PMU CORE devices have different name other than cpu in sysfs on some
+ * platforms. looking for possible sysfs files to identify as core device.
+ */
+static int is_pmu_core(const char *name)
+{
+ struct stat st;
+ char path[PATH_MAX];
+ const char *sysfs = sysfs__mountpoint();
+
+ if (!sysfs)
+ return 0;
+
+ /* Look for cpu sysfs (x86 and others) */
+ scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
+ if ((stat(path, &st) == 0) &&
+ (strncmp(name, "cpu", strlen("cpu")) == 0))
+ return 1;
+
+ /* Look for cpu sysfs (specific to arm) */
+ scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
+ sysfs, name);
+ if (stat(path, &st) == 0)
+ return 1;
+
+ return 0;
+}
+
+/*
* Return the CPU id as a raw string.
*
* Each architecture should provide a more precise id string that
@@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
*head, struct perf_pmu *pmu)
break;
}
- if (pmu->is_uncore) {
+ if (!is_pmu_core(name)) {
/* check for uncore devices */
if (pe->pmu == NULL)
continue;
i have tried this diff on my x86 PC(haswell) and looks to be ok.
please confirm your testing on skylake.
gkulkarni at gkFc25>perf>> ./perf stat --per-thread -p 12663 -M CPI,IPC sleep 1
Performance counter stats for process id '12663':
bash-12663 278,886 inst_retired.any:u
bash-12663 482,284 cycles:u
bash-12663 278,886 inst_retired.any:u
bash-12663 483,597
cpu_clk_unhalted.thread:u
1.000923760 seconds time elapsed
On Tue, Dec 5, 2017 at 7:42 AM, Jin, Yao <yao.jin@linux.intel.com> wrote:
> Hi Kulkarni, Arnaldo,
>
> This patch has been merged in perf/core branch today.
>
> But I see a regression issue when I run the 'perf stat'.
>
> With bisect checking, I locate to this patch.
>
> commit ad8737a08973f5dca632bdd63cf2abc99670e540
> Author: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
> Date: Tue Oct 17 00:02:20 2017 +0530
>
> perf pmu: Use pmu->is_uncore to detect UNCORE devices
>
> For example (on Intel skylake desktop),
>
> 1. The correct output should be (without this patch):
>
> root at skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC
> ^C
> Performance counter stats for process id '1754':
>
> vmstat-1754 1,882,798 inst_retired.any #
> 0.8 CPI
> vmstat-1754 1,589,720 cycles
> vmstat-1754 1,882,798 inst_retired.any #
> 1.2 IPC
> vmstat-1754 1,589,720 cpu_clk_unhalted.thread
>
> 2.647443167 seconds time elapsed
>
> 2. With this patch, the output will be:
>
> root at skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC
> ^C
> Performance counter stats for process id '1754':
>
> vmstat-1754 1,945,589 inst_retired.any
> vmstat-1754 <not supported> inst_retired.any
> vmstat-1754 1,609,892 cycles
> vmstat-1754 1,945,589 inst_retired.any
> vmstat-1754 <not supported> inst_retired.any
> vmstat-1754 1,609,892 cpu_clk_unhalted.thread
> vmstat-1754 <not supported> cpu_clk_unhalted.thread
>
> 3.051274166 seconds time elapsed
>
> Could you please help to take a look?
>
> Thanks
> Jin Yao
>
>
> On 10/17/2017 2:32 AM, Ganapatrao Kulkarni wrote:
>>
>> PMU CORE devices are identified using sysfs filename cpu, however
>> on some platforms(like arm/arm64), PMU CORE sysfs name is not cpu.
>> Hence cpu cannot be used to differentiate PMU CORE/UNCORE devices.
>>
>> commit:
>> 66ec1191 ("perf pmu: Unbreak perf record for arm/arm64 with events with
>> explicit PMU")
>>
>> has introduced pmu->is_uncore, which is set to PMU UNCORE devices only.
>> Adding changes to use pmu->is_uncore to identify UNCORE devices.
>>
>> Acked-by: Will Deacon <will.deacon@arm.com>
>> Tested-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>> Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
>> ---
>> tools/perf/util/pmu.c | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>> index 8b17db5..9110718 100644
>> --- a/tools/perf/util/pmu.c
>> +++ b/tools/perf/util/pmu.c
>> @@ -603,7 +603,6 @@ static void pmu_add_cpu_aliases(struct list_head
>> *head, struct perf_pmu *pmu)
>> */
>> i = 0;
>> while (1) {
>> - const char *pname;
>> pe = &map->table[i++];
>> if (!pe->name) {
>> @@ -612,9 +611,13 @@ static void pmu_add_cpu_aliases(struct list_head
>> *head, struct perf_pmu *pmu)
>> break;
>> }
>> - pname = pe->pmu ? pe->pmu : "cpu";
>> - if (strncmp(pname, name, strlen(pname)))
>> - continue;
>> + if (pmu->is_uncore) {
>> + /* check for uncore devices */
>> + if (pe->pmu == NULL)
>> + continue;
>> + if (strncmp(pe->pmu, name, strlen(pe->pmu)))
>> + continue;
>> + }
>> /* need type casts to override 'const' */
>> __perf_pmu__new_alias(head, NULL, (char *)pe->name,
>>
>
thanks
Ganapat
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 7:12 ` Ganapatrao Kulkarni
@ 2017-12-05 7:23 ` Jin, Yao
2017-12-05 12:35 ` Jin, Yao
2017-12-05 13:58 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 23+ messages in thread
From: Jin, Yao @ 2017-12-05 7:23 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
I applied the diff but it's failed.
jinyao at skl:~/skl-ws/perf-dev/lck-4594/src$ patch -p1 < 1.pat
patching file tools/perf/util/pmu.c
patch: **** malformed patch at line 41: *head, struct perf_pmu *pmu)
Could you send the patch as attachment to me in another mail thread?
to yao.jin at linux.intel.com
cc yao.jin@intel.com
Thanks
Jin Yao
On 12/5/2017 3:12 PM, Ganapatrao Kulkarni wrote:
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 5ad8a18..57e38fd 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
> }
>
> /*
> + * PMU CORE devices have different name other than cpu in sysfs on some
> + * platforms. looking for possible sysfs files to identify as core device.
> + */
> +static int is_pmu_core(const char *name)
> +{
> + struct stat st;
> + char path[PATH_MAX];
> + const char *sysfs = sysfs__mountpoint();
> +
> + if (!sysfs)
> + return 0;
> +
> + /* Look for cpu sysfs (x86 and others) */
> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
> + if ((stat(path, &st) == 0) &&
> + (strncmp(name, "cpu", strlen("cpu")) == 0))
> + return 1;
> +
> + /* Look for cpu sysfs (specific to arm) */
> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
> + sysfs, name);
> + if (stat(path, &st) == 0)
> + return 1;
> +
> + return 0;
> +}
> +
> +/*
> * Return the CPU id as a raw string.
> *
> * Each architecture should provide a more precise id string that
> @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
> *head, struct perf_pmu *pmu)
> break;
> }
>
> - if (pmu->is_uncore) {
> + if (!is_pmu_core(name)) {
> /* check for uncore devices */
> if (pe->pmu == NULL)
> continue;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 7:23 ` Jin, Yao
@ 2017-12-05 12:35 ` Jin, Yao
2017-12-05 13:56 ` Arnaldo Carvalho de Melo
2017-12-05 18:42 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 23+ messages in thread
From: Jin, Yao @ 2017-12-05 12:35 UTC (permalink / raw)
To: linux-arm-kernel
A quick test with the new patch 'fix_json_v9_2.patch' shows it working.
See the log:
root at skl:/tmp# perf stat --per-thread -p 10322 -M CPI,IPC
^C
Performance counter stats for process id '10322':
vmstat-10322 1,879,654 inst_retired.any
# 0.8 CPI
vmstat-10322 1,565,807 cycles
vmstat-10322 1,879,654 inst_retired.any
# 1.2 IPC
vmstat-10322 1,565,807 cpu_clk_unhalted.thread
2.850291804 seconds time elapsed
Thanks for fixing it quickly.
Thanks
Jin Yao
On 12/5/2017 3:23 PM, Jin, Yao wrote:
> Hi,
>
> I applied the diff but it's failed.
>
> jinyao at skl:~/skl-ws/perf-dev/lck-4594/src$ patch -p1 < 1.pat
> patching file tools/perf/util/pmu.c
> patch: **** malformed patch at line 41: *head, struct perf_pmu *pmu)
>
> Could you send the patch as attachment to me in another mail thread?
>
> to yao.jin at linux.intel.com
> cc yao.jin at intel.com
>
> Thanks
> Jin Yao
>
> On 12/5/2017 3:12 PM, Ganapatrao Kulkarni wrote:
>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>> index 5ad8a18..57e38fd 100644
>> --- a/tools/perf/util/pmu.c
>> +++ b/tools/perf/util/pmu.c
>> @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
>> ? }
>>
>> ? /*
>> + *? PMU CORE devices have different name other than cpu in sysfs on some
>> + *? platforms. looking for possible sysfs files to identify as core
>> device.
>> + */
>> +static int is_pmu_core(const char *name)
>> +{
>> + struct stat st;
>> + char path[PATH_MAX];
>> + const char *sysfs = sysfs__mountpoint();
>> +
>> + if (!sysfs)
>> + return 0;
>> +
>> + /* Look for cpu sysfs (x86 and others) */
>> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
>> + if ((stat(path, &st) == 0) &&
>> + (strncmp(name, "cpu", strlen("cpu")) == 0))
>> + return 1;
>> +
>> + /* Look for cpu sysfs (specific to arm) */
>> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
>> + sysfs, name);
>> + if (stat(path, &st) == 0)
>> + return 1;
>> +
>> + return 0;
>> +}
>> +
>> +/*
>> ?? * Return the CPU id as a raw string.
>> ?? *
>> ?? * Each architecture should provide a more precise id string that
>> @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
>> *head, struct perf_pmu *pmu)
>> ?? break;
>> ?? }
>>
>> - if (pmu->is_uncore) {
>> + if (!is_pmu_core(name)) {
>> ?? /* check for uncore devices */
>> ?? if (pe->pmu == NULL)
>> ?? continue;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 12:35 ` Jin, Yao
@ 2017-12-05 13:56 ` Arnaldo Carvalho de Melo
2017-12-05 14:02 ` Ganapatrao Kulkarni
2017-12-05 18:42 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 23+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-05 13:56 UTC (permalink / raw)
To: linux-arm-kernel
Em Tue, Dec 05, 2017 at 08:35:22PM +0800, Jin, Yao escreveu:
> A quick test with the new patch 'fix_json_v9_2.patch' shows it working.
Where is this fix_json_v9_2.patch file? I want to fold it with the patch
introducing the problem.
- Arnaldo
> See the log:
>
> root at skl:/tmp# perf stat --per-thread -p 10322 -M CPI,IPC
> ^C
> Performance counter stats for process id '10322':
>
> vmstat-10322 1,879,654 inst_retired.any #
> 0.8 CPI
> vmstat-10322 1,565,807 cycles
> vmstat-10322 1,879,654 inst_retired.any #
> 1.2 IPC
> vmstat-10322 1,565,807 cpu_clk_unhalted.thread
>
> 2.850291804 seconds time elapsed
>
> Thanks for fixing it quickly.
>
> Thanks
> Jin Yao
>
> On 12/5/2017 3:23 PM, Jin, Yao wrote:
> > Hi,
> >
> > I applied the diff but it's failed.
> >
> > jinyao at skl:~/skl-ws/perf-dev/lck-4594/src$ patch -p1 < 1.pat
> > patching file tools/perf/util/pmu.c
> > patch: **** malformed patch at line 41: *head, struct perf_pmu *pmu)
> >
> > Could you send the patch as attachment to me in another mail thread?
> >
> > to yao.jin at linux.intel.com
> > cc yao.jin at intel.com
> >
> > Thanks
> > Jin Yao
> >
> > On 12/5/2017 3:12 PM, Ganapatrao Kulkarni wrote:
> > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> > > index 5ad8a18..57e38fd 100644
> > > --- a/tools/perf/util/pmu.c
> > > +++ b/tools/perf/util/pmu.c
> > > @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
> > > ? }
> > >
> > > ? /*
> > > + *? PMU CORE devices have different name other than cpu in sysfs on some
> > > + *? platforms. looking for possible sysfs files to identify as core
> > > device.
> > > + */
> > > +static int is_pmu_core(const char *name)
> > > +{
> > > + struct stat st;
> > > + char path[PATH_MAX];
> > > + const char *sysfs = sysfs__mountpoint();
> > > +
> > > + if (!sysfs)
> > > + return 0;
> > > +
> > > + /* Look for cpu sysfs (x86 and others) */
> > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
> > > + if ((stat(path, &st) == 0) &&
> > > + (strncmp(name, "cpu", strlen("cpu")) == 0))
> > > + return 1;
> > > +
> > > + /* Look for cpu sysfs (specific to arm) */
> > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
> > > + sysfs, name);
> > > + if (stat(path, &st) == 0)
> > > + return 1;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +/*
> > > ?? * Return the CPU id as a raw string.
> > > ?? *
> > > ?? * Each architecture should provide a more precise id string that
> > > @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
> > > *head, struct perf_pmu *pmu)
> > > ?? break;
> > > ?? }
> > >
> > > - if (pmu->is_uncore) {
> > > + if (!is_pmu_core(name)) {
> > > ?? /* check for uncore devices */
> > > ?? if (pe->pmu == NULL)
> > > ?? continue;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 7:12 ` Ganapatrao Kulkarni
2017-12-05 7:23 ` Jin, Yao
@ 2017-12-05 13:58 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 23+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-05 13:58 UTC (permalink / raw)
To: linux-arm-kernel
Em Tue, Dec 05, 2017 at 12:42:30PM +0530, Ganapatrao Kulkarni escreveu:
> thanks Jin Yao for point this out.
>
> looks like logic of leveraging uncore device type(which i have changed
> in v9) does not go well
> with some json events of x86.
> can you please try below diff(logic used till v8), which keeps the
> original logic of identifying core/cpu PMUs.
This seems space mangled :-\
- Arnaldo
>
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 5ad8a18..57e38fd 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
> }
>
> /*
> + * PMU CORE devices have different name other than cpu in sysfs on some
> + * platforms. looking for possible sysfs files to identify as core device.
> + */
> +static int is_pmu_core(const char *name)
> +{
> + struct stat st;
> + char path[PATH_MAX];
> + const char *sysfs = sysfs__mountpoint();
> +
> + if (!sysfs)
> + return 0;
> +
> + /* Look for cpu sysfs (x86 and others) */
> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
> + if ((stat(path, &st) == 0) &&
> + (strncmp(name, "cpu", strlen("cpu")) == 0))
> + return 1;
> +
> + /* Look for cpu sysfs (specific to arm) */
> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
> + sysfs, name);
> + if (stat(path, &st) == 0)
> + return 1;
> +
> + return 0;
> +}
> +
> +/*
> * Return the CPU id as a raw string.
> *
> * Each architecture should provide a more precise id string that
> @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
> *head, struct perf_pmu *pmu)
> break;
> }
>
> - if (pmu->is_uncore) {
> + if (!is_pmu_core(name)) {
> /* check for uncore devices */
> if (pe->pmu == NULL)
> continue;
>
> i have tried this diff on my x86 PC(haswell) and looks to be ok.
> please confirm your testing on skylake.
>
> gkulkarni at gkFc25>perf>> ./perf stat --per-thread -p 12663 -M CPI,IPC sleep 1
>
> Performance counter stats for process id '12663':
>
> bash-12663 278,886 inst_retired.any:u
> bash-12663 482,284 cycles:u
> bash-12663 278,886 inst_retired.any:u
> bash-12663 483,597
> cpu_clk_unhalted.thread:u
>
> 1.000923760 seconds time elapsed
>
>
> On Tue, Dec 5, 2017 at 7:42 AM, Jin, Yao <yao.jin@linux.intel.com> wrote:
> > Hi Kulkarni, Arnaldo,
> >
> > This patch has been merged in perf/core branch today.
> >
> > But I see a regression issue when I run the 'perf stat'.
> >
> > With bisect checking, I locate to this patch.
> >
> > commit ad8737a08973f5dca632bdd63cf2abc99670e540
> > Author: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
> > Date: Tue Oct 17 00:02:20 2017 +0530
> >
> > perf pmu: Use pmu->is_uncore to detect UNCORE devices
> >
> > For example (on Intel skylake desktop),
> >
> > 1. The correct output should be (without this patch):
> >
> > root at skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC
> > ^C
> > Performance counter stats for process id '1754':
> >
> > vmstat-1754 1,882,798 inst_retired.any #
> > 0.8 CPI
> > vmstat-1754 1,589,720 cycles
> > vmstat-1754 1,882,798 inst_retired.any #
> > 1.2 IPC
> > vmstat-1754 1,589,720 cpu_clk_unhalted.thread
> >
> > 2.647443167 seconds time elapsed
> >
> > 2. With this patch, the output will be:
> >
> > root at skl:/tmp# perf stat --per-thread -p 1754 -M CPI,IPC
> > ^C
> > Performance counter stats for process id '1754':
> >
> > vmstat-1754 1,945,589 inst_retired.any
> > vmstat-1754 <not supported> inst_retired.any
> > vmstat-1754 1,609,892 cycles
> > vmstat-1754 1,945,589 inst_retired.any
> > vmstat-1754 <not supported> inst_retired.any
> > vmstat-1754 1,609,892 cpu_clk_unhalted.thread
> > vmstat-1754 <not supported> cpu_clk_unhalted.thread
> >
> > 3.051274166 seconds time elapsed
> >
> > Could you please help to take a look?
> >
> > Thanks
> > Jin Yao
> >
> >
> > On 10/17/2017 2:32 AM, Ganapatrao Kulkarni wrote:
> >>
> >> PMU CORE devices are identified using sysfs filename cpu, however
> >> on some platforms(like arm/arm64), PMU CORE sysfs name is not cpu.
> >> Hence cpu cannot be used to differentiate PMU CORE/UNCORE devices.
> >>
> >> commit:
> >> 66ec1191 ("perf pmu: Unbreak perf record for arm/arm64 with events with
> >> explicit PMU")
> >>
> >> has introduced pmu->is_uncore, which is set to PMU UNCORE devices only.
> >> Adding changes to use pmu->is_uncore to identify UNCORE devices.
> >>
> >> Acked-by: Will Deacon <will.deacon@arm.com>
> >> Tested-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> >> Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
> >> ---
> >> tools/perf/util/pmu.c | 11 +++++++----
> >> 1 file changed, 7 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> >> index 8b17db5..9110718 100644
> >> --- a/tools/perf/util/pmu.c
> >> +++ b/tools/perf/util/pmu.c
> >> @@ -603,7 +603,6 @@ static void pmu_add_cpu_aliases(struct list_head
> >> *head, struct perf_pmu *pmu)
> >> */
> >> i = 0;
> >> while (1) {
> >> - const char *pname;
> >> pe = &map->table[i++];
> >> if (!pe->name) {
> >> @@ -612,9 +611,13 @@ static void pmu_add_cpu_aliases(struct list_head
> >> *head, struct perf_pmu *pmu)
> >> break;
> >> }
> >> - pname = pe->pmu ? pe->pmu : "cpu";
> >> - if (strncmp(pname, name, strlen(pname)))
> >> - continue;
> >> + if (pmu->is_uncore) {
> >> + /* check for uncore devices */
> >> + if (pe->pmu == NULL)
> >> + continue;
> >> + if (strncmp(pe->pmu, name, strlen(pe->pmu)))
> >> + continue;
> >> + }
> >> /* need type casts to override 'const' */
> >> __perf_pmu__new_alias(head, NULL, (char *)pe->name,
> >>
> >
>
> thanks
> Ganapat
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 13:56 ` Arnaldo Carvalho de Melo
@ 2017-12-05 14:02 ` Ganapatrao Kulkarni
0 siblings, 0 replies; 23+ messages in thread
From: Ganapatrao Kulkarni @ 2017-12-05 14:02 UTC (permalink / raw)
To: linux-arm-kernel
Hi Arnaldo,
On Tue, Dec 5, 2017 at 7:26 PM, Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
> Em Tue, Dec 05, 2017 at 08:35:22PM +0800, Jin, Yao escreveu:
>> A quick test with the new patch 'fix_json_v9_2.patch' shows it working.
>
> Where is this fix_json_v9_2.patch file? I want to fold it with the patch
> introducing the problem.
I will send you formal patch ASAP.
thanks
Ganapat
>
> - Arnaldo
>
>> See the log:
>>
>> root at skl:/tmp# perf stat --per-thread -p 10322 -M CPI,IPC
>> ^C
>> Performance counter stats for process id '10322':
>>
>> vmstat-10322 1,879,654 inst_retired.any #
>> 0.8 CPI
>> vmstat-10322 1,565,807 cycles
>> vmstat-10322 1,879,654 inst_retired.any #
>> 1.2 IPC
>> vmstat-10322 1,565,807 cpu_clk_unhalted.thread
>>
>> 2.850291804 seconds time elapsed
>>
>> Thanks for fixing it quickly.
>>
>> Thanks
>> Jin Yao
>>
>> On 12/5/2017 3:23 PM, Jin, Yao wrote:
>> > Hi,
>> >
>> > I applied the diff but it's failed.
>> >
>> > jinyao at skl:~/skl-ws/perf-dev/lck-4594/src$ patch -p1 < 1.pat
>> > patching file tools/perf/util/pmu.c
>> > patch: **** malformed patch at line 41: *head, struct perf_pmu *pmu)
>> >
>> > Could you send the patch as attachment to me in another mail thread?
>> >
>> > to yao.jin at linux.intel.com
>> > cc yao.jin at intel.com
>> >
>> > Thanks
>> > Jin Yao
>> >
>> > On 12/5/2017 3:12 PM, Ganapatrao Kulkarni wrote:
>> > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>> > > index 5ad8a18..57e38fd 100644
>> > > --- a/tools/perf/util/pmu.c
>> > > +++ b/tools/perf/util/pmu.c
>> > > @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
>> > > }
>> > >
>> > > /*
>> > > + * PMU CORE devices have different name other than cpu in sysfs on some
>> > > + * platforms. looking for possible sysfs files to identify as core
>> > > device.
>> > > + */
>> > > +static int is_pmu_core(const char *name)
>> > > +{
>> > > + struct stat st;
>> > > + char path[PATH_MAX];
>> > > + const char *sysfs = sysfs__mountpoint();
>> > > +
>> > > + if (!sysfs)
>> > > + return 0;
>> > > +
>> > > + /* Look for cpu sysfs (x86 and others) */
>> > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
>> > > + if ((stat(path, &st) == 0) &&
>> > > + (strncmp(name, "cpu", strlen("cpu")) == 0))
>> > > + return 1;
>> > > +
>> > > + /* Look for cpu sysfs (specific to arm) */
>> > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
>> > > + sysfs, name);
>> > > + if (stat(path, &st) == 0)
>> > > + return 1;
>> > > +
>> > > + return 0;
>> > > +}
>> > > +
>> > > +/*
>> > > * Return the CPU id as a raw string.
>> > > *
>> > > * Each architecture should provide a more precise id string that
>> > > @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
>> > > *head, struct perf_pmu *pmu)
>> > > break;
>> > > }
>> > >
>> > > - if (pmu->is_uncore) {
>> > > + if (!is_pmu_core(name)) {
>> > > /* check for uncore devices */
>> > > if (pe->pmu == NULL)
>> > > continue;
thanks
Ganapat
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 12:35 ` Jin, Yao
2017-12-05 13:56 ` Arnaldo Carvalho de Melo
@ 2017-12-05 18:42 ` Arnaldo Carvalho de Melo
2017-12-06 0:30 ` Jin, Yao
1 sibling, 1 reply; 23+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-05 18:42 UTC (permalink / raw)
To: linux-arm-kernel
Em Tue, Dec 05, 2017 at 08:35:22PM +0800, Jin, Yao escreveu:
> A quick test with the new patch 'fix_json_v9_2.patch' shows it working.
I'll take this as a Tested-by: you, ok?
> See the log:
>
> root at skl:/tmp# perf stat --per-thread -p 10322 -M CPI,IPC
> ^C
> Performance counter stats for process id '10322':
>
> vmstat-10322 1,879,654 inst_retired.any #
> 0.8 CPI
> vmstat-10322 1,565,807 cycles
> vmstat-10322 1,879,654 inst_retired.any #
> 1.2 IPC
> vmstat-10322 1,565,807 cpu_clk_unhalted.thread
>
> 2.850291804 seconds time elapsed
>
> Thanks for fixing it quickly.
>
> Thanks
> Jin Yao
>
> On 12/5/2017 3:23 PM, Jin, Yao wrote:
> > Hi,
> >
> > I applied the diff but it's failed.
> >
> > jinyao at skl:~/skl-ws/perf-dev/lck-4594/src$ patch -p1 < 1.pat
> > patching file tools/perf/util/pmu.c
> > patch: **** malformed patch at line 41: *head, struct perf_pmu *pmu)
> >
> > Could you send the patch as attachment to me in another mail thread?
> >
> > to yao.jin at linux.intel.com
> > cc yao.jin at intel.com
> >
> > Thanks
> > Jin Yao
> >
> > On 12/5/2017 3:12 PM, Ganapatrao Kulkarni wrote:
> > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> > > index 5ad8a18..57e38fd 100644
> > > --- a/tools/perf/util/pmu.c
> > > +++ b/tools/perf/util/pmu.c
> > > @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
> > > ? }
> > >
> > > ? /*
> > > + *? PMU CORE devices have different name other than cpu in sysfs on some
> > > + *? platforms. looking for possible sysfs files to identify as core
> > > device.
> > > + */
> > > +static int is_pmu_core(const char *name)
> > > +{
> > > + struct stat st;
> > > + char path[PATH_MAX];
> > > + const char *sysfs = sysfs__mountpoint();
> > > +
> > > + if (!sysfs)
> > > + return 0;
> > > +
> > > + /* Look for cpu sysfs (x86 and others) */
> > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
> > > + if ((stat(path, &st) == 0) &&
> > > + (strncmp(name, "cpu", strlen("cpu")) == 0))
> > > + return 1;
> > > +
> > > + /* Look for cpu sysfs (specific to arm) */
> > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
> > > + sysfs, name);
> > > + if (stat(path, &st) == 0)
> > > + return 1;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +/*
> > > ?? * Return the CPU id as a raw string.
> > > ?? *
> > > ?? * Each architecture should provide a more precise id string that
> > > @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
> > > *head, struct perf_pmu *pmu)
> > > ?? break;
> > > ?? }
> > >
> > > - if (pmu->is_uncore) {
> > > + if (!is_pmu_core(name)) {
> > > ?? /* check for uncore devices */
> > > ?? if (pe->pmu == NULL)
> > > ?? continue;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-05 18:42 ` Arnaldo Carvalho de Melo
@ 2017-12-06 0:30 ` Jin, Yao
2017-12-06 13:47 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 23+ messages in thread
From: Jin, Yao @ 2017-12-06 0:30 UTC (permalink / raw)
To: linux-arm-kernel
On 12/6/2017 2:42 AM, Arnaldo Carvalho de Melo wrote:
> Em Tue, Dec 05, 2017 at 08:35:22PM +0800, Jin, Yao escreveu:
>> A quick test with the new patch 'fix_json_v9_2.patch' shows it working.
>
> I'll take this as a Tested-by: you, ok?
>
Hi Arnaldo,
I didn't do a full test for this patch and for the whole patch series.
I just do a quick test and it shows that the regression issue which was
found in 'perf stat --per-thread' test case is disappear.
If you think it's enough for adding Tested-by, that's fine for me. :)
Thanks
Jin Yao
>> See the log:
>>
>> root at skl:/tmp# perf stat --per-thread -p 10322 -M CPI,IPC
>> ^C
>> Performance counter stats for process id '10322':
>>
>> vmstat-10322 1,879,654 inst_retired.any #
>> 0.8 CPI
>> vmstat-10322 1,565,807 cycles
>> vmstat-10322 1,879,654 inst_retired.any #
>> 1.2 IPC
>> vmstat-10322 1,565,807 cpu_clk_unhalted.thread
>>
>> 2.850291804 seconds time elapsed
>>
>> Thanks for fixing it quickly.
>>
>> Thanks
>> Jin Yao
>>
>> On 12/5/2017 3:23 PM, Jin, Yao wrote:
>>> Hi,
>>>
>>> I applied the diff but it's failed.
>>>
>>> jinyao at skl:~/skl-ws/perf-dev/lck-4594/src$ patch -p1 < 1.pat
>>> patching file tools/perf/util/pmu.c
>>> patch: **** malformed patch at line 41: *head, struct perf_pmu *pmu)
>>>
>>> Could you send the patch as attachment to me in another mail thread?
>>>
>>> to yao.jin at linux.intel.com
>>> cc yao.jin at intel.com
>>>
>>> Thanks
>>> Jin Yao
>>>
>>> On 12/5/2017 3:12 PM, Ganapatrao Kulkarni wrote:
>>>> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
>>>> index 5ad8a18..57e38fd 100644
>>>> --- a/tools/perf/util/pmu.c
>>>> +++ b/tools/perf/util/pmu.c
>>>> @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
>>>> ? }
>>>>
>>>> ? /*
>>>> + *? PMU CORE devices have different name other than cpu in sysfs on some
>>>> + *? platforms. looking for possible sysfs files to identify as core
>>>> device.
>>>> + */
>>>> +static int is_pmu_core(const char *name)
>>>> +{
>>>> + struct stat st;
>>>> + char path[PATH_MAX];
>>>> + const char *sysfs = sysfs__mountpoint();
>>>> +
>>>> + if (!sysfs)
>>>> + return 0;
>>>> +
>>>> + /* Look for cpu sysfs (x86 and others) */
>>>> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
>>>> + if ((stat(path, &st) == 0) &&
>>>> + (strncmp(name, "cpu", strlen("cpu")) == 0))
>>>> + return 1;
>>>> +
>>>> + /* Look for cpu sysfs (specific to arm) */
>>>> + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
>>>> + sysfs, name);
>>>> + if (stat(path, &st) == 0)
>>>> + return 1;
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +/*
>>>> ?? * Return the CPU id as a raw string.
>>>> ?? *
>>>> ?? * Each architecture should provide a more precise id string that
>>>> @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
>>>> *head, struct perf_pmu *pmu)
>>>> ?? break;
>>>> ?? }
>>>>
>>>> - if (pmu->is_uncore) {
>>>> + if (!is_pmu_core(name)) {
>>>> ?? /* check for uncore devices */
>>>> ?? if (pe->pmu == NULL)
>>>> ?? continue;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-06 0:30 ` Jin, Yao
@ 2017-12-06 13:47 ` Arnaldo Carvalho de Melo
2017-12-07 0:49 ` Jin, Yao
0 siblings, 1 reply; 23+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-06 13:47 UTC (permalink / raw)
To: linux-arm-kernel
Em Wed, Dec 06, 2017 at 08:30:37AM +0800, Jin, Yao escreveu:
>
>
> On 12/6/2017 2:42 AM, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Dec 05, 2017 at 08:35:22PM +0800, Jin, Yao escreveu:
> > > A quick test with the new patch 'fix_json_v9_2.patch' shows it working.
> >
> > I'll take this as a Tested-by: you, ok?
>
> Hi Arnaldo,
>
> I didn't do a full test for this patch and for the whole patch series.
>
> I just do a quick test and it shows that the regression issue which was
> found in 'perf stat --per-thread' test case is disappear.
>
> If you think it's enough for adding Tested-by, that's fine for me. :)
I guess this addresses at least your previous regression report, so I
think it is warranted, thanks!
- arnaldo
> Thanks
> Jin Yao
>
> > > See the log:
> > >
> > > root at skl:/tmp# perf stat --per-thread -p 10322 -M CPI,IPC
> > > ^C
> > > Performance counter stats for process id '10322':
> > >
> > > vmstat-10322 1,879,654 inst_retired.any #
> > > 0.8 CPI
> > > vmstat-10322 1,565,807 cycles
> > > vmstat-10322 1,879,654 inst_retired.any #
> > > 1.2 IPC
> > > vmstat-10322 1,565,807 cpu_clk_unhalted.thread
> > >
> > > 2.850291804 seconds time elapsed
> > >
> > > Thanks for fixing it quickly.
> > >
> > > Thanks
> > > Jin Yao
> > >
> > > On 12/5/2017 3:23 PM, Jin, Yao wrote:
> > > > Hi,
> > > >
> > > > I applied the diff but it's failed.
> > > >
> > > > jinyao at skl:~/skl-ws/perf-dev/lck-4594/src$ patch -p1 < 1.pat
> > > > patching file tools/perf/util/pmu.c
> > > > patch: **** malformed patch at line 41: *head, struct perf_pmu *pmu)
> > > >
> > > > Could you send the patch as attachment to me in another mail thread?
> > > >
> > > > to yao.jin at linux.intel.com
> > > > cc yao.jin at intel.com
> > > >
> > > > Thanks
> > > > Jin Yao
> > > >
> > > > On 12/5/2017 3:12 PM, Ganapatrao Kulkarni wrote:
> > > > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> > > > > index 5ad8a18..57e38fd 100644
> > > > > --- a/tools/perf/util/pmu.c
> > > > > +++ b/tools/perf/util/pmu.c
> > > > > @@ -538,6 +538,34 @@ static bool pmu_is_uncore(const char *name)
> > > > > ? }
> > > > >
> > > > > ? /*
> > > > > + *? PMU CORE devices have different name other than cpu in sysfs on some
> > > > > + *? platforms. looking for possible sysfs files to identify as core
> > > > > device.
> > > > > + */
> > > > > +static int is_pmu_core(const char *name)
> > > > > +{
> > > > > + struct stat st;
> > > > > + char path[PATH_MAX];
> > > > > + const char *sysfs = sysfs__mountpoint();
> > > > > +
> > > > > + if (!sysfs)
> > > > > + return 0;
> > > > > +
> > > > > + /* Look for cpu sysfs (x86 and others) */
> > > > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
> > > > > + if ((stat(path, &st) == 0) &&
> > > > > + (strncmp(name, "cpu", strlen("cpu")) == 0))
> > > > > + return 1;
> > > > > +
> > > > > + /* Look for cpu sysfs (specific to arm) */
> > > > > + scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
> > > > > + sysfs, name);
> > > > > + if (stat(path, &st) == 0)
> > > > > + return 1;
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > > > +
> > > > > +/*
> > > > > ?? * Return the CPU id as a raw string.
> > > > > ?? *
> > > > > ?? * Each architecture should provide a more precise id string that
> > > > > @@ -641,7 +669,7 @@ static void pmu_add_cpu_aliases(struct list_head
> > > > > *head, struct perf_pmu *pmu)
> > > > > ?? break;
> > > > > ?? }
> > > > >
> > > > > - if (pmu->is_uncore) {
> > > > > + if (!is_pmu_core(name)) {
> > > > > ?? /* check for uncore devices */
> > > > > ?? if (pe->pmu == NULL)
> > > > > ?? continue;
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices
2017-12-06 13:47 ` Arnaldo Carvalho de Melo
@ 2017-12-07 0:49 ` Jin, Yao
0 siblings, 0 replies; 23+ messages in thread
From: Jin, Yao @ 2017-12-07 0:49 UTC (permalink / raw)
To: linux-arm-kernel
On 12/6/2017 9:47 PM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Dec 06, 2017 at 08:30:37AM +0800, Jin, Yao escreveu:
>>
>>
>> On 12/6/2017 2:42 AM, Arnaldo Carvalho de Melo wrote:
>>> Em Tue, Dec 05, 2017 at 08:35:22PM +0800, Jin, Yao escreveu:
>>>> A quick test with the new patch 'fix_json_v9_2.patch' shows it working.
>>>
>>> I'll take this as a Tested-by: you, ok?
>>
>> Hi Arnaldo,
>>
>> I didn't do a full test for this patch and for the whole patch series.
>>
>> I just do a quick test and it shows that the regression issue which was
>> found in 'perf stat --per-thread' test case is disappear.
>>
>> If you think it's enough for adding Tested-by, that's fine for me. :)
>
> I guess this addresses at least your previous regression report, so I
> think it is warranted, thanks!
>
> - arnaldo
>
That's fine, thanks!
Thanks
Jin Yao
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2017-12-07 0:49 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 18:32 [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 1/5] perf utils: passing pmu as a parameter to function get_cpuid_str Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 2/5] perf tools arm64: Add support for get_cpuid_str function Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 3/5] perf utils: use pmu->is_uncore to detect PMU UNCORE devices Ganapatrao Kulkarni
2017-12-05 2:12 ` Jin, Yao
2017-12-05 7:12 ` Ganapatrao Kulkarni
2017-12-05 7:23 ` Jin, Yao
2017-12-05 12:35 ` Jin, Yao
2017-12-05 13:56 ` Arnaldo Carvalho de Melo
2017-12-05 14:02 ` Ganapatrao Kulkarni
2017-12-05 18:42 ` Arnaldo Carvalho de Melo
2017-12-06 0:30 ` Jin, Yao
2017-12-06 13:47 ` Arnaldo Carvalho de Melo
2017-12-07 0:49 ` Jin, Yao
2017-12-05 13:58 ` Arnaldo Carvalho de Melo
2017-10-16 18:32 ` [PATCH v9 4/5] perf vendor events arm64: Add ThunderX2 implementation defined pmu core events Ganapatrao Kulkarni
2017-10-16 18:32 ` [PATCH v9 5/5] perf utils: add check for valid cpuid in function perf_pmu__find_map Ganapatrao Kulkarni
2017-10-18 17:49 ` [PATCH v9 0/5] Add support for ThunderX2 pmu events using json files Ganapatrao Kulkarni
2017-11-06 9:01 ` John Garry
2017-11-07 1:23 ` Will Deacon
2017-11-27 10:04 ` John Garry
2017-12-04 4:41 ` Ganapatrao Kulkarni
2017-12-04 15:09 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).