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 AB85BC4332F for ; Mon, 28 Nov 2022 18:21:35 +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=brbnTvw9mXS9bE CVxc7EdO/lKo2xOep+GzukUv9Sa8RDzQLX6jMxHdbsmo77E5dlm/jvZsbLJeGJd3Wf1/lKmUxSJbP JMgxJo8rONsgCIeTNvTWMLNsqd6PaeM8fTePV6fDUJVqHqfVdH4k2/A23ohaNDyb+CG3M9Jch7G2L 6FJ+1geIvVbmazqnFC4ZlIXx/wGGmqsK1FTYC9Fhg3U6/7YfTkbIyV9pluhjdqBmgyfeIkfMzvUWC KesfgET52rUVJO81VAXb6AzI5N7zt3AE3GQGKcWbZy/JeYrad/t9TReyGc1Y4tYKIt4DsnyTXcchz 9oa7nUsgFm1geR6PU+EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozik1-003VnX-KP; Mon, 28 Nov 2022 18:20:29 +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 1ozi9u-003BNE-67 for linux-arm-kernel@lists.infradead.org; Mon, 28 Nov 2022 17:43:12 +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 AFFDE612D2; Mon, 28 Nov 2022 17:43:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7AAAC43470; Mon, 28 Nov 2022 17:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669657389; bh=+5GGC/8eufWXSVnOGBvw3X8yB+l1PO1V+/FGgW8gFtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gyv/UkFEQS/ef6VPs9qePlP0i6He1fbOZpmH42lzfaI2NsMg6a1xJzISuJGvUutEQ giFbr36TantQaNkf+gtcQI/34Ny8pohP5CU4Wi46ifWkG+vUr3T3dhJzLZoCsSB+7e iAKbS5ROJcz/YNa1RS+zG73vo0FseQv0BhjZ729ot4/qsvig+gAowogrISv1wQWOpI 0AAiQkJfVfhHcE5v7iwCtNnJVkDqemgKAPTpcWExZH36mltG/LtIlNhch2QGjU+i0Z woI2bE2d1oMLJjZIxTiZ1FRAOFKGM1XByctiLX51HXENhhPNK6sw/slkWUG3iPs/tI iTH17vpbm3eMw== 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.14 3/9] ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels Date: Mon, 28 Nov 2022 12:42:56 -0500 Message-Id: <20221128174303.1443008-3-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221128174303.1443008-1-sashal@kernel.org> References: <20221128174303.1443008-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_094310_306138_35B379AF 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