mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: He Kuang <hekuang@huawei.com>,
	ast@plumgrid.com, davem@davemloft.net, acme@kernel.org,
	mingo@redhat.com, a.p.zijlstra@chello.nl, jolsa@kernel.org
Cc: wangnan0@huawei.com, lizefan@kernel.org,
	linux-kernel@vger.kernel.org, pi3orama@163.com
Subject: Re: [RFC PATCH 2/6] perf bpf: Add pt_regs convert table for x86
Date: Fri, 08 May 2015 17:02:25 +0900	[thread overview]
Message-ID: <554C6D91.9020009@hitachi.com> (raw)
In-Reply-To: <1430820612-84443-3-git-send-email-hekuang@huawei.com>

On 2015/05/05 19:10, He Kuang wrote:
> Convert register number in debuginfo to its index in pt_regs.
> 

This seems better introduced after 3/6, since 3/6 is generic
framework. Without 3/6, this can't do anything.

> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
>  tools/perf/arch/x86/util/dwarf-regs.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c
> index be22dd4..e586a47 100644
> --- a/tools/perf/arch/x86/util/dwarf-regs.c
> +++ b/tools/perf/arch/x86/util/dwarf-regs.c
> @@ -59,10 +59,31 @@ const char *x86_64_regs_table[X86_64_MAX_REGS] = {
>  	"%r15",
>  };
>  
> +const char x86_64_pt_regs_table[X86_64_MAX_REGS] = {
> +	10,
> +	12,
> +	11,
> +	5,
> +	13,
> +	14,
> +	4,
> +	19,
> +	9,
> +	8,
> +	7,
> +	6,
> +	3,
> +	2,
> +	1,
> +	0,
> +};
> +
>  /* TODO: switching by dwarf address size */
>  #ifdef __x86_64__
>  #define ARCH_MAX_REGS X86_64_MAX_REGS
>  #define arch_regs_table x86_64_regs_table
> +#define arch_pt_regs_table x86_64_pt_regs_table
> +#define arch_pt_regs_type unsigned long

If you need to use this as a type, please use typedef in arch header.

>  #else
>  #define ARCH_MAX_REGS X86_32_MAX_REGS
>  #define arch_regs_table x86_32_regs_table
> @@ -73,3 +94,13 @@ const char *get_arch_regstr(unsigned int n)
>  {
>  	return (n <= ARCH_MAX_REGS) ? arch_regs_table[n] : NULL;
>  }
> +
> +char get_arch_pt_regs(unsigned int n)

Returning char is meaningless. Also this seems returning an index or
offset of pt_regs. If so, get_arch_regoffs() will be better name.

> +{
> +	return (n <= ARCH_MAX_REGS) ? arch_pt_regs_table[n] : -1;
> +}
> +
> +int get_arch_pt_regs_size(void)
> +{
> +	return sizeof(arch_pt_regs_type);
> +}

No, don't do that, since this always returns same value.

Thank you,

-- 
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: masami.hiramatsu.pt@hitachi.com

  parent reply	other threads:[~2015-05-08  8:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 10:10 [RFC PATCH 0/6] perf bpf: Probing with local variable He Kuang
2015-05-05 10:10 ` [RFC PATCH 1/6] perf bpf: Add headers for generate bpf bytecode He Kuang
2015-05-05 22:38   ` Alexei Starovoitov
2015-05-05 10:10 ` [RFC PATCH 2/6] perf bpf: Add pt_regs convert table for x86 He Kuang
2015-05-05 22:44   ` Alexei Starovoitov
2015-05-08  8:02   ` Masami Hiramatsu [this message]
2015-05-05 10:10 ` [RFC PATCH 3/6] perf bpf: Save pt_regs info from debuginfo He Kuang
2015-05-05 10:10 ` [RFC PATCH 4/6] perf bpf: Convert arglist to bpf prologue He Kuang
2015-05-05 22:54   ` Alexei Starovoitov
2015-05-05 10:10 ` [RFC PATCH 5/6] perf bpf: Process debuginfo for generating " He Kuang
2015-05-05 10:10 ` [RFC PATCH 6/6] perf bpf: Generate bpf prologue for arguments He Kuang
2015-05-05 22:31 ` [RFC PATCH 0/6] perf bpf: Probing with local variable Alexei Starovoitov
2015-05-06  3:58   ` Wang Nan
2015-05-06  4:10     ` Alexei Starovoitov
2015-05-06  4:41       ` Wang Nan
2015-05-06  1:37 ` Masami Hiramatsu
2015-05-06  1:44   ` Arnaldo Carvalho de Melo

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=554C6D91.9020009@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ast@plumgrid.com \
    --cc=davem@davemloft.net \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome