Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp334415lqh; Mon, 6 May 2024 23:46:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU3l2PwzusxULa4XqWuBRmP1PJ5t7c9uXDfm/y+rhI8GYzEm+vbjKXE7bEFGgoxUMVD85tqcsK27lrOkZo1kAMbgxedouX02Cf/TqJF0w== X-Google-Smtp-Source: AGHT+IE4vQ1/tFBCisYkMuayKUajeh5v5vPEGZqpJ+BphpaBJat2oso8/VLw4hAVEDeNonWzb4SZ X-Received: by 2002:a05:6a00:2d2a:b0:6ed:1c7:8c65 with SMTP id fa42-20020a056a002d2a00b006ed01c78c65mr16652788pfb.10.1715064389745; Mon, 06 May 2024 23:46:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715064389; cv=pass; d=google.com; s=arc-20160816; b=Q6U7/xk9XrME3qZ4zelBWjl9g7crJjwV5O9lgVHydh5djzsEkX5gRBVUxxLzV3xtUr WsAupfjQGexVw2z/IF9yLxNC7EqbGeY/dfcpSVyr4NNC23pedcbiDe3X5PcXgcIIvu6c UCe7om2A9dVMYmp3Op4xCARwFEObmRNP4Lg28a7EcL5obVqqgW1U8RVpDrZBUYXUVCy5 3Mi5Chys1MN8R8RfvamlabzByqFeNxtmJflzTFRwy+keWXl9ohw+GjjJ9H7H4qiAgzKo jG98GqX0V8i+yfQH8+5WaGl846tEhuNcbcDw2jG6jxey2w94pGtiyWiLhOWngC83MvE7 Rw7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=cKxo5F1ggU0I9G+oNRUxwnE98CtfU0aPDdniIwCtAL4=; fh=YAiB8IhU/xhVSMzxrXyzmIKQXraNA5ZCXdhpkDqJpf8=; b=yfA4yBa3qPtfiUcisTEB5/xuNfke7Wr32EIimNdii882ilPsfSG+c1l+17K8ctxx1O 7RyjBUilnQueTtU+wAG9GUblI3OTEePe/JYL/Bjecz68vGTOrsck/WpyPPNonsUvSXOe acptBgn7vc23a2FAtRTmsy6HIsOJ8ZAv0ZFHMsUFYz8T8/q9E9aB0fHHX8LivUFcGiBi SuZQ11I09I7KXfzg82GG9TdtHz8D4lsnHHpYdQv8dt3HNwjDWsyTEqJiRapf6r4bKElQ 6abHOTNlAuUfz5dD3ysbpHG7ONmN4BtSAOoOBiKaindMQf3t9OZeE0b8mq85m0Tpw/nE SuuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-170772-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170772-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k6-20020a636f06000000b005f7518f27b5si9793662pgc.470.2024.05.06.23.46.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 23:46:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170772-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-170772-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170772-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B3BB4B225FC for ; Tue, 7 May 2024 06:44:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A144478C89; Tue, 7 May 2024 06:44:45 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 216616D1CC; Tue, 7 May 2024 06:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715064285; cv=none; b=OiG9wRo0in2stUPhuZbWS3bY1uCaBGey7SZTrZd0mzhJOSdhvD1ddZuloberaSLPeAc5u6UMTQDypNvJMCDy/nkCxNx6QeKJMIbzRqqoOoF5OnwGw4/Jx89wyYSptWWP4XLADO7Ax81wC1AUxeOOZwKTU/XZjirjM8Tq0XNsFNw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715064285; c=relaxed/simple; bh=1V7K+aUPbBwWZ9MVf0X+WSKhleKpWp++FFeYZHejQg0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jzUGraDRV6nxZXeC0kMb+L7fDRgJO2W78GalQ89JrQK0inEaJteSYMHhr0ZMX/ZlvniSmdGZUPzzA61Q4i8UE/0l1VSbA7Lfb+KzsZLrhLgTZfePrBaXYomZJuO22Wnn7aYQhAFjvRGdplRotGuFO8CEw50DWI/Gelx7spjutxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04D41C2BBFC; Tue, 7 May 2024 06:44:41 +0000 (UTC) From: Huacai Chen To: Arnd Bergmann , Huacai Chen Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , Xuerui Wang , Jiaxun Yang , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Huacai Chen Subject: [PATCH] LoongArch: Fix callchain parse error with kernel tracepoint events again Date: Tue, 7 May 2024 14:44:18 +0800 Message-ID: <20240507064418.3407414-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit With commit d3119bc985fb645 ("LoongArch: Fix callchain parse error with kernel tracepoint events"), perf can parse kernel callchain, but not complete and sometimes maybe error. The reason is LoongArch's unwinders (guess, prologue and orc) don't really need fp (i.e., regs[22]), and they use sp (i.e., regs[3]) as the frame address rather than the current stack pointer. Fix that by removing the assignment of regs[22], and instead assign the __builtin_frame_address(0) to regs[3]. Without fix: Children Self Command Shared Object Symbol ........ ........ ............. ................. ................ 33.91% 33.91% swapper [kernel.vmlinux] [k] __schedule | |--33.04%--__schedule | --0.87%--__arch_cpu_idle __schedule With this fix: Children Self Command Shared Object Symbol ........ ........ ............. ................. ................ 31.16% 31.16% swapper [kernel.vmlinux] [k] __schedule | |--20.63%--smpboot_entry | cpu_startup_entry | schedule_idle | __schedule | --10.53%--start_kernel cpu_startup_entry schedule_idle __schedule Fixes: d3119bc985fb645 ("LoongArch: Fix callchain parse error with kernel tracepoint events") Signed-off-by: Huacai Chen --- arch/loongarch/include/asm/perf_event.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/loongarch/include/asm/perf_event.h b/arch/loongarch/include/asm/perf_event.h index 52b638059e40..f948a0676daf 100644 --- a/arch/loongarch/include/asm/perf_event.h +++ b/arch/loongarch/include/asm/perf_event.h @@ -13,8 +13,7 @@ #define perf_arch_fetch_caller_regs(regs, __ip) { \ (regs)->csr_era = (__ip); \ - (regs)->regs[3] = current_stack_pointer; \ - (regs)->regs[22] = (unsigned long) __builtin_frame_address(0); \ + (regs)->regs[3] = (unsigned long) __builtin_frame_address(0); \ } #endif /* __LOONGARCH_PERF_EVENT_H__ */ -- 2.43.0