Subject: Re: [PATCH 1/4] powerpc/kprobe: introduce a new thread flag

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 13 Dec 2011 09:58:59 +1100

On Mon, 2011-12-12 at 16:50 +0800, Tiejun Chen wrote:
> We need to add a new thread flag, TIF_KPROBE/_TIF_DELAYED_KPROBE,
> for handling kprobe operation while exiting exception.

The basic idea is sane, however the instruction emulation isn't per-se
kprobe specific. It could be used by xmon too for example. I'd rather
use a different name, something like TIF_EMULATE_STACK_STORE or
something like that.

Cheers,
Ben.

> Signed-off-by: Tiejun Chen <[email-masked]>
> ---
>  arch/powerpc/include/asm/thread_info.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
> index 836f231..3378734 100644
> --- a/arch/powerpc/include/asm/thread_info.h
> +++ b/arch/powerpc/include/asm/thread_info.h
> @@ -112,6 +112,7 @@ static inline struct thread_info *current_thread_info(void)
>  #define TIF_FREEZE		14	/* Freezing for suspend */
>  #define TIF_SYSCALL_TRACEPOINT	15	/* syscall tracepoint instrumentation */
>  #define TIF_RUNLATCH		16	/* Is the runlatch enabled? */
> +#define TIF_KPROBE		17	/* Is the delayed kprobe operation? */
>  
>  /* as above, but as bit values */
>  #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
> @@ -130,6 +131,7 @@ static inline struct thread_info *current_thread_info(void)
>  #define _TIF_FREEZE		(1<<TIF_FREEZE)
>  #define _TIF_SYSCALL_TRACEPOINT	(1<<TIF_SYSCALL_TRACEPOINT)
>  #define _TIF_RUNLATCH		(1<<TIF_RUNLATCH)
> +#define _TIF_DELAYED_KPROBE	(1<<TIF_KPROBE)
>  #define _TIF_SYSCALL_T_OR_A	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
>  				 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
>