Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp311992ybe; Wed, 4 Sep 2019 20:48:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqwr1chNpkl2NdnVqsy8q+/SxBG+3u6e+Ufwz1EOSvJ36AQasx+sMXJrOBEk3t5K6n9N3Di6 X-Received: by 2002:a17:902:ac8e:: with SMTP id h14mr1217726plr.168.1567655314875; Wed, 04 Sep 2019 20:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567655314; cv=none; d=google.com; s=arc-20160816; b=VZ+HXyOiU8aGgLBLqP6GSDNcHkcjU2VIS7t0Ao+V40zjfxMCqmOWyvBWCplupdaSGW 7CPsfyzdKY8tomYh3ajq7z4nRbnrXB5BR1PMZyQq2IgmgfPktFaBe62My4hRwIePZaXV P+mBTgtKajsbCVkht6XnF/YoiUhi9ONA9IEk/fYDryT2LBm76ta/JPbn9Dz9qoUx/+Yz WpoobX2vBfxsfydHzDmVanWp2sjfXU2uj7YzY+6ML9bbNKnBMl5oYcbtgVfrater5tB6 75Tf6uCap0+QRkE3GRecula/z5Z6SEDvOGeqBhc8igpFDejmt7Ack9HKnw8F7Dw//6Z0 SXfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=TnWvZ+vyt6cLAJC6oUHj0Qh09bYvygvcTlcqgHQuYtc=; b=FssSCqtNjwbVglHTGUauDFUI8AfWL9YMp4xqW1x6mYlg24fVztix2RryL2oNBo1K8V grp1p3/ZKOkkDCThhhLPCfblao8KZhDvBTZPzYcSQVsupyECBbd1j1nVVfUQN1U3JICs LxFvISz68duuhLyr8idEkjsJIgdy7TAzKHQtMLu8Y9Ev/Ra3Sz6XJ4rAXvhVXrVOSBcD 5+D8KP+0lP0ijpET4v99m67lMtC1Ud9qmm5MgFm7qDpLntetzjNdm2ijDxQC2nKxxiRA iRz2oVuqwlwGBksD/CoFDIN8Oed+t37A7SFA2MkcUX1L/HWqTB79Re6Mp4zKDpdm8Pqs Kcog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si785606pfc.222.2019.09.04.20.48.19; Wed, 04 Sep 2019 20:48:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730985AbfIEDqo (ORCPT + 99 others); Wed, 4 Sep 2019 23:46:44 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:36994 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730112AbfIEDqo (ORCPT ); Wed, 4 Sep 2019 23:46:44 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07439447|-1;CH=green;DM=CONTINUE|CONTINUE|true|0.453906-0.11693-0.429164;FP=0|0|0|0|0|-1|-1|-1;HT=e01l10434;MF=han_mao@c-sky.com;NM=1;PH=DS;RN=9;RT=9;SR=0;TI=SMTPD_---.FP-7udU_1567655200; Received: from localhost(mailfrom:han_mao@c-sky.com fp:SMTPD_---.FP-7udU_1567655200) by smtp.aliyun-inc.com(10.147.40.44); Thu, 05 Sep 2019 11:46:40 +0800 From: Mao Han To: linux-riscv@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, Mao Han , Paul Walmsley , Greentime Hu , Palmer Dabbelt , Christoph Hellwig , Guo Ren Subject: [PATCH V7 0/2] riscv: Add perf callchain support Date: Thu, 5 Sep 2019 11:46:34 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset adds perf callchain(FP/DWARF) support for RISC-V. It comes from the csky version callchain support with some slight modifications. The patchset base on Linux 5.3-rc6. The patchset has some 'checkpatch.pl --strict' warnings: WARNING: Use #include instead of #141: FILE: tools/perf/arch/riscv/include/perf_regs.h:9: +#include CHECK: Avoid CamelCase: #329: FILE: tools/perf/arch/riscv/util/unwind-libdw.c:9: +bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg) CHECK: Avoid CamelCase: #333: FILE: tools/perf/arch/riscv/util/unwind-libdw.c:13: + Dwarf_Word dwarf_regs[32]; As all the other Linux architectures use asm/perf_regs.h directly and get these camelcases, I didn't try to fix them. Changes since v6: - add "WITH Linux-syscall-note" for uapi headers. Changes since v5: - use walk_stackframe from stacktrace.c to handle kernel callchain unwinding(fix invalid mem access) Changes since v4: - Add missing PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET verified with extra CFLAGS(-Wall -Werror) Changes since v3: - Add more strict check for unwind_frame_kernel - update for kernel 5.3 Changes since v2: - fix inconsistent comment - force to build kernel with -fno-omit-frame-pointer if perf event is enabled Changes since v1: - simplify implementation and code convention Signed-off-by: Mao Han Cc: Paul Walmsley Cc: Greentime Hu Cc: Palmer Dabbelt Cc: linux-riscv Cc: Christoph Hellwig Cc: Guo Ren Mao Han (2): riscv: Add support for perf registers sampling riscv: Add support for libdw arch/riscv/Kconfig | 2 + arch/riscv/include/uapi/asm/perf_regs.h | 42 ++++++++++++ arch/riscv/kernel/Makefile | 1 + arch/riscv/kernel/perf_regs.c | 44 ++++++++++++ tools/arch/riscv/include/uapi/asm/perf_regs.h | 42 ++++++++++++ tools/perf/Makefile.config | 6 +- tools/perf/arch/riscv/Build | 1 + tools/perf/arch/riscv/Makefile | 4 ++ tools/perf/arch/riscv/include/perf_regs.h | 96 +++++++++++++++++++++++++++ tools/perf/arch/riscv/util/Build | 2 + tools/perf/arch/riscv/util/dwarf-regs.c | 72 ++++++++++++++++++++ tools/perf/arch/riscv/util/unwind-libdw.c | 57 ++++++++++++++++ 12 files changed, 368 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/include/uapi/asm/perf_regs.h create mode 100644 arch/riscv/kernel/perf_regs.c create mode 100644 tools/arch/riscv/include/uapi/asm/perf_regs.h create mode 100644 tools/perf/arch/riscv/Build create mode 100644 tools/perf/arch/riscv/Makefile create mode 100644 tools/perf/arch/riscv/include/perf_regs.h create mode 100644 tools/perf/arch/riscv/util/Build create mode 100644 tools/perf/arch/riscv/util/dwarf-regs.c create mode 100644 tools/perf/arch/riscv/util/unwind-libdw.c -- 2.7.4