From: Ian Rogers <irogers@google.com>
To: "John Garry" <john.garry@huawei.com>,
"Will Deacon" <will@kernel.org>,
"Mathieu Poirier" <mathieu.poirier@linaro.org>,
"Leo Yan" <leo.yan@linaro.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"James Clark" <james.clark@arm.com>,
"Alexandre Truong" <alexandre.truong@arm.com>,
"German Gomez" <german.gomez@arm.com>,
"Ian Rogers" <irogers@google.com>,
"Dave Marchevsky" <davemarchevsky@fb.com>,
"Song Liu" <songliubraving@fb.com>,
"Ravi Bangoria" <ravi.bangoria@amd.com>,
"Li Huafei" <lihuafei1@huawei.com>,
"Martin Liška" <mliska@suse.cz>,
"William Cohen" <wcohen@redhat.com>,
"Riccardo Mancini" <rickyman7@gmail.com>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Thomas Richter" <tmricht@linux.ibm.com>,
"Lexi Shao" <shaolexi@huawei.com>,
"Remi Bernon" <rbernon@codeweavers.com>,
"Michael Petlan" <mpetlan@redhat.com>,
"Denis Nikitin" <denik@chromium.org>,
linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Stephane Eranian <eranian@google.com>
Subject: [PATCH 2/5] perf symbols: Always do architecture specific fixups
Date: Thu, 7 Apr 2022 16:05:00 -0700 [thread overview]
Message-ID: <20220407230503.1265036-3-irogers@google.com> (raw)
In-Reply-To: <20220407230503.1265036-1-irogers@google.com>
The change:
https://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com/
modified the condition for architecture specific fixups motivated by a
PowerPC case. So that architectures can independently modify their
condition, move the if into the called architecture symbols__fixup_end
function and always call it.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/arch/arm64/util/machine.c | 14 ++++++++------
tools/perf/arch/powerpc/util/machine.c | 14 ++++++++------
tools/perf/arch/s390/util/machine.c | 14 ++++++++------
tools/perf/util/symbol.c | 6 +++---
4 files changed, 27 insertions(+), 21 deletions(-)
diff --git a/tools/perf/arch/arm64/util/machine.c b/tools/perf/arch/arm64/util/machine.c
index d2ce31e28cd7..1cc33b323c3f 100644
--- a/tools/perf/arch/arm64/util/machine.c
+++ b/tools/perf/arch/arm64/util/machine.c
@@ -20,13 +20,15 @@
void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
{
- if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
+ if (p->end == p->start || p->end != c->start) {
+ if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
(strchr(p->name, '[') == NULL && strchr(c->name, '[')))
- /* Limit range of last symbol in module and kernel */
- p->end += SYMBOL_LIMIT;
- else
- p->end = c->start;
- pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+ /* Limit range of last symbol in module and kernel */
+ p->end += SYMBOL_LIMIT;
+ else
+ p->end = c->start;
+ pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+ }
}
void arch__add_leaf_frame_record_opts(struct record_opts *opts)
diff --git a/tools/perf/arch/powerpc/util/machine.c b/tools/perf/arch/powerpc/util/machine.c
index e652a1aa8132..88a8abf98a57 100644
--- a/tools/perf/arch/powerpc/util/machine.c
+++ b/tools/perf/arch/powerpc/util/machine.c
@@ -16,10 +16,12 @@
void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
{
- if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
- /* Limit the range of last kernel symbol */
- p->end += page_size;
- else
- p->end = c->start;
- pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+ if (p->end == p->start || p->end != c->start) {
+ if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
+ /* Limit the range of last kernel symbol */
+ p->end += page_size;
+ else
+ p->end = c->start;
+ pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+ }
}
diff --git a/tools/perf/arch/s390/util/machine.c b/tools/perf/arch/s390/util/machine.c
index 7644a4f6d4a4..0b750738ec68 100644
--- a/tools/perf/arch/s390/util/machine.c
+++ b/tools/perf/arch/s390/util/machine.c
@@ -44,10 +44,12 @@ int arch__fix_module_text_start(u64 *start, u64 *size, const char *name)
*/
void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
{
- if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
- /* Last kernel symbol mapped to end of page */
- p->end = roundup(p->end, page_size);
- else
- p->end = c->start;
- pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+ if (p->end == p->start || p->end != c->start) {
+ if (strchr(p->name, '[') == NULL && strchr(c->name, '['))
+ /* Last kernel symbol mapped to end of page */
+ p->end = roundup(p->end, page_size);
+ else
+ p->end = c->start;
+ pr_debug4("%s sym:%s end:%#" PRIx64 "\n", __func__, p->name, p->end);
+ }
}
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index dea0fc495185..394ad493c343 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -103,7 +103,8 @@ static int prefix_underscores_count(const char *str)
void __weak arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
{
- p->end = c->start;
+ if (p->end == p->start || p->end != c->start)
+ p->end = c->start;
}
const char * __weak arch__normalize_symbol_name(const char *name)
@@ -231,8 +232,7 @@ void symbols__fixup_end(struct rb_root_cached *symbols)
prev = curr;
curr = rb_entry(nd, struct symbol, rb_node);
- if (prev->end == prev->start || prev->end != curr->start)
- arch__symbols__fixup_end(prev, curr);
+ arch__symbols__fixup_end(prev, curr);
}
/* Last entry */
--
2.35.1.1178.g4f1659d476-goog
next prev parent reply other threads:[~2022-04-07 23:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 23:04 [PATCH 0/5] Tidy up symbol end fixup Ian Rogers
2022-04-07 23:04 ` [PATCH 1/5] perf annotate: Drop objdump stderr Ian Rogers
2022-04-09 15:44 ` Arnaldo Carvalho de Melo
2022-04-07 23:05 ` Ian Rogers [this message]
2022-04-07 23:05 ` [PATCH 3/5] perf symbols: Add is_kernel argument to fixup end Ian Rogers
2022-04-12 7:58 ` [perf symbols] 309f68878e: perf-sanity-tests.perf.make_fail kernel test robot
2022-04-07 23:05 ` [PATCH 4/5] perf symbol: By default only fix zero length symbols Ian Rogers
2022-04-07 23:05 ` [PATCH 5/5] perf symbols: More specific architecture end fixing Ian Rogers
2022-04-08 17:15 ` [PATCH 0/5] Tidy up symbol end fixup Namhyung Kim
2022-04-08 23:52 ` Ian Rogers
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=20220407230503.1265036-3-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexandre.truong@arm.com \
--cc=davemarchevsky@fb.com \
--cc=denik@chromium.org \
--cc=eranian@google.com \
--cc=german.gomez@arm.com \
--cc=james.clark@arm.com \
--cc=john.garry@huawei.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@linaro.org \
--cc=lihuafei1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.poirier@linaro.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=mliska@suse.cz \
--cc=mpetlan@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=rbernon@codeweavers.com \
--cc=rickyman7@gmail.com \
--cc=shaolexi@huawei.com \
--cc=songliubraving@fb.com \
--cc=tmricht@linux.ibm.com \
--cc=wcohen@redhat.com \
--cc=will@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox