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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CD9DC433F5 for ; Wed, 27 Oct 2021 13:33:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 4DB9A60F6F for ; Wed, 27 Oct 2021 13:33:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4DB9A60F6F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=yvn9VUYDoF1S/MbYNf/RpT8xo9jFPonLg9zU6OtS+iw=; b=GHBEUlXZi+VjD3 0euM8zEyF0IrWkrLcpAmCfq2BFxsy8tLItthZkNwiEcT3geQFzbbwcUakqT8xo/6X831Hlp6bkpIO s0yie+Y8TQAiDk3wdWsVGrFcpXVgGsj9RKmRU2fDuKspKDJwMfhqcDja8TqZd44q99rP0hMZNow84 lVjHjDDDTz9VXetFqcFI08yp+zxbFZG0Rs9zCAytDM3NzbpgfWBLDWIRymzdcehWyYiY0phPjZVZi Cea1r4mecXMdz4HIF+nEHlqdTPPTSypdf4Xbw2vKRSnV9D62t+tQhNOKhDkdhAxtm8NctXx0NuEX3 4cuP1mYFqS6MrUiWJ3VQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfj2W-004zIZ-EZ; Wed, 27 Oct 2021 13:32:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfj2S-004zHd-N4 for linux-arm-kernel@lists.infradead.org; Wed, 27 Oct 2021 13:32:22 +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 94F7D1FB; Wed, 27 Oct 2021 06:32:17 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.72.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F18073F73D; Wed, 27 Oct 2021 06:32:14 -0700 (PDT) Date: Wed, 27 Oct 2021 14:32:12 +0100 From: Mark Rutland To: madvenka@linux.microsoft.com Cc: broonie@kernel.org, jpoimboe@redhat.com, ardb@kernel.org, nobuta.keiya@fujitsu.com, sjitindarsingh@gmail.com, catalin.marinas@arm.com, will@kernel.org, jmorris@namei.org, linux-arm-kernel@lists.infradead.org, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10 06/11] arm64: Make profile_pc() use arch_stack_walk() Message-ID: <20211027133212.GG54628@C02TD0UTHF1T.local> References: <20211015025847.17694-1-madvenka@linux.microsoft.com> <20211015025847.17694-7-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211015025847.17694-7-madvenka@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_063220_822882_1A9A13D1 X-CRM114-Status: GOOD ( 18.19 ) 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 Thu, Oct 14, 2021 at 09:58:42PM -0500, madvenka@linux.microsoft.com wrote: > From: "Madhavan T. Venkataraman" > > Currently, profile_pc() in ARM64 code walks the stack using > start_backtrace() and unwind_frame(). Make it use arch_stack_walk() > instead. This makes maintenance easier. > > Signed-off-by: Madhavan T. Venkataraman > --- > arch/arm64/kernel/time.c | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c > index eebbc8d7123e..671b3038a772 100644 > --- a/arch/arm64/kernel/time.c > +++ b/arch/arm64/kernel/time.c > @@ -32,22 +32,26 @@ > #include > #include > > +static bool profile_pc_cb(void *arg, unsigned long pc) > +{ > + unsigned long *prof_pc = arg; > + > + if (in_lock_functions(pc)) > + return true; > + *prof_pc = pc; > + return false; > +} > + > unsigned long profile_pc(struct pt_regs *regs) > { > - struct stackframe frame; > + unsigned long prof_pc = 0; > > if (!in_lock_functions(regs->pc)) > return regs->pc; This can go -- the first call to profile_pc_cb() will use regs->pc. With that gone, and the include updates to use : Reviewed-by: Mark Rutland Mark. > - start_backtrace(&frame, regs->regs[29], regs->pc); > - > - do { > - int ret = unwind_frame(NULL, &frame); > - if (ret < 0) > - return 0; > - } while (in_lock_functions(frame.pc)); > + arch_stack_walk(profile_pc_cb, &prof_pc, current, regs); > > - return frame.pc; > + return prof_pc; > } > EXPORT_SYMBOL(profile_pc); > > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel