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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A8F83C433FE for ; Mon, 28 Nov 2022 18:26:07 +0000 (UTC) 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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YCTKo4cQXzEboAFoWmoaEvV7+reiGxVO+OIE213ooDs=; b=1M+5AlsbVsNlsE 6qFNzpRoijb48xy15S2mV9egV9j7zpcLaGUiimL9i/9EODyZhAAc1NUFs2SKK2Ol6UqrXruuECQtR 2DRwflmGeJvyPdS21Ahgy1r2tB6FZ3/Wo22TNaWWXxEht2ckf4o9P5OpwcHImzRO39pjx2BJ+YHLH yUQ23pm5cmBI8T1J/6B5lm02NXUd5gQRCEhPfWNSK9Eg3cOSR2XJhEIAyH4DPOJd9EnzqlqbDBZRw Hi+COqoys2nYY30ATzVxHKtKU3K39u7C8o+s+UhkwvkzdmEBIe0iwjI8meV6rfA/gO7fs5C4STCsc Y+efnBuIESh0DVsiUciw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozioK-003Y9H-I6; Mon, 28 Nov 2022 18:24:57 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oziAG-003Bab-Ld for linux-arm-kernel@lists.infradead.org; Mon, 28 Nov 2022 17:43:35 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D73EB80E85; Mon, 28 Nov 2022 17:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE2AEC4347C; Mon, 28 Nov 2022 17:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669657410; bh=+5GGC/8eufWXSVnOGBvw3X8yB+l1PO1V+/FGgW8gFtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SWJHqDSw4erVSA9QC2FTkfU83IR79QQmph+qwIzyMpmSYuox4oTp/6LX9nv7T9NuI uyooqkDnBzeA5gmAX+iANVfz7nc5+LQBBkGzcbrAJDXcc95cyFMht9Gcoc++8NxLg7 2jSxSrYNlGmxbQ/wYREpkbLk4hfaZ2YQJggaMYGX2+hej2nnkku0kldXMebRcEc3sW Y4V8iNIZczpgKOIvpjn0BLmafrHKxObtWFmpYd1kmqqwjex0tIie3cXGrEkza7Lt/D DAF96Yc9gGZOSvjyXORRX9N5h9J8XzCRUDzW0J1G03ZXzRoySmRJm/F9msrY/Lvn9G N7c13aDtTDSTg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tomislav Novak , Linus Walleij , Russell King , Sasha Levin , will@kernel.org, mark.rutland@arm.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 3/5] ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels Date: Mon, 28 Nov 2022 12:43:21 -0500 Message-Id: <20221128174324.1443132-3-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221128174324.1443132-1-sashal@kernel.org> References: <20221128174324.1443132-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221128_094332_944541_07E8F38F X-CRM114-Status: GOOD ( 12.78 ) 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 From: Tomislav Novak [ Upstream commit 612695bccfdbd52004551308a55bae410e7cd22f ] Store the frame address where arm_get_current_stackframe() looks for it (ARM_r7 instead of ARM_fp if CONFIG_THUMB2_KERNEL=y). Otherwise frame->fp gets set to 0, causing unwind_frame() to fail. # bpftrace -e 't:sched:sched_switch { @[kstack] = count(); exit(); }' Attaching 1 probe... @[ __schedule+1059 ]: 1 A typical first unwind instruction is 0x97 (SP = R7), so after executing it SP ends up being 0 and -URC_FAILURE is returned. unwind_frame(pc = ac9da7d7 lr = 00000000 sp = c69bdda0 fp = 00000000) unwind_find_idx(ac9da7d7) unwind_exec_insn: insn = 00000097 unwind_exec_insn: fp = 00000000 sp = 00000000 lr = 00000000 pc = 00000000 With this patch: # bpftrace -e 't:sched:sched_switch { @[kstack] = count(); exit(); }' Attaching 1 probe... @[ __schedule+1059 __schedule+1059 schedule+79 schedule_hrtimeout_range_clock+163 schedule_hrtimeout_range+17 ep_poll+471 SyS_epoll_wait+111 sys_epoll_pwait+231 __ret_fast_syscall+1 ]: 1 Link: https://lore.kernel.org/r/20220920230728.2617421-1-tnovak@fb.com/ Reviewed-by: Linus Walleij Signed-off-by: Tomislav Novak Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/include/asm/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h index 4f9dec489931..c5d27140834e 100644 --- a/arch/arm/include/asm/perf_event.h +++ b/arch/arm/include/asm/perf_event.h @@ -21,7 +21,7 @@ extern unsigned long perf_misc_flags(struct pt_regs *regs); #define perf_arch_fetch_caller_regs(regs, __ip) { \ (regs)->ARM_pc = (__ip); \ - (regs)->ARM_fp = (unsigned long) __builtin_frame_address(0); \ + frame_pointer((regs)) = (unsigned long) __builtin_frame_address(0); \ (regs)->ARM_sp = current_stack_pointer; \ (regs)->ARM_cpsr = SVC_MODE; \ } -- 2.35.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel