Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1395189 > unrolled thread
| Started by | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| First post | 2016-05-05 17:30 +0200 |
| Last post | 2016-05-09 22:20 +0200 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH] perf tools: add support for generating bpf prologue on powerpc "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-05-05 17:30 +0200
[tip:perf/core] perf tools powerpc: Add support for generating bpf prologue "tip-bot for Naveen N. Rao" <tipbot@zytor.com> - 2016-05-06 08:50 +0200
Re: perf tools: add support for generating bpf prologue on powerpc Michael Ellerman <mpe@ellerman.id.au> - 2016-05-07 06:20 +0200
Re: perf tools: add support for generating bpf prologue on powerpc "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-05-07 13:20 +0200
Re: perf tools: add support for generating bpf prologue on powerpc Michael Ellerman <mpe@ellerman.id.au> - 2016-05-09 10:00 +0200
Re: perf tools: add support for generating bpf prologue on powerpc Arnaldo Carvalho de Melo <acme@redhat.com> - 2016-05-09 22:20 +0200
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-05-05 17:30 +0200 |
| Subject | [PATCH] perf tools: add support for generating bpf prologue on powerpc |
| Message-ID | <rvtnY-2lG-31@gated-at.bofh.it> |
Generalize existing macros to serve the purpose.
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
With this patch:
# ./perf test 37
37: Test BPF filter :
37.1: Test basic BPF filtering : Ok
37.2: Test BPF prologue generation : Ok
37.3: Test BPF relocation checker : Ok
tools/perf/arch/powerpc/Makefile | 1 +
tools/perf/arch/powerpc/util/dwarf-regs.c | 40 +++++++++++++++++++++----------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
index 56e05f1..cc39309 100644
--- a/tools/perf/arch/powerpc/Makefile
+++ b/tools/perf/arch/powerpc/Makefile
@@ -3,4 +3,5 @@ PERF_HAVE_DWARF_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
+PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/powerpc/util/dwarf-regs.c
index 733151c..41bdf95 100644
--- a/tools/perf/arch/powerpc/util/dwarf-regs.c
+++ b/tools/perf/arch/powerpc/util/dwarf-regs.c
@@ -10,19 +10,26 @@
*/
#include <stddef.h>
+#include <errno.h>
+#include <string.h>
#include <dwarf-regs.h>
-
+#include <linux/ptrace.h>
+#include <linux/kernel.h>
+#include "util.h"
struct pt_regs_dwarfnum {
const char *name;
unsigned int dwarfnum;
+ unsigned int ptregs_offset;
};
-#define STR(s) #s
-#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
-#define GPR_DWARFNUM_NAME(num) \
- {.name = STR(%gpr##num), .dwarfnum = num}
-#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
+#define REG_DWARFNUM_NAME(r, num) \
+ {.name = STR(%)STR(r), .dwarfnum = num, \
+ .ptregs_offset = offsetof(struct pt_regs, r)}
+#define GPR_DWARFNUM_NAME(num) \
+ {.name = STR(%gpr##num), .dwarfnum = num, \
+ .ptregs_offset = offsetof(struct pt_regs, gpr[num])}
+#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}
/*
* Reference:
@@ -61,12 +68,12 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[] = {
GPR_DWARFNUM_NAME(29),
GPR_DWARFNUM_NAME(30),
GPR_DWARFNUM_NAME(31),
- REG_DWARFNUM_NAME("%msr", 66),
- REG_DWARFNUM_NAME("%ctr", 109),
- REG_DWARFNUM_NAME("%link", 108),
- REG_DWARFNUM_NAME("%xer", 101),
- REG_DWARFNUM_NAME("%dar", 119),
- REG_DWARFNUM_NAME("%dsisr", 118),
+ REG_DWARFNUM_NAME(msr, 66),
+ REG_DWARFNUM_NAME(ctr, 109),
+ REG_DWARFNUM_NAME(link, 108),
+ REG_DWARFNUM_NAME(xer, 101),
+ REG_DWARFNUM_NAME(dar, 119),
+ REG_DWARFNUM_NAME(dsisr, 118),
REG_DWARFNUM_END,
};
@@ -86,3 +93,12 @@ const char *get_arch_regstr(unsigned int n)
return roff->name;
return NULL;
}
+
+int regs_query_register_offset(const char *name)
+{
+ const struct pt_regs_dwarfnum *roff;
+ for (roff = regdwarfnum_table; roff->name != NULL; roff++)
+ if (!strcmp(roff->name, name))
+ return roff->ptregs_offset;
+ return -EINVAL;
+}
--
2.7.4
[toc] | [next] | [standalone]
| From | "tip-bot for Naveen N. Rao" <tipbot@zytor.com> |
|---|---|
| Date | 2016-05-06 08:50 +0200 |
| Subject | [tip:perf/core] perf tools powerpc: Add support for generating bpf prologue |
| Message-ID | <rvHKj-an-39@gated-at.bofh.it> |
| In reply to | #1395189 |
Commit-ID: 4679bccaa30893ccc5be35c5c5d44f5ab60c0a08
Gitweb: http://git.kernel.org/tip/4679bccaa30893ccc5be35c5c5d44f5ab60c0a08
Author: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
AuthorDate: Thu, 5 May 2016 20:53:19 +0530
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 5 May 2016 21:03:58 -0300
perf tools powerpc: Add support for generating bpf prologue
Generalize existing macros to serve the purpose.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Ian Munsie <imunsie@au1.ibm.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/1462461799-17518-1-git-send-email-naveen.n.rao@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/arch/powerpc/Makefile | 1 +
tools/perf/arch/powerpc/util/dwarf-regs.c | 40 +++++++++++++++++++++----------
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
index 56e05f1..cc39309 100644
--- a/tools/perf/arch/powerpc/Makefile
+++ b/tools/perf/arch/powerpc/Makefile
@@ -3,4 +3,5 @@ PERF_HAVE_DWARF_REGS := 1
endif
HAVE_KVM_STAT_SUPPORT := 1
+PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
PERF_HAVE_JITDUMP := 1
diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/powerpc/util/dwarf-regs.c
index 733151c..41bdf95 100644
--- a/tools/perf/arch/powerpc/util/dwarf-regs.c
+++ b/tools/perf/arch/powerpc/util/dwarf-regs.c
@@ -10,19 +10,26 @@
*/
#include <stddef.h>
+#include <errno.h>
+#include <string.h>
#include <dwarf-regs.h>
-
+#include <linux/ptrace.h>
+#include <linux/kernel.h>
+#include "util.h"
struct pt_regs_dwarfnum {
const char *name;
unsigned int dwarfnum;
+ unsigned int ptregs_offset;
};
-#define STR(s) #s
-#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num}
-#define GPR_DWARFNUM_NAME(num) \
- {.name = STR(%gpr##num), .dwarfnum = num}
-#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0}
+#define REG_DWARFNUM_NAME(r, num) \
+ {.name = STR(%)STR(r), .dwarfnum = num, \
+ .ptregs_offset = offsetof(struct pt_regs, r)}
+#define GPR_DWARFNUM_NAME(num) \
+ {.name = STR(%gpr##num), .dwarfnum = num, \
+ .ptregs_offset = offsetof(struct pt_regs, gpr[num])}
+#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0}
/*
* Reference:
@@ -61,12 +68,12 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[] = {
GPR_DWARFNUM_NAME(29),
GPR_DWARFNUM_NAME(30),
GPR_DWARFNUM_NAME(31),
- REG_DWARFNUM_NAME("%msr", 66),
- REG_DWARFNUM_NAME("%ctr", 109),
- REG_DWARFNUM_NAME("%link", 108),
- REG_DWARFNUM_NAME("%xer", 101),
- REG_DWARFNUM_NAME("%dar", 119),
- REG_DWARFNUM_NAME("%dsisr", 118),
+ REG_DWARFNUM_NAME(msr, 66),
+ REG_DWARFNUM_NAME(ctr, 109),
+ REG_DWARFNUM_NAME(link, 108),
+ REG_DWARFNUM_NAME(xer, 101),
+ REG_DWARFNUM_NAME(dar, 119),
+ REG_DWARFNUM_NAME(dsisr, 118),
REG_DWARFNUM_END,
};
@@ -86,3 +93,12 @@ const char *get_arch_regstr(unsigned int n)
return roff->name;
return NULL;
}
+
+int regs_query_register_offset(const char *name)
+{
+ const struct pt_regs_dwarfnum *roff;
+ for (roff = regdwarfnum_table; roff->name != NULL; roff++)
+ if (!strcmp(roff->name, name))
+ return roff->ptregs_offset;
+ return -EINVAL;
+}
[toc] | [prev] | [next] | [standalone]
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2016-05-07 06:20 +0200 |
| Subject | Re: perf tools: add support for generating bpf prologue on powerpc |
| Message-ID | <rw1SF-2Kd-1@gated-at.bofh.it> |
| In reply to | #1395189 |
On Thu, 2016-05-05 at 15:23:19 UTC, "Naveen N. Rao" wrote: > Generalize existing macros to serve the purpose. > > Cc: Wang Nan <wangnan0@huawei.com> > Cc: Arnaldo Carvalho de Melo <acme@redhat.com> > Cc: Masami Hiramatsu <mhiramat@kernel.org> > Cc: Ian Munsie <imunsie@au1.ibm.com> > Cc: Michael Ellerman <mpe@ellerman.id.au> > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> > --- > With this patch: > # ./perf test 37 > 37: Test BPF filter : > 37.1: Test basic BPF filtering : Ok > 37.2: Test BPF prologue generation : Ok > 37.3: Test BPF relocation checker : Ok > > tools/perf/arch/powerpc/Makefile | 1 + > tools/perf/arch/powerpc/util/dwarf-regs.c | 40 +++++++++++++++++++++---------- > 2 files changed, 29 insertions(+), 12 deletions(-) Looks feasible, and is in powerpc only code, should I take this or acme? cheers
[toc] | [prev] | [next] | [standalone]
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2016-05-07 13:20 +0200 |
| Subject | Re: perf tools: add support for generating bpf prologue on powerpc |
| Message-ID | <rw8r7-Ad-7@gated-at.bofh.it> |
| In reply to | #1396228 |
On 2016/05/07 02:15PM, Michael Ellerman wrote: > On Thu, 2016-05-05 at 15:23:19 UTC, "Naveen N. Rao" wrote: > > Generalize existing macros to serve the purpose. > > > > Cc: Wang Nan <wangnan0@huawei.com> > > Cc: Arnaldo Carvalho de Melo <acme@redhat.com> > > Cc: Masami Hiramatsu <mhiramat@kernel.org> > > Cc: Ian Munsie <imunsie@au1.ibm.com> > > Cc: Michael Ellerman <mpe@ellerman.id.au> > > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> > > --- > > With this patch: > > # ./perf test 37 > > 37: Test BPF filter : > > 37.1: Test basic BPF filtering : Ok > > 37.2: Test BPF prologue generation : Ok > > 37.3: Test BPF relocation checker : Ok > > > > tools/perf/arch/powerpc/Makefile | 1 + > > tools/perf/arch/powerpc/util/dwarf-regs.c | 40 +++++++++++++++++++++---------- > > 2 files changed, 29 insertions(+), 12 deletions(-) > > Looks feasible, and is in powerpc only code, should I take this or acme? Hi Michael, Arnaldo has already pulled this in: http://article.gmane.org/gmane.linux.kernel/2216051 It would be good if you can consider user stackdump as that depends on perf regs support which you have added to powerpc-next: http://thread.gmane.org/gmane.linux.kernel/2210299/focus=2210749 Thanks, Naveen
[toc] | [prev] | [next] | [standalone]
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2016-05-09 10:00 +0200 |
| Subject | Re: perf tools: add support for generating bpf prologue on powerpc |
| Message-ID | <rwOgH-II-39@gated-at.bofh.it> |
| In reply to | #1396297 |
On Sat, 2016-05-07 at 16:43 +0530, Naveen N. Rao wrote: > On 2016/05/07 02:15PM, Michael Ellerman wrote: > > On Thu, 2016-05-05 at 15:23:19 UTC, "Naveen N. Rao" wrote: > > > Generalize existing macros to serve the purpose. > > > > > > Cc: Wang Nan <wangnan0@huawei.com> > > > Cc: Arnaldo Carvalho de Melo <acme@redhat.com> > > > Cc: Masami Hiramatsu <mhiramat@kernel.org> > > > Cc: Ian Munsie <imunsie@au1.ibm.com> > > > Cc: Michael Ellerman <mpe@ellerman.id.au> > > > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> > > > --- > > > With this patch: > > > # ./perf test 37 > > > 37: Test BPF filter : > > > 37.1: Test basic BPF filtering : Ok > > > 37.2: Test BPF prologue generation : Ok > > > 37.3: Test BPF relocation checker : Ok > > > > > > tools/perf/arch/powerpc/Makefile | 1 + > > > tools/perf/arch/powerpc/util/dwarf-regs.c | 40 +++++++++++++++++++++---------- > > > 2 files changed, 29 insertions(+), 12 deletions(-) > > > > Looks feasible, and is in powerpc only code, should I take this or acme? > > Hi Michael, > Arnaldo has already pulled this in: > http://article.gmane.org/gmane.linux.kernel/2216051 Ah sorry. > It would be good if you can consider user stackdump as that depends on > perf regs support which you have added to powerpc-next: > http://thread.gmane.org/gmane.linux.kernel/2210299/focus=2210749 Yep I did, it's in next. https://git.kernel.org/cgit/linux/kernel/git/powerpc/linux.git/commit/?h=next&id=826dccfd238c3eeac379f5f637e5a3ddc7a4bc22 cheers
[toc] | [prev] | [next] | [standalone]
| From | Arnaldo Carvalho de Melo <acme@redhat.com> |
|---|---|
| Date | 2016-05-09 22:20 +0200 |
| Subject | Re: perf tools: add support for generating bpf prologue on powerpc |
| Message-ID | <rwZON-48t-1@gated-at.bofh.it> |
| In reply to | #1396228 |
Em Sat, May 07, 2016 at 02:15:36PM +1000, Michael Ellerman escreveu: > On Thu, 2016-05-05 at 15:23:19 UTC, "Naveen N. Rao" wrote: > > Generalize existing macros to serve the purpose. > > > > Cc: Wang Nan <wangnan0@huawei.com> > > Cc: Arnaldo Carvalho de Melo <acme@redhat.com> > > Cc: Masami Hiramatsu <mhiramat@kernel.org> > > Cc: Ian Munsie <imunsie@au1.ibm.com> > > Cc: Michael Ellerman <mpe@ellerman.id.au> > > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> > > --- > > With this patch: > > # ./perf test 37 > > 37: Test BPF filter : > > 37.1: Test basic BPF filtering : Ok > > 37.2: Test BPF prologue generation : Ok > > 37.3: Test BPF relocation checker : Ok > > > > tools/perf/arch/powerpc/Makefile | 1 + > > tools/perf/arch/powerpc/util/dwarf-regs.c | 40 +++++++++++++++++++++---------- > > 2 files changed, 29 insertions(+), 12 deletions(-) > > Looks feasible, and is in powerpc only code, should I take this or acme? Its upstream already :-) - Arnaldo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web