Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1570110 > unrolled thread
| Started by | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| First post | 2017-01-30 21:50 +0100 |
| Last post | 2017-01-31 09:10 +0100 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH V3 3/4] arch/powerpc: Implement Optprobes Michael Ellerman <mpe@ellerman.id.au> - 2017-01-30 21:50 +0100
Re: [PATCH V3 3/4] arch/powerpc: Implement Optprobes "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-01-31 09:00 +0100
[PATCH] powerpc: kprobes: fixes for kprobe_lookup_name on BE "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-01-31 09:10 +0100
| From | Michael Ellerman <mpe@ellerman.id.au> |
|---|---|
| Date | 2017-01-30 21:50 +0100 |
| Subject | Re: [PATCH V3 3/4] arch/powerpc: Implement Optprobes |
| Message-ID | <t5r3I-8h-15@gated-at.bofh.it> |
Anju T Sudhakar <anju@linux.vnet.ibm.com> writes:
> Detour buffer contains instructions to create an in memory pt_regs.
> After the execution of the pre-handler, a call is made for instruction emulation.
> The NIP is determined in advanced through dummy instruction emulation and a branch
> instruction is created to the NIP at the end of the trampoline.
>
> Instruction slot for detour buffer is allocated from the reserved area.
> For the time being, 64KB is reserved in memory for this purpose.
>
> Instructions which can be emulated using analyse_instr() are suppliants
> for optimization. Before optimization ensure that the address range
> between the detour buffer allocated and the instruction being probed
> is within ± 32MB.
>
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
> .../features/debug/optprobes/arch-support.txt | 2 +-
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/kprobes.h | 24 +-
> arch/powerpc/include/asm/sstep.h | 1 +
> arch/powerpc/kernel/Makefile | 1 +
> arch/powerpc/kernel/optprobes.c | 331 +++++++++++++++++++++
> arch/powerpc/kernel/optprobes_head.S | 135 +++++++++
> arch/powerpc/lib/sstep.c | 21 ++
> 8 files changed, 514 insertions(+), 2 deletions(-)
> create mode 100644 arch/powerpc/kernel/optprobes.c
> create mode 100644 arch/powerpc/kernel/optprobes_head.S
This breaks the pseries_defconfig (at least) build:
In file included from ../include/linux/kprobes.h:45:0,
from ../arch/powerpc/kernel/optprobes.c:12:
../arch/powerpc/kernel/optprobes.c: In function ‘arch_prepare_optimized_kprobe’:
../arch/powerpc/include/asm/kprobes.h:79:16: error: ‘MODULE_NAME_LEN’ undeclared (first use in this function)
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
^
../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
kprobe_lookup_name("optimized_callback", op_callback_addr);
^~~~~~~~~~~~~~~~~~
../arch/powerpc/include/asm/kprobes.h:79:16: note: each undeclared identifier is reported only once for each function it appears in
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
^
../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
kprobe_lookup_name("optimized_callback", op_callback_addr);
^~~~~~~~~~~~~~~~~~
../arch/powerpc/include/asm/kprobes.h:82:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
if ((modsym = strchr(name, ':')) != NULL) { \
^
../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
kprobe_lookup_name("optimized_callback", op_callback_addr);
^~~~~~~~~~~~~~~~~~
../arch/powerpc/include/asm/kprobes.h:79:7: error: unused variable ‘dot_name’ [-Werror=unused-variable]
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
^
../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
kprobe_lookup_name("optimized_callback", op_callback_addr);
^~~~~~~~~~~~~~~~~~
../arch/powerpc/include/asm/kprobes.h:82:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
if ((modsym = strchr(name, ':')) != NULL) { \
^
../arch/powerpc/kernel/optprobes.c:231:2: note: in expansion of macro ‘kprobe_lookup_name’
kprobe_lookup_name("emulate_step", emulate_step_addr);
^~~~~~~~~~~~~~~~~~
../arch/powerpc/include/asm/kprobes.h:79:7: error: unused variable ‘dot_name’ [-Werror=unused-variable]
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
^
../arch/powerpc/kernel/optprobes.c:231:2: note: in expansion of macro ‘kprobe_lookup_name’
kprobe_lookup_name("emulate_step", emulate_step_addr);
^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [arch/powerpc/kernel/optprobes.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [arch/powerpc/kernel] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [sub-make] Error 2
This may not be your bug, but your patch exposes it unfortunately.
cheers
[toc] | [next] | [standalone]
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-01-31 09:00 +0100 |
| Message-ID | <t5Bw7-6rQ-27@gated-at.bofh.it> |
| In reply to | #1570110 |
On 2017/01/31 07:43AM, Michael Ellerman wrote:
> Anju T Sudhakar <anju@linux.vnet.ibm.com> writes:
>
> > Detour buffer contains instructions to create an in memory pt_regs.
> > After the execution of the pre-handler, a call is made for instruction emulation.
> > The NIP is determined in advanced through dummy instruction emulation and a branch
> > instruction is created to the NIP at the end of the trampoline.
> >
> > Instruction slot for detour buffer is allocated from the reserved area.
> > For the time being, 64KB is reserved in memory for this purpose.
> >
> > Instructions which can be emulated using analyse_instr() are suppliants
> > for optimization. Before optimization ensure that the address range
> > between the detour buffer allocated and the instruction being probed
> > is within ± 32MB.
> >
> > Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> > Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> > ---
> > .../features/debug/optprobes/arch-support.txt | 2 +-
> > arch/powerpc/Kconfig | 1 +
> > arch/powerpc/include/asm/kprobes.h | 24 +-
> > arch/powerpc/include/asm/sstep.h | 1 +
> > arch/powerpc/kernel/Makefile | 1 +
> > arch/powerpc/kernel/optprobes.c | 331 +++++++++++++++++++++
> > arch/powerpc/kernel/optprobes_head.S | 135 +++++++++
> > arch/powerpc/lib/sstep.c | 21 ++
> > 8 files changed, 514 insertions(+), 2 deletions(-)
> > create mode 100644 arch/powerpc/kernel/optprobes.c
> > create mode 100644 arch/powerpc/kernel/optprobes_head.S
>
> This breaks the pseries_defconfig (at least) build:
>
> In file included from ../include/linux/kprobes.h:45:0,
> from ../arch/powerpc/kernel/optprobes.c:12:
> ../arch/powerpc/kernel/optprobes.c: In function ‘arch_prepare_optimized_kprobe’:
> ../arch/powerpc/include/asm/kprobes.h:79:16: error: ‘MODULE_NAME_LEN’ undeclared (first use in this function)
> char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
> ^
> ../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
> kprobe_lookup_name("optimized_callback", op_callback_addr);
> ^~~~~~~~~~~~~~~~~~
> ../arch/powerpc/include/asm/kprobes.h:79:16: note: each undeclared identifier is reported only once for each function it appears in
> char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
> ^
> ../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
> kprobe_lookup_name("optimized_callback", op_callback_addr);
> ^~~~~~~~~~~~~~~~~~
> ../arch/powerpc/include/asm/kprobes.h:82:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> if ((modsym = strchr(name, ':')) != NULL) { \
> ^
> ../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
> kprobe_lookup_name("optimized_callback", op_callback_addr);
> ^~~~~~~~~~~~~~~~~~
> ../arch/powerpc/include/asm/kprobes.h:79:7: error: unused variable ‘dot_name’ [-Werror=unused-variable]
> char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
> ^
> ../arch/powerpc/kernel/optprobes.c:230:2: note: in expansion of macro ‘kprobe_lookup_name’
> kprobe_lookup_name("optimized_callback", op_callback_addr);
> ^~~~~~~~~~~~~~~~~~
> ../arch/powerpc/include/asm/kprobes.h:82:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> if ((modsym = strchr(name, ':')) != NULL) { \
> ^
> ../arch/powerpc/kernel/optprobes.c:231:2: note: in expansion of macro ‘kprobe_lookup_name’
> kprobe_lookup_name("emulate_step", emulate_step_addr);
> ^~~~~~~~~~~~~~~~~~
> ../arch/powerpc/include/asm/kprobes.h:79:7: error: unused variable ‘dot_name’ [-Werror=unused-variable]
> char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
> ^
> ../arch/powerpc/kernel/optprobes.c:231:2: note: in expansion of macro ‘kprobe_lookup_name’
> kprobe_lookup_name("emulate_step", emulate_step_addr);
> ^~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[2]: *** [arch/powerpc/kernel/optprobes.o] Error 1
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [arch/powerpc/kernel] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [sub-make] Error 2
>
>
> This may not be your bug, but your patch exposes it unfortunately.
Sorry for the trouble, we should have caught this.
- Naveen
[toc] | [prev] | [next] | [standalone]
| From | "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-01-31 09:10 +0100 |
| Subject | [PATCH] powerpc: kprobes: fixes for kprobe_lookup_name on BE |
| Message-ID | <t5BFL-6K3-1@gated-at.bofh.it> |
| In reply to | #1570110 |
Fix two issues with kprobes.h on BE which were exposed with the optprobes work:
- one, having to do with a missing include for linux/module.h for
MODULE_NAME_LEN -- this didn't show up previously since the only users of
kprobe_lookup_name were in kprobes.c, which included linux/module.h
through other headers, and
- two, with a missing const qualifier for a local variable which ends up
referring a string literal. Again, this is unique to how
kprobe_lookup_name is being invoked in optprobes.c
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/kprobes.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h
index 5fc728af9260..d821835ade86 100644
--- a/arch/powerpc/include/asm/kprobes.h
+++ b/arch/powerpc/include/asm/kprobes.h
@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/ptrace.h>
#include <linux/percpu.h>
+#include <linux/module.h>
#include <asm/probes.h>
#include <asm/code-patching.h>
@@ -77,7 +78,7 @@ extern kprobe_opcode_t optprobe_template_end[];
#define kprobe_lookup_name(name, addr) \
{ \
char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN]; \
- char *modsym; \
+ const char *modsym; \
bool dot_appended = false; \
if ((modsym = strchr(name, ':')) != NULL) { \
modsym++; \
--
2.11.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web