linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krister Johansen <kjlx@templeofstupid.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
	Krister Johansen <kjlx@templeofstupid.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Michael Petlan <mpetlan@redhat.com>,
	David Reaver <me@davidreaver.com>
Subject: Re: [PATCH v2] perf/util: Symbol lookup with kcore can fail if multiple segments match stext
Date: Mon, 20 Feb 2023 09:16:08 -0800	[thread overview]
Message-ID: <20230220171608.GA1993@templeofstupid.com> (raw)
In-Reply-To: <Y9sLQ1Iy5LJAaJ8L@kernel.org>

On Wed, Feb 01, 2023 at 10:00:51PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Jan 30, 2023 at 03:29:54PM +0200, Adrian Hunter escreveu:
> > On 25/01/23 20:34, Krister Johansen wrote:
> > > This problem was encountered on an arm64 system with a lot of memory.
> > > Without kernel debug symbols installed, and with both kcore and kallsyms
> > > available, perf managed to get confused and returned "unknown" for all
> > > of the kernel symbols that it tried to look up.
> > > 
> > > On this system, stext fell within the vmalloc segment.  The kcore symbol
> > > matching code tries to find the first segment that contains stext and
> > > uses that to replace the segment generated from just the kallsyms
> > > information.  In this case, however, there were two: a very large
> > > vmalloc segment, and the text segment.  This caused perf to get confused
> > > because multiple overlapping segments were inserted into the RB tree
> > > that holds the discovered segments.  However, that alone wasn't
> > > sufficient to cause the problem. Even when we could find the segment,
> > > the offsets were adjusted in such a way that the newly generated symbols
> > > didn't line up with the instruction addresses in the trace.  The most
> > > obvious solution would be to consult which segment type is text from
> > > kcore, but this information is not exposed to users.
> > > 
> > > Instead, select the smallest matching segment that contains stext
> > > instead of the first matching segment.  This allows us to match the text
> > > segment instead of vmalloc, if one is contained within the other.
> > > 
> > > Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
> > 
> > Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
> 
> Thanks, applied.

Thanks, Arnaldo.  If it's not too late, would you be willing to tag this
one as:

Fixes: 5654997838c2 ("perf tools: Use the "_stest" symbol to identify the kernel map when loading kcore")
Cc: <stable@vger.kernel.org>

So that it makes it to the right stable branches?  I meant to do this
prior to sending it along.

-K

      reply	other threads:[~2023-02-20 17:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 22:35 [PATCH] perf/util: Symbol lookup can fail if multiple segmets match stext Krister Johansen
2023-01-25  7:29 ` Adrian Hunter
2023-01-25  7:37   ` Adrian Hunter
2023-01-25 18:32     ` Krister Johansen
2023-01-25 18:34 ` [PATCH v2] perf/util: Symbol lookup with kcore can fail if multiple segments " Krister Johansen
2023-01-30 13:29   ` Adrian Hunter
2023-02-02  1:00     ` Arnaldo Carvalho de Melo
2023-02-20 17:16       ` Krister Johansen [this message]

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=20230220171608.GA1993@templeofstupid.com \
    --to=kjlx@templeofstupid.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=me@davidreaver.com \
    --cc=mingo@redhat.com \
    --cc=mpetlan@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).