mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: catalin.marinas@arm.com, Dave.Martin@arm.com,
	mark.rutland@arm.com, james.morse@arm.com, 0x7f454c46@gmail.com,
	tglx@linutronix.de, lorenzo.pieralisi@arm.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, hushiyuan@huawei.com,
	hewenliang4@huawei.com
Subject: Re: [PATCH] arm64: stacktrace: Factor out some common code info on_stack()
Date: Thu, 7 May 2020 14:52:14 +0100	[thread overview]
Message-ID: <20200507135213.GA32706@willie-the-truck> (raw)
In-Reply-To: <10b188af-a03b-3acc-8a06-cf31a46f735a@huawei.com>

On Thu, May 07, 2020 at 05:28:19PM +0800, Yunfeng Ye wrote:
> diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h
> index fdb913cc0bcb..b92bef2fb6cd 100644
> --- a/arch/arm64/include/asm/stacktrace.h
> +++ b/arch/arm64/include/asm/stacktrace.h
> @@ -69,27 +69,40 @@ extern void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
> 
>  DECLARE_PER_CPU(unsigned long *, irq_stack_ptr);
> 
> -static inline bool on_irq_stack(unsigned long sp,
> +static inline bool on_stack(unsigned long sp, unsigned long low,
> +				unsigned long high, enum stack_type type,
>  				struct stack_info *info)
>  {
> -	unsigned long low = (unsigned long)raw_cpu_read(irq_stack_ptr);
> -	unsigned long high = low + IRQ_STACK_SIZE;
> -
> -	if (!low)
> -		return false;
> -
>  	if (sp < low || sp >= high)
>  		return false;
> 
>  	if (info) {
>  		info->low = low;
>  		info->high = high;
> -		info->type = STACK_TYPE_IRQ;
> +		info->type = type;
>  	}
> -
>  	return true;
>  }
> 
> +static inline bool on_valid_stack(unsigned long sp, unsigned long low,
> +				unsigned long high, enum stack_type type,
> +				struct stack_info *info)
> +{
> +	if (!low)
> +		return false;
> +
> +	return on_stack(sp, low, high, type, info);
> +}

Do we need this as distinct from on_stack()? Afaict, 'low' is never
going to be NULL for the on_stack() callers, so I suggest just having
on_stack() check 'low' and getting everybody to call that instead.

Make sense?

Will

  reply	other threads:[~2020-05-07 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07  9:28 Yunfeng Ye
2020-05-07 13:52 ` Will Deacon [this message]
2020-05-08  1:29   ` Yunfeng Ye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200507135213.GA32706@willie-the-truck \
    --to=will@kernel.org \
    --cc=0x7f454c46@gmail.com \
    --cc=Dave.Martin@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=hewenliang4@huawei.com \
    --cc=hushiyuan@huawei.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=tglx@linutronix.de \
    --cc=yeyunfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®