From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C127DC433DB for ; Mon, 22 Mar 2021 16:34:13 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CB156198D for ; Mon, 22 Mar 2021 16:34:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CB156198D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rSabQj2BJDMC3sURaH4dUVnzW6Xvd03m91tQAUOgBBs=; b=jM7XUvamVPV79ERqPlWGpjEkT 99ahsdd3YyftkrxfzbDi9LYZR7Y0t5MsiB8D7anLT4miod8ia4kIekQxnIsDjAuu5pcyZ8V/Frp+r qHZwfWiGT5SavqZ0aA+iTy/KVZ6azurcg0E77aR3r7NJTgK9ymK5oq5Z160phNT0x0eHQfxRIuz1h FXfZOE3mvgtHDgp4IoIY9qKADIAMltrfSje20ClXdAePSAbBVGlqthl5k0ifZsqbK4W20FPp99Fqf Zw0N19vcn+grmaN+gsX5MRx5iFWr7kITvSvQDLkT3tDf3okF/P+bM4LyXVM4sMB50BnlTZqvHAOAB E+IwXohDw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lONTb-00C2a8-5P; Mon, 22 Mar 2021 16:32:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lONTV-00C2Y2-BW for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 16:32:20 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 20B351042; Mon, 22 Mar 2021 09:32:16 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.23.154]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C7003F719; Mon, 22 Mar 2021 09:32:15 -0700 (PDT) Date: Mon, 22 Mar 2021 16:32:06 +0000 From: Mark Rutland To: Mark Brown Cc: Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arm64: stacktrace: Move start_backtrace() out of the header Message-ID: <20210322163206.GA80352@C02TD0UTHF1T.local> References: <20210319174022.33051-1-broonie@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210319174022.33051-1-broonie@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_163217_761396_D7D25E7B X-CRM114-Status: GOOD ( 28.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Mar 19, 2021 at 05:40:22PM +0000, Mark Brown wrote: > Currently start_backtrace() is a static inline function in the header. > Since it really shouldn't be sufficiently performance critical that we > actually need to have it inlined move it into a C file, this will save > anyone else scratching their head about why it is defined in the header. > As far as I can see it's only there because it was factored out of the > various callers. > > Signed-off-by: Mark Brown Given keeping this close to unwind_frame() makes it easier to see the whole story at once: Acked-by: Mark Rutland It'd be nice to see users of this all moved over to arch_stack_walk(), so that we can make this static along with walk_stackframe(), and have all stack walks using the same interface. Thanks, Mark. > --- > arch/arm64/include/asm/stacktrace.h | 24 ++---------------------- > arch/arm64/kernel/stacktrace.c | 24 ++++++++++++++++++++++++ > 2 files changed, 26 insertions(+), 22 deletions(-) > > diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h > index eb29b1fe8255..4b33ca620679 100644 > --- a/arch/arm64/include/asm/stacktrace.h > +++ b/arch/arm64/include/asm/stacktrace.h > @@ -148,27 +148,7 @@ static inline bool on_accessible_stack(const struct task_struct *tsk, > return false; > } > > -static inline void start_backtrace(struct stackframe *frame, > - unsigned long fp, unsigned long pc) > -{ > - frame->fp = fp; > - frame->pc = pc; > -#ifdef CONFIG_FUNCTION_GRAPH_TRACER > - frame->graph = 0; > -#endif > - > - /* > - * Prime the first unwind. > - * > - * In unwind_frame() we'll check that the FP points to a valid stack, > - * which can't be STACK_TYPE_UNKNOWN, and the first unwind will be > - * treated as a transition to whichever stack that happens to be. The > - * prev_fp value won't be used, but we set it to 0 such that it is > - * definitely not an accessible stack address. > - */ > - bitmap_zero(frame->stacks_done, __NR_STACK_TYPES); > - frame->prev_fp = 0; > - frame->prev_type = STACK_TYPE_UNKNOWN; > -} > +void start_backtrace(struct stackframe *frame, unsigned long fp, > + unsigned long pc); > > #endif /* __ASM_STACKTRACE_H */ > diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c > index 7337506d6a7f..4c889bd098af 100644 > --- a/arch/arm64/kernel/stacktrace.c > +++ b/arch/arm64/kernel/stacktrace.c > @@ -35,6 +35,30 @@ > * add sp, sp, #0x10 > */ > > + > +void start_backtrace(struct stackframe *frame, unsigned long fp, > + unsigned long pc) > +{ > + frame->fp = fp; > + frame->pc = pc; > +#ifdef CONFIG_FUNCTION_GRAPH_TRACER > + frame->graph = 0; > +#endif > + > + /* > + * Prime the first unwind. > + * > + * In unwind_frame() we'll check that the FP points to a valid stack, > + * which can't be STACK_TYPE_UNKNOWN, and the first unwind will be > + * treated as a transition to whichever stack that happens to be. The > + * prev_fp value won't be used, but we set it to 0 such that it is > + * definitely not an accessible stack address. > + */ > + bitmap_zero(frame->stacks_done, __NR_STACK_TYPES); > + frame->prev_fp = 0; > + frame->prev_type = STACK_TYPE_UNKNOWN; > +} > + > /* > * Unwind from one frame record (A) to the next frame record (B). > * > -- > 2.20.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel