Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1890983ybl; Wed, 28 Aug 2019 23:58:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7oWVfkNmks07TIFrnp01M/6/JtYue6ULhEAfb9zo0xAGpVwsIRBfAfbopPAhQZIqlGnsP X-Received: by 2002:aa7:9682:: with SMTP id f2mr9314226pfk.256.1567061915004; Wed, 28 Aug 2019 23:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567061914; cv=none; d=google.com; s=arc-20160816; b=bESgT4fkL610yqiZG9zt9LalHK84ZK5AwMV7hPpNTDltHkksVUNbu6wqNMURwgm/6z 4bxBOy82qxD2zfd3nX0fkeXohOJlBok2RD78A5s+PrSTi21bbg6rSA37aQ3nTPe8sImJ QHk/6Mj6ZbfqfvXl4oj1Wi0+JJJ6GZqWHJtnypUCmKlaF7Kyp25kQ1Cq6JHeEwERsGXN HrI6iN60+MHoUVmRh8zuvgSyOcCazHL4pReyJbMf+crUzOvoTbjvAUsPZ+QQvg5HBcpy nJg99wJ6CH6O+9eltQ9E+WzskqNkdtuGoNMJHUJhJarfIm1CDIIiYL2urDLTZ4bx+Ll2 ZWwQ== 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=MSNZfEz+cbAmSOH6mF/867ziPs15CAXbWTtUT3fQZl8=; b=i3ebBYkYJxujmNXWT6nkS1J8UL+iSOcMvxw8kscTtZ+OekFw0jkVNMN7e2xU9NQ+fM pmtIXslPVoK0FYBtxCwFhvcW5WQRJQgyRWWJRAfEP3QE23z3TNmGGRO0iuXzcVXTlsp4 /ZtvbotMdNgpN46jzAK3ae+1oiWzxdJzxe/g35OcyCwVhgxxwF83pPwNVHmCx+LE19m2 G7nFhlrLHsZG5/onn26Wq6qgWOVJBpkHNYwNFJ2U+jVTyNUwBT6nw07szdIHgHC/zf4D StpBp4Ob1wycEzBsuybUsKMaWsGSG6bsB17u6uSJMCu1jngRjL291PYq7clHPReUVx2k SRtQ== 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 a9si1225503pgv.116.2019.08.28.23.58.19; Wed, 28 Aug 2019 23:58: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 S1727443AbfH2G5M (ORCPT + 99 others); Thu, 29 Aug 2019 02:57:12 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:37909 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfH2G5M (ORCPT ); Thu, 29 Aug 2019 02:57:12 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07443786|-1;CH=green;DM=CONTINUE|CONTINUE|true|0.555851-0.0983114-0.345837;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07391;MF=han_mao@c-sky.com;NM=1;PH=DS;RN=9;RT=9;SR=0;TI=SMTPD_---.FKpKZrt_1567061827; Received: from localhost(mailfrom:han_mao@c-sky.com fp:SMTPD_---.FKpKZrt_1567061827) by smtp.aliyun-inc.com(10.147.42.135); Thu, 29 Aug 2019 14:57:07 +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 V6 0/3] riscv: Add perf callchain support Date: Thu, 29 Aug 2019 14:56:59 +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 patch set add 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. 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 Cc: Paul Walmsley Cc: Greentime Hu Cc: Palmer Dabbelt Cc: linux-riscv Cc: Christoph Hellwig Cc: Guo Ren Mao Han (3): riscv: Add perf callchain support riscv: Add support for perf registers sampling riscv: Add support for libdw arch/riscv/Kconfig | 2 + arch/riscv/Makefile | 3 + arch/riscv/include/uapi/asm/perf_regs.h | 42 ++++++++++++ arch/riscv/kernel/Makefile | 4 +- arch/riscv/kernel/perf_callchain.c | 95 ++++++++++++++++++++++++++ arch/riscv/kernel/perf_regs.c | 44 ++++++++++++ arch/riscv/kernel/stacktrace.c | 2 +- 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 ++++++++++++++++ 15 files changed, 469 insertions(+), 3 deletions(-) create mode 100644 arch/riscv/include/uapi/asm/perf_regs.h create mode 100644 arch/riscv/kernel/perf_callchain.c 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