From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754775AbbIACJa (ORCPT ); Mon, 31 Aug 2015 22:09:30 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:44546 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753606AbbIACJ2 (ORCPT ); Mon, 31 Aug 2015 22:09:28 -0400 Subject: Re: [PATCH] perf tools: Support bpf prologue for arm64 To: Arnaldo Carvalho de Melo , Jean Pihet , Will Deacon References: <1440818212-121220-1-git-send-email-hekuang@huawei.com> <20150831201628.GH4423@kernel.org> CC: , , , , From: He Kuang Message-ID: <55E507C9.8050603@huawei.com> Date: Tue, 1 Sep 2015 10:04:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0 MIME-Version: 1.0 In-Reply-To: <20150831201628.GH4423@kernel.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.110.54.65] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.55E50803.0083,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: fc2cc18a376f42d115b56c3dcc9dc8c8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Arnaldo On 2015/9/1 4:16, Arnaldo Carvalho de Melo wrote: > Em Sat, Aug 29, 2015 at 03:16:52AM +0000, He Kuang escreveu: >> This patch implements arch_get_reg_info() for arm64 to enable >> HAVE_BPF_PROLOGUE feature. For arm64, structure pt_regs is not composed >> by fields of register names but an array of regs, so here we simply >> multiply fixed register size by index number to get the byte offset. > > Hi Jean, Will, are you ok with this? Can I have Acked-by or Reviewed-by > tags from you? > > He, please try to add the authors of the files you change in the CC > list. Ok, usually I use the get_maintainers.pl script, but it seems that the output do not include file authors: ./scripts/get_maintainer.pl 0001-perf-tools-Support-bpf-prologue-for-arm64.patch Peter Zijlstra (supporter:PERFORMANCE EVENTS SUBSYSTEM) Ingo Molnar (supporter:PERFORMANCE EVENTS SUBSYSTEM) Arnaldo Carvalho de Melo (supporter:PERFORMANCE EVENTS SUBSYSTEM,commit_signer:1/2=50%) Jiri Olsa (commit_signer:1/2=50%,authored:1/2=50%,removed_lines:4/4=100%) He Kuang (commit_signer:1/2=50%,authored:1/2=50%,added_lines:1/1=100%,commit_signer:1/1=100%,authored:1/1=100%,added_lines:23/23=100%) linux-kernel@vger.kernel.org (open list:PERFORMANCE EVENTS SUBSYSTEM) get_maintainers.pl bug? > > - Arnaldo > >> Signed-off-by: He Kuang >> --- >> tools/perf/arch/arm64/Makefile | 1 + >> tools/perf/arch/arm64/util/dwarf-regs.c | 26 ++++++++++++++++++++++++++ >> 2 files changed, 27 insertions(+) >> >> diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile >> index 7fbca17..1256e6e 100644 >> --- a/tools/perf/arch/arm64/Makefile >> +++ b/tools/perf/arch/arm64/Makefile >> @@ -1,3 +1,4 @@ >> ifndef NO_DWARF >> PERF_HAVE_DWARF_REGS := 1 >> endif >> +PERF_HAVE_ARCH_GET_REG_INFO := 1 >> diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c >> index d49efeb..cb2c50a 100644 >> --- a/tools/perf/arch/arm64/util/dwarf-regs.c >> +++ b/tools/perf/arch/arm64/util/dwarf-regs.c >> @@ -10,6 +10,10 @@ >> >> #include >> #include >> +#include >> +#include >> + >> +#define PT_REG_SIZE (sizeof(((struct user_pt_regs *)0)->regs[0])) >> >> struct pt_regs_dwarfnum { >> const char *name; >> @@ -78,3 +82,25 @@ const char *get_arch_regstr(unsigned int n) >> return roff->name; >> return NULL; >> } >> + >> +#ifdef HAVE_BPF_PROLOGUE >> +int arch_get_reg_info(const char *name, int *offset) >> +{ >> + const struct pt_regs_dwarfnum *roff; >> + >> + if (!name || !offset) >> + return -1; >> + >> + for (roff = regdwarfnum_table; roff->name != NULL; roff++) { >> + if (!strcmp(roff->name, name)) { >> + if (roff->dwarfnum < 0) >> + return -1; Here's a compile error. error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] So remove this useless comparison: --- tools/perf/arch/arm64/Makefile | 1 + tools/perf/arch/arm64/util/dwarf-regs.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 7fbca17..1256e6e 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -1,3 +1,4 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif +PERF_HAVE_ARCH_GET_REG_INFO := 1 diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c index d49efeb..cb935c4 100644 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ b/tools/perf/arch/arm64/util/dwarf-regs.c @@ -10,6 +10,10 @@ #include #include +#include +#include + +#define PT_REG_SIZE (sizeof(((struct user_pt_regs *)0)->regs[0])) struct pt_regs_dwarfnum { const char *name; @@ -78,3 +82,22 @@ const char *get_arch_regstr(unsigned int n) return roff->name; return NULL; } + +#ifdef HAVE_BPF_PROLOGUE +int arch_get_reg_info(const char *name, int *offset) +{ + const struct pt_regs_dwarfnum *roff; + + if (!name || !offset) + return -1; + + for (roff = regdwarfnum_table; roff->name != NULL; roff++) { + if (!strcmp(roff->name, name)) { + *offset = roff->dwarfnum * PT_REG_SIZE; + return 0; + } + } + + return -1; +} +#endif -- 1.8.5.2