mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: "arc-linux-dev@synopsys.com" <arc-linux-dev@synopsys.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARC: make sure instruction_pointer() returns unsigned value
Date: Mon, 13 Jul 2015 08:05:59 +0000	[thread overview]
Message-ID: <C2D7FE5348E1B147BCA15975FBA23075665AD94D@IN01WEMBXB.internal.synopsys.com> (raw)
In-Reply-To: <1436772317-3785-1-git-send-email-abrodkin@synopsys.com>

On Monday 13 July 2015 12:55 PM, Alexey Brodkin wrote:
> Currently instruction_pointer() returns pt_regs->ret and so return value
> is of type "long", which implicitly stands for "signed long".
>
> While that's perfectly fine when dealing with 32-bit values if return
> value of instruction_pointer() gets assigned to 64-bit variable sign
> extension may happen.
>
> And at least in one real use-case it happens already.
> In perf_prepare_sample() return value of perf_instruction_pointer()
> (which is an alias to instruction_pointer() in case of ARC) is assigned
> to (struct perf_sample_data)->ip (which type is "u64").
>
> And what we see if instuction pointer points to user-space application
> that in case of ARC lays below 0x8000_0000 "ip" gets set properly with
> leading 32 zeros. But if instruction pointer points to kernel address
> space that starts from 0x8000_0000 then "ip" is set with 32 leadig
> "f"-s. I.e. id instruction_pointer() returns 0x8100_0000, "ip" will be
> assigned with 0xffff_ffff__8100_0000. Which is obviously wrong.
>
> In particular that issuse broke output of perf, because perf was unable
> to associate addresses like 0xffff_ffff__8100_0000 with anything from
> /proc/kallsyms.
>
> That's what we used to see:
>  ----------->8----------
>   6.27%  ls       [unknown]                [k] 0xffffffff8046c5cc
>   2.96%  ls       libuClibc-0.9.34-git.so  [.] memcpy
>   2.25%  ls       libuClibc-0.9.34-git.so  [.] memset
>   1.66%  ls       [unknown]                [k] 0xffffffff80666536
>   1.54%  ls       libuClibc-0.9.34-git.so  [.] 0x000224d6
>   1.18%  ls       libuClibc-0.9.34-git.so  [.] 0x00022472
>  ----------->8----------
>
> With that change perf output looks much better now:
>  ----------->8----------
>   8.21%  ls       [kernel.kallsyms]        [k] memset
>   3.52%  ls       libuClibc-0.9.34-git.so  [.] memcpy
>   2.11%  ls       libuClibc-0.9.34-git.so  [.] malloc
>   1.88%  ls       libuClibc-0.9.34-git.so  [.] memset
>   1.64%  ls       [kernel.kallsyms]        [k] _raw_spin_unlock_irqrestore
>   1.41%  ls       [kernel.kallsyms]        [k] __d_lookup_rcu
>  ----------->8----------
>
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>

Thx Alexey - this solves a long standing mystery with some weird perf profiles.

Applied !

Thx,
-Vineet

      reply	other threads:[~2015-07-13  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  7:25 Alexey Brodkin
2015-07-13  8:05 ` Vineet Gupta [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=C2D7FE5348E1B147BCA15975FBA23075665AD94D@IN01WEMBXB.internal.synopsys.com \
    --to=vineet.gupta1@synopsys.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=arc-linux-dev@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.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

all inboxes | Powered by JetHome®