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 74669C433FE for ; Mon, 28 Nov 2022 18:12:22 +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=wJTN7ZSFshD7YTBekJeZoLPPs3hun5OdC5xk5x3mAMQ=; b=ktX8zRflZZ+F8n 8YXFBuW4HZI8RGEYYJ0DKVmtv64IeStDkpLCdju43x8o6PFdBTw2S6V0qzzYMOSmMF0L4mWAJd2M7 RQFFbQ/xpd1B/+VoD9WxITklh4k6wx5UdJH+4HyX16D8rGHiwroJi3c+wRHZoQxl72gIvSW63OTLG PAgYf48Pv8W+B0RZePaCOqqXqUY6bIsqOgK3lrIbeHy26Y60xDTdtGbe4DInAzvWC3kNqEtUvQXX7 S7ccSWnrhnOu6ZyQofp04rRveRF04pGAcdwO02wKRdfkAJsOtjE8W8gFFob6lVNKQZ7GRwe35mU/d qL3ohKPJW+Y6mhXydKlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozib4-003QhK-FS; Mon, 28 Nov 2022 18:11:14 +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 1ozi8z-003As0-D6 for linux-arm-kernel@lists.infradead.org; Mon, 28 Nov 2022 17:42:15 +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 04C2EB80E81; Mon, 28 Nov 2022 17:42:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ADD0C433C1; Mon, 28 Nov 2022 17:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669657330; bh=3dvlsZ0crK7vigTaS1T23MKHxpBSClQQPfxLSsv+Jmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLxgQZEjLrW3RKAlV7bo3p4RX9t/if4Q8fORQ/T7pNg4dkwbj+8oQ5fk9ibzgZ5GL lpJKb25g0g2vP/rY+XjSgfrVING1KPy/cvYozY0IMMfIDF+47l1yv1R+0XcHXjQh6H M2uvgV41kE2dheScNuHhLG2tRSykaCCF2W4/VGsTSKyPGy6J4EKshUh048+iSPYGWj wPUGc8ArJ70WquuYbFf2W+cUahtuM0whmSvrrwomhlBERBF2+k7TqGSxWC8e7v55n7 HosbCUwWT1cCp6qI1WhHB48FdCQmuktN1EsMdLIGVc1MDB/s+6AUEeicTzTIg0c8wX AF0byNWgD+1aA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tomislav Novak , Linus Walleij , Russell King , Sasha Levin , peterz@infradead.org, mingo@redhat.com, acme@kernel.org, will@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 05/16] ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels Date: Mon, 28 Nov 2022 12:41:48 -0500 Message-Id: <20221128174201.1442499-5-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221128174201.1442499-1-sashal@kernel.org> References: <20221128174201.1442499-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_094213_672257_D57AA0A3 X-CRM114-Status: GOOD ( 13.55 ) 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 fe87397c3d8c..bdbc1e590891 100644 --- a/arch/arm/include/asm/perf_event.h +++ b/arch/arm/include/asm/perf_event.h @@ -17,7 +17,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