From patchwork Fri Oct 15 02:34:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhavan T. Venkataraman" X-Patchwork-Id: 12559757 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 16E31C433EF for ; Fri, 15 Oct 2021 02:38:51 +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 C6C3360E09 for ; Fri, 15 Oct 2021 02:38:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C6C3360E09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.microsoft.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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v4JfvkRPJCcdczrWnpd9cvDM2iOrAxDX/IyZfGXeFXA=; b=ZGh1vsNB5n6oBB 3H/SYFa2LhBO9lof+EPcGQNPo7NroTCPrsZ/ZD6hM5+cAw387JfygrE1P3DZ3xxJJGHrI6alU12dH ChnpOw7GFOuFoJliIDUB1yCJhiF+9u6p46rFfjBuTF1SZwmlb84TgAQfr60jVt5OrOipGMIQ1FYg0 HhQ2rf3dy2eRd3uwQf1+DogG1AmrQibNzAad4Cn2Xc3cOLvjmNfw9QXd6kbIPhvEceFlhGRkXrGZK 9WHaYy4Ak5eCulHrFchETV2lBuNBwz1IM+k+FyXVtfIFDK/fgWiCxMEZprWuI3SdHqoaQUn+DJRGe VUEawMrVxfyU/2uGoySA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbD65-0055Vj-QL; Fri, 15 Oct 2021 02:37:26 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbD3k-0054MR-OV for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 02:35:02 +0000 Received: from x64host.home (unknown [47.187.212.181]) by linux.microsoft.com (Postfix) with ESMTPSA id 94E2720B9D20; Thu, 14 Oct 2021 19:34:59 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 94E2720B9D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1634265300; bh=AbsOg32zRR78sDGzy2GosMMSEjrzSM+M26cFHMLFAG8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AxuPDl0EUp2jhKj8zy5MtH4Otfmi0NjlrRhtyg44gpP6SeHWkhDCIaxi+1/WG6qMb 5Jan6CTcJFzchLGAEGHOBlKXpoiHfa7xbAONA5ow7bOrmvUNduGEdNbhdZQw6pSZk7 vjQVKoRPHlfprnS3+Rq45Yi+guBCYNfPIL4mNUXs= From: madvenka@linux.microsoft.com To: mark.rutland@arm.com, 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, madvenka@linux.microsoft.com Subject: [PATCH v9 06/11] arm64: Make profile_pc() use arch_stack_walk() Date: Thu, 14 Oct 2021 21:34:10 -0500 Message-Id: <20211015023413.16614-9-madvenka@linux.microsoft.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211015023413.16614-1-madvenka@linux.microsoft.com> References: <20211015023413.16614-1-madvenka@linux.microsoft.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211014_193500_862953_E8D619E1 X-CRM114-Status: UNSURE ( 9.62 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; - 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);