Subject: Re: [PATCH] powerpc/perf: use is_kernel_addr macro in perf_get_misc_flags()

From: Anshuman Khandual <[email-masked]>
Date: Mon, 26 Dec 2016 09:45:18 +0530

On 12/24/2016 11:35 AM, Madhavan Srinivasan wrote:
> Cleanup to use is_kernel_addr macro.
> 
> Signed-off-by: Madhavan Srinivasan <[email-masked]>
> ---
>  arch/powerpc/perf/core-book3s.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 2cdf2647cdb0..d9c74fd1b37b 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -243,7 +243,7 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
>  	 */
>  	if (ppmu->flags & PPMU_NO_SIPR) {
>  		unsigned long siar = mfspr(SPRN_SIAR);
> -		if (siar >= PAGE_OFFSET)
> +		if (is_kernel_addr(siar))
>  			return PERF_RECORD_MISC_KERNEL;
>  		return PERF_RECORD_MISC_USER;
>  	}

While you are at this, why not also clean up these in the xmon code
as well.

arch/powerpc/xmon/xmon.c:		if (sp < PAGE_OFFSET) {
arch/powerpc/xmon/xmon.c:				if (lr < PAGE_OFFSET
arch/powerpc/xmon/xmon.c:			} else if (lr >= PAGE_OFFSET
arch/powerpc/xmon/xmon.c:	if (addr < PAGE_OFFSET)