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 B3350C433EF for ; Fri, 22 Oct 2021 18:13:24 +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 799D1610A1 for ; Fri, 22 Oct 2021 18:13:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 799D1610A1 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=n6clg9c1JH94gU4vz9AhFDywnS47yoJadiYDxpz47GY=; b=dQO8BfhQmVIoRx /ldke3H2wpkdGlDbgb8SGZB8QuueGYJXFHsL4SEf1ay7xNWtKVvYovfIEpfr2diQ8Ff4sci/XzJti aC+H+m6E3eoMcy8UyJkukwyeeglrVD/GSvfX7cqYPMNzJOMCT0DZwPGjHlQmtcd9qTS1PKYYGMw3K 396Qe+tXasePsDcGKeXFLwLfE7gUjqfNakhFXdHFSkFPtKvMFJ5DGehcgi2Kh8TAAtC15fd8fhdb8 4u+nruL2F2ttq7DnWBG5L14OF6gv6kwDRZnDzy6otZ4CxhxVxuor+Qb2kYYXxbqB8W2LoRCYbrnDv p5pW0F8XZU51H2co7umw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdz1S-00Bj8I-2V; Fri, 22 Oct 2021 18:12:06 +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 1mdz1O-00Bj7Y-C3 for linux-arm-kernel@lists.infradead.org; Fri, 22 Oct 2021 18:12:03 +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 0A23B1063; Fri, 22 Oct 2021 11:12:00 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.73.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D3023F73D; Fri, 22 Oct 2021 11:11:57 -0700 (PDT) Date: Fri, 22 Oct 2021 19:11:54 +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 02/11] arm64: Make perf_callchain_kernel() use arch_stack_walk() Message-ID: <20211022181154.GM86184@C02TD0UTHF1T.local> References: <20211015025847.17694-1-madvenka@linux.microsoft.com> <20211015025847.17694-3-madvenka@linux.microsoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211015025847.17694-3-madvenka@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211022_111202_508191_7EE692BE X-CRM114-Status: GOOD ( 17.62 ) 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:38PM -0500, madvenka@linux.microsoft.com wrote: > From: "Madhavan T. Venkataraman" > > Currently, perf_callchain_kernel() in ARM64 code walks the stack using > start_backtrace() and walk_stackframe(). Make it use arch_stack_walk() > instead. This makes maintenance easier. > > Signed-off-by: Madhavan T. Venkataraman This looks good to me; bailing out when perf_callchain_store() can't accept any more entries absolutely makes sense. I gave this a spin with: | # perf record -g -c1 ls | # perf report ... and the recorded callchains look sane. Reviewed-by: Mark Rutland Tested-by: Mark Rutland As mentioned on patch 1, I'd like to get this rebased atop Peter's untangling of ARCH_STACKWALK from STACKTRACE. Thanks, Mark. > --- > arch/arm64/kernel/perf_callchain.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/arch/arm64/kernel/perf_callchain.c b/arch/arm64/kernel/perf_callchain.c > index 4a72c2727309..f173c448e852 100644 > --- a/arch/arm64/kernel/perf_callchain.c > +++ b/arch/arm64/kernel/perf_callchain.c > @@ -140,22 +140,18 @@ void perf_callchain_user(struct perf_callchain_entry_ctx *entry, > static bool callchain_trace(void *data, unsigned long pc) > { > struct perf_callchain_entry_ctx *entry = data; > - perf_callchain_store(entry, pc); > - return true; > + return perf_callchain_store(entry, pc) == 0; > } > > void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, > struct pt_regs *regs) > { > - struct stackframe frame; > - > if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) { > /* We don't support guest os callchain now */ > return; > } > > - start_backtrace(&frame, regs->regs[29], regs->pc); > - walk_stackframe(current, &frame, callchain_trace, entry); > + arch_stack_walk(callchain_trace, entry, current, regs); > } > > unsigned long perf_instruction_pointer(struct pt_regs *regs) > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel