(2013/08/13 23:08), Tony Lu wrote:
> This change includes support for Kprobes, Jprobes and Return Probes.
>
This looks OK for me, just reviewed, not tested :).
Reviewed-by: Masami Hiramatsu
Thank you!
> Signed-off-by: Tony Lu
> Signed-off-by: Chris Metcalf
> ---
> v2: implement Masami Hiramatsu's suggestion to add an insn_has_control()
> check to disallow placing probes on instructions that modify control flow.
> We can improve this in a later change if it seems useful.
>
> arch/tile/Kconfig| 2 +
> arch/tile/include/asm/Kbuild | 1 -
> arch/tile/include/asm/kdebug.h | 28 ++
> arch/tile/include/asm/kprobes.h | 79
> arch/tile/include/asm/ptrace.h | 1 +
> arch/tile/include/uapi/arch/opcode_tilegx.h | 1 +
> arch/tile/include/uapi/arch/opcode_tilepro.h | 1 +
> arch/tile/kernel/Makefile| 1 +
> arch/tile/kernel/kprobes.c | 528
> +++
> arch/tile/kernel/smp.c | 14 +-
> arch/tile/kernel/traps.c | 42 +++
> arch/tile/kernel/vmlinux.lds.S | 1 +
> arch/tile/mm/fault.c | 12 +
> samples/kprobes/kprobe_example.c | 9 +
> 14 files changed, 716 insertions(+), 4 deletions(-)
> create mode 100644 arch/tile/include/asm/kdebug.h
> create mode 100644 arch/tile/include/asm/kprobes.h
> create mode 100644 arch/tile/kernel/kprobes.c
>
> diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
> index e1600be..ecff467 100644
> --- a/arch/tile/Kconfig
> +++ b/arch/tile/Kconfig
> @@ -125,6 +125,8 @@ config TILEGX
> select HAVE_FUNCTION_GRAPH_TRACER
> select HAVE_DYNAMIC_FTRACE
> select HAVE_FTRACE_MCOUNT_RECORD
> + select HAVE_KPROBES
> + select HAVE_KRETPROBES
>
> config TILEPRO
> def_bool !TILEGX
> diff --git a/arch/tile/include/asm/Kbuild b/arch/tile/include/asm/Kbuild
> index b17b9b8..4c0b3c2 100644
> --- a/arch/tile/include/asm/Kbuild
> +++ b/arch/tile/include/asm/Kbuild
> @@ -15,7 +15,6 @@ generic-y += ioctl.h
> generic-y += ioctls.h
> generic-y += ipcbuf.h
> generic-y += irq_regs.h
> -generic-y += kdebug.h
> generic-y += local.h
> generic-y += msgbuf.h
> generic-y += mutex.h
> diff --git a/arch/tile/include/asm/kdebug.h b/arch/tile/include/asm/kdebug.h
> new file mode 100644
> index 000..5bbbfa9
> --- /dev/null
> +++ b/arch/tile/include/asm/kdebug.h
> @@ -0,0 +1,28 @@
> +/*
> + * Copyright 2012 Tilera Corporation. All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation, version 2.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
> + * NON INFRINGEMENT. See the GNU General Public License for
> + * more details.
> + */
> +
> +#ifndef _ASM_TILE_KDEBUG_H
> +#define _ASM_TILE_KDEBUG_H
> +
> +#include
> +
> +enum die_val {
> + DIE_OOPS = 1,
> + DIE_BREAK,
> + DIE_SSTEPBP,
> + DIE_PAGE_FAULT,
> + DIE_COMPILED_BPT
> +};
> +
> +#endif /* _ASM_TILE_KDEBUG_H */
> diff --git a/arch/tile/include/asm/kprobes.h b/arch/tile/include/asm/kprobes.h
> new file mode 100644
> index 000..d8f9a83
> --- /dev/null
> +++ b/arch/tile/include/asm/kprobes.h
> @@ -0,0 +1,79 @@
> +/*
> + * arch/tile/include/asm/kprobes.h
> + *
> + * Copyright 2012 Tilera Corporation. All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation, version 2.
> + *
> + * This program is distributed in the hope that it will be useful, but
> + * WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
> + * NON INFRINGEMENT. See the GNU General Public License for
> + * more details.
> + */
> +
> +#ifndef _ASM_TILE_KPROBES_H
> +#define _ASM_TILE_KPROBES_H
> +
> +#include
> +#include
> +#include
> +
> +#include
> +
> +#define __ARCH_WANT_KPROBES_INSN_SLOT
> +#define MAX_INSN_SIZE2
> +
> +#define kretprobe_blacklist_size 0
> +
> +typedef tile_bundle_bits kprobe_opcode_t;
> +
> +#define flush_insn_slot(p) \
> + flush_icache_range((unsigned long)p->addr, \
> +(unsigned long)p->addr + \
> +(MAX_INSN_SIZE * sizeof(kprobe_opcode_t)))
> +
> +struct kprobe;
> +
> +/* Architecture specific copy of original instruction. */
> +struct arch_specific_insn {
> + kprobe_opcode_t *insn;
> +};
> +
> +struct prev_kpr