Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp751793ybj; Thu, 7 May 2020 06:54:31 -0700 (PDT) X-Google-Smtp-Source: APiQypKjuy/S2COmF259Trc2MFpact78tHTjRumRu3cdtxAIIB6mLX7bSD0E0eF02/bPirDTrkDm X-Received: by 2002:a17:906:909:: with SMTP id i9mr7945471ejd.347.1588859671746; Thu, 07 May 2020 06:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588859671; cv=none; d=google.com; s=arc-20160816; b=spX6l6MaKsgKk3xYpRdyuC3Z3TMkN+VnU9HS6aDUCP77oN5b6rbHoR+EWBXigWDGn6 GJh36CES+sP/3KOdBUSVIMDUOD9Lg0R7FXFwkF/Y6NLoXKF/+Zo7nzZYl9LhNcJ+Ixes Ka7n9lhMPtK80Mhc0dfz7j8PB2n7NsoGmXe43IPqX0m3pNPx2M7I+APCE4BQP9yz/Pzm X1d+RR2V/kucYTIH4n52ZUNfkARdqOyJRFLu6BaUWsDGKi674Mpfe8A9zK5Klie+kqgm 5/iaGqutUEzvx6oRW/329z7ryZzftjmABk+BeVwqFLjRBS4JFIkuSNlrjiCP9/6hVnKI lO/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+SIGRGop+1gtjRs1naRTRVhB6jGbKwnj0JroYq8wkTU=; b=YQjsmFaYASKYgdjgCD8Gg9RqSET8Dmg0rhcmNEzpidlXrSOclhAUJqLw2IsggJ23Bs ES3gv6lP9as26IGdAYRSNVGfxMUgajd1lm3iVOcSxjIMzapOQ5+Wn+MddgQOpCqOXu3G 9wTqcuhIOu6ouFc8lhvgxJh9lYkSNPa91x5uOZfM+YfzjtE0XPzlQiHQQXKf36e5C+4y o6ZmGgwt38bWnoQO/Mv1yKFRLIb9TWvTx7gnF9461SzxNDva+/nuq+Sf+qxEPMGnpawE tJsXs9HCsP4ySvZ3hMoVLJHxkOQv+MvqUObLwYemfwj98g+XdrZL0WyFtbtxHu2c96Eu XIdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mnd4bYDW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq7si2984343edb.319.2020.05.07.06.54.01; Thu, 07 May 2020 06:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mnd4bYDW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726470AbgEGNwU (ORCPT + 99 others); Thu, 7 May 2020 09:52:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725964AbgEGNwT (ORCPT ); Thu, 7 May 2020 09:52:19 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 681E52073A; Thu, 7 May 2020 13:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588859539; bh=IwsXYXmDs9aNaYPa4+QMKqQ65GYmJMLHHgZOQO0ito0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mnd4bYDWYAIZ4zCHfaiJgGW7gq/naBS9fqditzfIOrsnv40Et2ZRgwpNfZocNknka Axg7s2N1KjHSV9RE7TilOJ7BeJnjKctTrwdNmwvVRrJhDfMgNkonFMoZ7eABSB+qyC PuuBS2r0GmqVqCNKkbKQu7tNa+Iw0qnZXMIV3cCs= Date: Thu, 7 May 2020 14:52:14 +0100 From: Will Deacon To: Yunfeng Ye 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() Message-ID: <20200507135213.GA32706@willie-the-truck> References: <10b188af-a03b-3acc-8a06-cf31a46f735a@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10b188af-a03b-3acc-8a06-cf31a46f735a@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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