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 59020C4708A for ; Mon, 28 Nov 2022 18:16:06 +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=dXAJn53HM4R4ZV wCW+wvOGKgZXo39N6ebc0J1E9yk9pRUD2mDifIDKJ4ur2QdSnUwRpmYW18U8akOvCHZtEQQ7gZcV+ iym+2/O3ojv/oZWTcKtXS10Dg/RYvBlnhPKxa2nNtHBHyScMTO1Lk/2ZzKQemXpsp81GpES8CXphC DuNPZfkbwVRSmBjiEG3EFFXHLC93Nf7/ka5xlBjkyJ1a6whzvzoVDzWyFJjFTu+igq0Gt0lY33b7P 4bt2l+3XzBLAfDmjRxabYZTj/de8FuHfoFuj8g1lap9e6VwqdcMo5u8rzzq9oZuc71Y3MBYkVr5bH Hz49OBjzT8wapfNEfsAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozieh-003Sm4-Ho; Mon, 28 Nov 2022 18:14:59 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozi9S-003B7Y-HP for linux-arm-kernel@lists.infradead.org; Mon, 28 Nov 2022 17:42:44 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 05EAE612ED; Mon, 28 Nov 2022 17:42:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2588EC433D7; Mon, 28 Nov 2022 17:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669657361; bh=+5GGC/8eufWXSVnOGBvw3X8yB+l1PO1V+/FGgW8gFtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JGHyck9iNtFAGJghvofRaQ+NKcC2FkIKVkJIGF0WOtRmDwuTwYBkHm9ozBRQumq+0 zZ8SWhgm2liYiodPq9DmD+SmNrb1+QLs0DCBkq+jY/SNX5sbCDLaSYcXIb1cjdpPRB qS3g7iuBhUx5URxp+V9i6KWDJFD4N0GY/mmNShef42Eg68rxE/7fN6n2nmxQP2KhP8 BSOCyDGGbKoj/85s5whKbZCLri588MyGofXcWAgxS+rOzB5MBnwoBUZfR6PONRBTMG +m0j6bKJ6mkcm7XWlyOHjRT1xJjhKuok9cUGY3HwtZkCmnUGZsbMGZIPYqZCx1jbel sxip2bOtiCbxA== 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.19 03/12] ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels Date: Mon, 28 Nov 2022 12:42:26 -0500 Message-Id: <20221128174235.1442841-3-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221128174235.1442841-1-sashal@kernel.org> References: <20221128174235.1442841-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_094242_704227_D85DCA08 X-CRM114-Status: GOOD ( 13.36 ) 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