From: tip-bot for John Garry <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: alexander.shishkin@linux.intel.com, acme@redhat.com,
zhangshaokun@hisilicon.com, tglx@linutronix.de,
john.garry@huawei.com, ganapatrao.kulkarni@cavium.com,
peterz@infradead.org, will.deacon@arm.com, wcohen@redhat.com,
linux-kernel@vger.kernel.org, hpa@zytor.com, namhyung@kernel.org,
ak@linux.intel.com, mingo@kernel.org, jolsa@kernel.org
Subject: [tip:perf/core] perf vendor events: Drop support for unused topic directories
Date: Mon, 19 Mar 2018 23:22:19 -0700 [thread overview]
Message-ID: <tip-6f2f2ca3454ec4fa03fcd4507bdd7fe97303065b@git.kernel.org> (raw)
In-Reply-To: <1520506716-197429-4-git-send-email-john.garry@huawei.com>
Commit-ID: 6f2f2ca3454ec4fa03fcd4507bdd7fe97303065b
Gitweb: https://git.kernel.org/tip/6f2f2ca3454ec4fa03fcd4507bdd7fe97303065b
Author: John Garry <john.garry@huawei.com>
AuthorDate: Thu, 8 Mar 2018 18:58:28 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 16 Mar 2018 13:54:09 -0300
perf vendor events: Drop support for unused topic directories
Currently a topic subdirectory is supported in the pmu-events dir, in
the following sample structure: /arch/platform/subtopic/mysubtopic.json
Upto 256 levels of topic subdirectories are supported. So this means
that JSONs may be located in a topic dir as well as the platform dir.
This topic subdirectory causes problems if we want to add support for a
vendor dir in the pmu-events structure (in the form
arch/platform/vendor), in that we cannot differentiate between a vendor
dir and a topic dir.
Since the topic dir feature is not used, drop it so it does not block
adding vendor subdirectory support.
Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: William Cohen <wcohen@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxarm@huawei.com
Link: http://lkml.kernel.org/r/1520506716-197429-4-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/pmu-events/jevents.c | 37 ++++++++++---------------------------
1 file changed, 10 insertions(+), 27 deletions(-)
diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c
index edff989fbcea..1d02fafdc34d 100644
--- a/tools/perf/pmu-events/jevents.c
+++ b/tools/perf/pmu-events/jevents.c
@@ -256,25 +256,18 @@ static const char *field_to_perf(struct map *table, char *map, jsmntok_t *val)
goto out_free; \
} } while (0)
-#define TOPIC_DEPTH 256
-static char *topic_array[TOPIC_DEPTH];
-static int topic_level;
+static char *topic;
static char *get_topic(void)
{
- char *tp_old, *tp = NULL;
+ char *tp;
int i;
- for (i = 0; i < topic_level + 1; i++) {
- int n;
-
- tp_old = tp;
- n = asprintf(&tp, "%s%s", tp ?: "", topic_array[i]);
- if (n < 0) {
- pr_info("%s: asprintf() error %s\n", prog);
- return NULL;
- }
- free(tp_old);
+ /* tp is free'd in process_one_file() */
+ i = asprintf(&tp, "%s", topic);
+ if (i < 0) {
+ pr_info("%s: asprintf() error %s\n", prog);
+ return NULL;
}
for (i = 0; i < (int) strlen(tp); i++) {
@@ -291,25 +284,15 @@ static char *get_topic(void)
return tp;
}
-static int add_topic(int level, char *bname)
+static int add_topic(char *bname)
{
- char *topic;
-
- level -= 2;
-
- if (level >= TOPIC_DEPTH)
- return -EINVAL;
-
+ free(topic);
topic = strdup(bname);
if (!topic) {
pr_info("%s: strdup() error %s for file %s\n", prog,
strerror(errno), bname);
return -ENOMEM;
}
-
- free(topic_array[topic_level]);
- topic_array[topic_level] = topic;
- topic_level = level;
return 0;
}
@@ -824,7 +807,7 @@ static int process_one_file(const char *fpath, const struct stat *sb,
}
}
- if (level > 1 && add_topic(level, bname))
+ if (level > 1 && add_topic(bname))
return -ENOMEM;
/*
next prev parent reply other threads:[~2018-03-20 6:23 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-08 10:58 [PATCH v3 00/11] perf events patches for improved ARM64 support John Garry
2018-03-08 10:58 ` John Garry
2018-03-08 10:58 ` [PATCH v3 01/11] perf vendor events: drop incomplete multiple mapfile support John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:21 ` [tip:perf/core] perf vendor events: Drop " tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 02/11] perf vendor events: fix error code in json_events() John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:21 ` [tip:perf/core] perf vendor events: Fix " tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 03/11] perf vendor events: drop support for unused topic directories John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:22 ` tip-bot for John Garry [this message]
2018-03-08 10:58 ` [PATCH v3 04/11] perf vendor events: add support for pmu events vendor subdirectory John Garry
2018-03-08 10:58 ` John Garry
2018-03-12 18:28 ` Arnaldo Carvalho de Melo
2018-03-12 18:28 ` Arnaldo Carvalho de Melo
2018-03-13 9:36 ` John Garry
2018-03-13 9:36 ` John Garry
2018-03-14 17:10 ` [PATCH] perf vendor events: fix processing for xfs John Garry
2018-03-14 17:42 ` Sukadev Bhattiprolu
2018-03-14 18:53 ` Arnaldo Carvalho de Melo
2018-03-14 19:39 ` John Garry
2018-03-14 20:26 ` Arnaldo Carvalho de Melo
2018-03-14 20:58 ` John Garry
2018-03-20 6:22 ` [tip:perf/core] perf vendor events: Add support for pmu events vendor subdirectory tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 05/11] perf vendor events arm64: Relocate ThunderX2 JSON to cavium subdirectory John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:23 ` [tip:perf/core] " tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 06/11] perf vendor events arm64: Relocate Cortex A53 JSONs to arm subdirectory John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:23 ` [tip:perf/core] " tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 07/11] perf vendor events: add support for arch standard events John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:24 ` [tip:perf/core] perf vendor events: Add " tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 08/11] perf vendor events arm64: add armv8-recommended.json John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:24 ` [tip:perf/core] perf vendor events arm64: Add armv8-recommended.json tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 09/11] perf vendor events arm64: fixup ThunderX2 to use recommended events John Garry
2018-03-08 10:58 ` John Garry
2018-03-09 14:36 ` Ganapatrao Kulkarni
2018-03-09 14:36 ` Ganapatrao Kulkarni
2018-03-20 6:25 ` [tip:perf/core] perf vendor events arm64: Fixup " tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 10/11] perf vendor events arm64: fixup A53 " John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:25 ` [tip:perf/core] " tip-bot for John Garry
2018-03-08 10:58 ` [PATCH v3 11/11] perf vendor events arm64: add HiSilicon hip08 JSON file John Garry
2018-03-08 10:58 ` John Garry
2018-03-20 6:26 ` [tip:perf/core] " tip-bot for John Garry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-6f2f2ca3454ec4fa03fcd4507bdd7fe97303065b@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ganapatrao.kulkarni@cavium.com \
--cc=hpa@zytor.com \
--cc=john.garry@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=wcohen@redhat.com \
--cc=will.deacon@arm.com \
--cc=zhangshaokun@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.