From patchwork Thu Oct 17 00:25:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839161 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 888C1D2F7D7 for ; Thu, 17 Oct 2024 00:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mFoNBRLqrUgqoIcVjkPQD2Pr1/YcjMFPTvmF3zk2fK4=; b=0G4Ew+isxpr7ysuxQTTuQOe3Jl RdNMbIcBScSGPdKraOsrCMZfk0rjSCExyXm+fs+hd83odgES0LZ/bGbrO7LYU8jJBtp/pBBv3/5Vg H2oQYSbt4ZO5NJFAjcgwMBBhBfUhqxCUiduuNg/pTQ/nqG/KEh/pEJBa6VRUuCJdlDW6GNCb2PPDW AEtskoO9k4y9IH8JtBjMRtWIu06+URIiq5+3EdQ7Ri9eU6UQl6vSEA66i9mtHYgrKAN0OBL1i9M46 tblO/6Wl+BLaX6uTttxgXcC+nxN+7pQuxu494elSfNJAuvqJo84cnpSW3ng7g197Ag8vVJWqDe0iN gRbpegRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Eo0-0000000DOpi-2Cpo; Thu, 17 Oct 2024 00:55:58 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKZ-0000000DK5u-26Jv for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:32 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e293150c2c6so814616276.1 for ; Wed, 16 Oct 2024 17:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124730; x=1729729530; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=mFoNBRLqrUgqoIcVjkPQD2Pr1/YcjMFPTvmF3zk2fK4=; b=DKrTBCBHPRm2Vf3vJPq8x4VXldbYLqH8PpND4AKcCc5pYVkrtdiW+BKHtfa2139/zP O4hS7G5Z0FrNpKOP//20do1i4eqjDu0nXMJ3x+7pR1OVupuEDBA37nnPC4+8T+YPa9pc V1FSwTkyBL2MqdzlaExPRjV/iwFbLtj+GcMoOMR+cHsuqjxBy9Da59MUufstwU70Up1O xUheCGW2kI+uphcySGmQE1Ebve+k+KeJNSmmNEvstEktquhjDM1kT0YtfPUlYod2rIOW AqBejBvGOnG/B03hpZTicSIVL0hnAXqQQ7SPXmhzf0x+0lBIt1P14wYHT4q2PkoYIUbH 5KCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124730; x=1729729530; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mFoNBRLqrUgqoIcVjkPQD2Pr1/YcjMFPTvmF3zk2fK4=; b=Dj4aCCriBlv4VhG8hpXBQn+tvOQb86DE2W0IVrGF4+rBowPRXYtYGQq+S6LdvMxrH8 apDBqLw1oiOhwiuUdI0xx6o1WZsq7OnhynZwyoitT2DwAapW3GH1aMe6Rd9DK21FsskX EmAfGHNJ84VvFZ+9TFmc2vl8AVeRdXUiDocXjSutPgOTX72CVriJxzs/9zTqyC5AVjCp skTdJU60Hz6ukpxoSIIXbdwGgcK8gynEAzCXeDjpeRj3NioPzViPzPhoPNqOZ1XkZfWX zHJ/HjCLYxsZriJaZeL7htJHbf/oDe+e7m+Y/NYy4zK8xG31E/PF4jDHn+jkfwUHtgIW 3I1Q== X-Forwarded-Encrypted: i=1; AJvYcCVblEIUwXRwwkaW75royTum+yqNbjzLtSJWMFjpY7hzywNmBDoSlJdEsKFoNeIiNiEN4gOrv8h0GCXfJEIP23hu@lists.infradead.org X-Gm-Message-State: AOJu0YxY94dYO7O4BWS+5Ez1CGHjCXRjQ3Ch7Xy9uORsyYWGrKSsQIQ7 5w4raF6Wm45d2qS8oa/0Yrt2pEMWlFD05GDrftbqyujEIsL2o+JzrIbpOf9tz+gcLZ4L5+8KgZ1 8U7Cj0Q== X-Google-Smtp-Source: AGHT+IH7A47NlLkmI7JyY+lLOU6RNU024zTixWHwEAwzVgMoGJoUi31CPQwu7Zqb3utm3XVl/ZEc2m8pfELj X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:6902:50d:b0:e28:eee0:aaa1 with SMTP id 3f1490d57ef6-e29782e9f6fmr3106276.4.1729124729872; Wed, 16 Oct 2024 17:25:29 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:01 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-2-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 01/20] perf bpf-prologue: Remove unused file From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172531_562046_EB91BC46 X-CRM114-Status: GOOD ( 12.26 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 4a73fca22692 ("perf bpf-prologue: Remove unused file") missed cleaning up the header file. The code was unnecessary as Commit 3d6dfae88917 ("perf parse-events: Remove BPF event support") removed building bpf-prologue.c. Fixes: 4a73fca22692 ("perf bpf-prologue: Remove unused file") Signed-off-by: Ian Rogers --- tools/perf/util/bpf-prologue.h | 37 ---------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 tools/perf/util/bpf-prologue.h diff --git a/tools/perf/util/bpf-prologue.h b/tools/perf/util/bpf-prologue.h deleted file mode 100644 index 66dcf751ef65..000000000000 --- a/tools/perf/util/bpf-prologue.h +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2015, He Kuang - * Copyright (C) 2015, Huawei Inc. - */ -#ifndef __BPF_PROLOGUE_H -#define __BPF_PROLOGUE_H - -struct probe_trace_arg; -struct bpf_insn; - -#define BPF_PROLOGUE_MAX_ARGS 3 -#define BPF_PROLOGUE_START_ARG_REG BPF_REG_3 -#define BPF_PROLOGUE_FETCH_RESULT_REG BPF_REG_2 - -#ifdef HAVE_BPF_PROLOGUE -int bpf__gen_prologue(struct probe_trace_arg *args, int nargs, - struct bpf_insn *new_prog, size_t *new_cnt, - size_t cnt_space); -#else -#include -#include - -static inline int -bpf__gen_prologue(struct probe_trace_arg *args __maybe_unused, - int nargs __maybe_unused, - struct bpf_insn *new_prog __maybe_unused, - size_t *new_cnt, - size_t cnt_space __maybe_unused) -{ - if (!new_cnt) - return -EINVAL; - *new_cnt = 0; - return -ENOTSUP; -} -#endif -#endif /* __BPF_PROLOGUE_H */ From patchwork Thu Oct 17 00:25:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839188 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 EBCBED2F7D7 for ; Thu, 17 Oct 2024 01:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3NsEr7msd173iKSV9/VCmecavKBITUiPRN43mS0QcMU=; b=svZ6Pu2JHmSP7mXkPMT1oO0syA aM7nIWfR+Z1bvCDxJV4hx9OlMI8e3GmmyXJ+Off7C9qIKhoMmF8kXQt3eVIr4tfnTPZGHWjjBTW/E ngVHUidvRuvaRWFwMW0dix4Ml8Jd1zqpDH60AnxlN4FM0/T5vFLJ+vNCDtrxorPuhwSnw+GjbkfNJ 8Q4W5tn/DYOQKIN+i7t9SiOHU8oQtfIkLaPlYxXXlK6QXJSzjU+goKpCMTM0oldihRexPGIb08RCd Omy4/XMQGI56LSMb2drCgVpl1vDgg5MlYewvNTtHZMKTUfa8Gh6OPTAyIQzAg+jLrPh/SGiJ47qxh /m3kFwEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1F42-0000000DQar-3gyw; Thu, 17 Oct 2024 01:12:30 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKc-0000000DK71-2Ur6 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:36 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6e28b624bfcso10028337b3.2 for ; Wed, 16 Oct 2024 17:25:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124733; x=1729729533; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=3NsEr7msd173iKSV9/VCmecavKBITUiPRN43mS0QcMU=; b=gfRZ94i+XJLf2lcdqW+EWJGCwlLqvYKhpS5pSYxv6hdEGA0vXdTadBgN154QHRTw5h Um6G0m2lIkFk65NPOEhgfWhp6Pw1A5s/f8G0NSRq/jYzCYKbO7YepZ5hQ/TCUiqnbBD0 Q65BKSUlzPA/Js5GWeJpV8Y4A+mHZxggDVn6pGr+zKGTNoK2fv8qx5xLmnRDMJJLItXl KoKS/NhCuTwbNkxYvdjrIVmvBHWe3IQXmAhy7C1x51oNhV7nbpsZSRfgQ3gPeA9jl4k1 2bpwJoBp7852Lbh+RSm47QF+GGT/hmpbdB2o19fdfHKUosVGpsr8HIhhYqHu6ZiZVYCy LZsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124733; x=1729729533; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3NsEr7msd173iKSV9/VCmecavKBITUiPRN43mS0QcMU=; b=NSK2p0+ZdMo8Ciru28hzuVPwb7qUqkr68IdTc16y/hLoeXBQqLXGjZwrsZtbzOV4ER 8S91EZvMhD2ZNYdDtKszeC8I1XWSyqZDAZTPbgeeaOCq5bK1mz8j67WKkmMAGlpnk32b sH/r20gScp1ZqiT6ABrDrt1VkImvpkPrZ2Ki8bT/l+qcUoxxTbgb5z9gOnhTiMVwufDO +JQwyPBBY4UFa2f9STJiookejbd66QEka6fSLGZ/B7QrG7LZ5nsAksOkHwQKoWrAn4OX HUvbi9Oo7zMqkb3VPv9GuAsDnUxvNvPEPxmcF1uO+KRrKSxz8VMyy/qbGPJh7YAeO/Ta 255g== X-Forwarded-Encrypted: i=1; AJvYcCVkibsBMM0xIt94+X+5M7NzTkUhL+dlIgdL7jCKPpnhfTwhYLMrY9s1YWrjoMi1DDsQO5i8fADsuua/50y5jXsN@lists.infradead.org X-Gm-Message-State: AOJu0Yyjl3ZfmbGGktv9pHOBE4qppmYtQw6CnXWpdN1hUlbQLdWLOv+N 5DI48WSnF1fyO09ym9G9DTI3litbKzwUkwFgSEC4NrPkDNgxfeucwYpo3SwRfj1fodO7O7hlYdw fZHxlpw== X-Google-Smtp-Source: AGHT+IGgUPEeAoj0GCHJRw0hDSDrqo6vL+2D8u0aKVLNqtcDlviAMIAP2xZin6A4jNkd/xtNmfp3B0Sj1e8R X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:6993:b0:6e2:1b8c:39bf with SMTP id 00721157ae682-6e3d3f7f6fdmr1369657b3.2.1729124732661; Wed, 16 Oct 2024 17:25:32 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:02 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-3-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 02/20] perf dwarf-regs: Remove PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172534_653859_4DB70C4A X-CRM114-Status: GOOD ( 20.95 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET was used for BPF prologue support which was removed in Commit 3d6dfae88917 ("perf parse-events: Remove BPF event support"). The code is no longer used so remove. Remove the offset from various dwarf-regs.c tables and the dependence on ptrace.h. Rename structs starting pt_ as the ptrace derived offset is now removed. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 4 - tools/perf/arch/arm64/Makefile | 1 - tools/perf/arch/arm64/util/dwarf-regs.c | 20 +--- tools/perf/arch/loongarch/Makefile | 1 - tools/perf/arch/loongarch/util/dwarf-regs.c | 10 -- tools/perf/arch/powerpc/Makefile | 1 - tools/perf/arch/powerpc/util/dwarf-regs.c | 26 ++--- tools/perf/arch/riscv/Makefile | 1 - tools/perf/arch/riscv/util/dwarf-regs.c | 14 +-- tools/perf/arch/s390/Makefile | 1 - tools/perf/arch/s390/util/dwarf-regs.c | 27 ----- tools/perf/arch/x86/Makefile | 1 - tools/perf/arch/x86/util/dwarf-regs.c | 109 +++----------------- tools/perf/util/include/dwarf-regs.h | 8 -- 14 files changed, 27 insertions(+), 197 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index b93ed2b7623f..1d3f7dcc6b66 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -203,10 +203,6 @@ FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arc # include ARCH specific config -include $(src-perf)/arch/$(SRCARCH)/Makefile -ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET - CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -endif - include $(srctree)/tools/scripts/utilities.mak ifeq ($(call get-executable,$(FLEX)),) diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 8a5ffbfe809f..ca2e35961287 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -3,7 +3,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS := 1 endif PERF_HAVE_JITDUMP := 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 HAVE_KVM_STAT_SUPPORT := 1 # diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c index 917b97d7c5d3..343a62fa4199 100644 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ b/tools/perf/arch/arm64/util/dwarf-regs.c @@ -9,10 +9,9 @@ #include #include #include -#include /* for struct user_pt_regs */ #include -struct pt_regs_dwarfnum { +struct regs_dwarfnum { const char *name; unsigned int dwarfnum; }; @@ -21,14 +20,12 @@ struct pt_regs_dwarfnum { #define GPR_DWARFNUM_NAME(num) \ {.name = __stringify(%x##num), .dwarfnum = num} #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} -#define DWARFNUM2OFFSET(index) \ - (index * sizeof((struct user_pt_regs *)0)->regs[0]) /* * Reference: * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadwarf64.pdf */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] = { +static const struct regs_dwarfnum regdwarfnum_table[] = { GPR_DWARFNUM_NAME(0), GPR_DWARFNUM_NAME(1), GPR_DWARFNUM_NAME(2), @@ -74,19 +71,10 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[] = { */ const char *get_arch_regstr(unsigned int n) { - const struct pt_regs_dwarfnum *roff; + const struct regs_dwarfnum *roff; + for (roff = regdwarfnum_table; roff->name != NULL; roff++) if (roff->dwarfnum == n) return roff->name; return NULL; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff = regdwarfnum_table; roff->name != NULL; roff++) - if (!strcmp(roff->name, name)) - return DWARFNUM2OFFSET(roff->dwarfnum); - return -EINVAL; -} diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch/Makefile index 1cc5eb01f32b..79b432744296 100644 --- a/tools/perf/arch/loongarch/Makefile +++ b/tools/perf/arch/loongarch/Makefile @@ -2,7 +2,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS := 1 endif -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 PERF_HAVE_JITDUMP := 1 HAVE_KVM_STAT_SUPPORT := 1 diff --git a/tools/perf/arch/loongarch/util/dwarf-regs.c b/tools/perf/arch/loongarch/util/dwarf-regs.c index 0f6ebc387463..bee08fdcf2fd 100644 --- a/tools/perf/arch/loongarch/util/dwarf-regs.c +++ b/tools/perf/arch/loongarch/util/dwarf-regs.c @@ -32,13 +32,3 @@ const char *get_arch_regstr(unsigned int n) n %= 32; return loongarch_gpr_table[n].name; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff = loongarch_gpr_table; roff->name != NULL; roff++) - if (!strcmp(roff->name, name)) - return roff->dwarfnum; - return -EINVAL; -} diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile index 7672d555f6cd..ae05727835d8 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -4,7 +4,6 @@ PERF_HAVE_DWARF_REGS := 1 endif HAVE_KVM_STAT_SUPPORT := 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 PERF_HAVE_JITDUMP := 1 # diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/powerpc/util/dwarf-regs.c index 104c7ae5c433..23846c59a522 100644 --- a/tools/perf/arch/powerpc/util/dwarf-regs.c +++ b/tools/perf/arch/powerpc/util/dwarf-regs.c @@ -9,29 +9,25 @@ #include #include #include -#include #include #include -struct pt_regs_dwarfnum { +struct regs_dwarfnum { const char *name; unsigned int dwarfnum; - unsigned int ptregs_offset; }; #define REG_DWARFNUM_NAME(r, num) \ - {.name = __stringify(%)__stringify(r), .dwarfnum = num, \ - .ptregs_offset = offsetof(struct pt_regs, r)} + {.name = __stringify(%)__stringify(r), .dwarfnum = num} #define GPR_DWARFNUM_NAME(num) \ - {.name = __stringify(%gpr##num), .dwarfnum = num, \ - .ptregs_offset = offsetof(struct pt_regs, gpr[num])} -#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0, .ptregs_offset = 0} + {.name = __stringify(%gpr##num), .dwarfnum = num} +#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} /* * Reference: * http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] = { +static const struct regs_dwarfnum regdwarfnum_table[] = { GPR_DWARFNUM_NAME(0), GPR_DWARFNUM_NAME(1), GPR_DWARFNUM_NAME(2), @@ -83,22 +79,14 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[] = { */ const char *get_arch_regstr(unsigned int n) { - const struct pt_regs_dwarfnum *roff; + const struct regs_dwarfnum *roff; + for (roff = regdwarfnum_table; roff->name != NULL; roff++) if (roff->dwarfnum == n) return roff->name; return NULL; } -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - for (roff = regdwarfnum_table; roff->name != NULL; roff++) - if (!strcmp(roff->name, name)) - return roff->ptregs_offset; - return -EINVAL; -} - #define PPC_OP(op) (((op) >> 26) & 0x3F) #define PPC_RA(a) (((a) >> 16) & 0x1f) #define PPC_RT(t) (((t) >> 21) & 0x1f) diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile index 4664a78a1afd..f01ab2171fd0 100644 --- a/tools/perf/arch/riscv/Makefile +++ b/tools/perf/arch/riscv/Makefile @@ -1,6 +1,5 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS := 1 endif -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 PERF_HAVE_JITDUMP := 1 HAVE_KVM_STAT_SUPPORT := 1 diff --git a/tools/perf/arch/riscv/util/dwarf-regs.c b/tools/perf/arch/riscv/util/dwarf-regs.c index cd0504c02e2e..a9c4402ae57e 100644 --- a/tools/perf/arch/riscv/util/dwarf-regs.c +++ b/tools/perf/arch/riscv/util/dwarf-regs.c @@ -9,7 +9,7 @@ #include /* for strcmp */ #include -struct pt_regs_dwarfnum { +struct regs_dwarfnum { const char *name; unsigned int dwarfnum; }; @@ -17,7 +17,7 @@ struct pt_regs_dwarfnum { #define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} #define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} -struct pt_regs_dwarfnum riscv_dwarf_regs_table[] = { +struct regs_dwarfnum riscv_dwarf_regs_table[] = { REG_DWARFNUM_NAME("%zero", 0), REG_DWARFNUM_NAME("%ra", 1), REG_DWARFNUM_NAME("%sp", 2), @@ -60,13 +60,3 @@ const char *get_arch_regstr(unsigned int n) { return (n < RISCV_MAX_REGS) ? riscv_dwarf_regs_table[n].name : NULL; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff = riscv_dwarf_regs_table; roff->name; roff++) - if (!strcmp(roff->name, name)) - return roff->dwarfnum; - return -EINVAL; -} diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile index 3f66e2ede3f7..58e79f5b67a4 100644 --- a/tools/perf/arch/s390/Makefile +++ b/tools/perf/arch/s390/Makefile @@ -3,7 +3,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS := 1 endif HAVE_KVM_STAT_SUPPORT := 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 PERF_HAVE_JITDUMP := 1 # diff --git a/tools/perf/arch/s390/util/dwarf-regs.c b/tools/perf/arch/s390/util/dwarf-regs.c index dfddb3099bfa..5bcf3192623a 100644 --- a/tools/perf/arch/s390/util/dwarf-regs.c +++ b/tools/perf/arch/s390/util/dwarf-regs.c @@ -7,37 +7,10 @@ * */ -#include -#include -#include #include -#include -#include -#include #include "dwarf-regs-table.h" const char *get_arch_regstr(unsigned int n) { return (n >= ARRAY_SIZE(s390_dwarf_regs)) ? NULL : s390_dwarf_regs[n]; } - -/* - * Convert the register name into an offset to struct pt_regs (kernel). - * This is required by the BPF prologue generator. The BPF - * program is called in the BPF overflow handler in the perf - * core. - */ -int regs_query_register_offset(const char *name) -{ - unsigned long gpr; - - if (!name || strncmp(name, "%r", 2)) - return -EINVAL; - - errno = 0; - gpr = strtoul(name + 2, NULL, 10); - if (errno || gpr >= 16) - return -EINVAL; - - return offsetof(user_pt_regs, gprs) + 8 * gpr; -} diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index 9aa58acb5564..51cf267f4d85 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile @@ -3,7 +3,6 @@ ifndef NO_LIBDW PERF_HAVE_DWARF_REGS := 1 endif HAVE_KVM_STAT_SUPPORT := 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1 PERF_HAVE_JITDUMP := 1 ### diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c index 399c4a0a29d8..530905118cd4 100644 --- a/tools/perf/arch/x86/util/dwarf-regs.c +++ b/tools/perf/arch/x86/util/dwarf-regs.c @@ -6,112 +6,31 @@ * Written by Masami Hiramatsu */ -#include #include /* for EINVAL */ #include /* for strcmp */ -#include /* for struct pt_regs */ -#include /* for offsetof */ +#include /* for ARRAY_SIZE */ #include -/* - * See arch/x86/kernel/ptrace.c. - * Different from it: - * - * - Since struct pt_regs is defined differently for user and kernel, - * but we want to use 'ax, bx' instead of 'rax, rbx' (which is struct - * field name of user's pt_regs), we make REG_OFFSET_NAME to accept - * both string name and reg field name. - * - * - Since accessing x86_32's pt_regs from x86_64 building is difficult - * and vise versa, we simply fill offset with -1, so - * get_arch_regstr() still works but regs_query_register_offset() - * returns error. - * The only inconvenience caused by it now is that we are not allowed - * to generate BPF prologue for a x86_64 kernel if perf is built for - * x86_32. This is really a rare usecase. - * - * - Order is different from kernel's ptrace.c for get_arch_regstr(). Use - * the order defined by dwarf. - */ +#define DEFINE_DWARF_REGSTR_TABLE 1 +#include "dwarf-regs-table.h" -struct pt_regs_offset { - const char *name; - int offset; -}; - -#define REG_OFFSET_END {.name = NULL, .offset = 0} - -#ifdef __x86_64__ -# define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)} -# define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = -1} +/* Return architecture dependent register string (for kprobe-tracer) */ +const char *get_arch_regstr(unsigned int n) +{ +#if defined(__i386__) + size_t len = ARRAY_SIZE(x86_32_regstr_tbl); #else -# define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = -1} -# define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)} + size_t len = ARRAY_SIZE(x86_64_regstr_tbl); #endif -/* TODO: switching by dwarf address size */ -#ifndef __x86_64__ -static const struct pt_regs_offset x86_32_regoffset_table[] = { - REG_OFFSET_NAME_32("%ax", eax), - REG_OFFSET_NAME_32("%cx", ecx), - REG_OFFSET_NAME_32("%dx", edx), - REG_OFFSET_NAME_32("%bx", ebx), - REG_OFFSET_NAME_32("$stack", esp), /* Stack address instead of %sp */ - REG_OFFSET_NAME_32("%bp", ebp), - REG_OFFSET_NAME_32("%si", esi), - REG_OFFSET_NAME_32("%di", edi), - REG_OFFSET_END, -}; + if (n >= len) + return NULL; -#define regoffset_table x86_32_regoffset_table +#if defined(__i386__) + return x86_32_regstr_tbl[n]; #else -static const struct pt_regs_offset x86_64_regoffset_table[] = { - REG_OFFSET_NAME_64("%ax", rax), - REG_OFFSET_NAME_64("%dx", rdx), - REG_OFFSET_NAME_64("%cx", rcx), - REG_OFFSET_NAME_64("%bx", rbx), - REG_OFFSET_NAME_64("%si", rsi), - REG_OFFSET_NAME_64("%di", rdi), - REG_OFFSET_NAME_64("%bp", rbp), - REG_OFFSET_NAME_64("%sp", rsp), - REG_OFFSET_NAME_64("%r8", r8), - REG_OFFSET_NAME_64("%r9", r9), - REG_OFFSET_NAME_64("%r10", r10), - REG_OFFSET_NAME_64("%r11", r11), - REG_OFFSET_NAME_64("%r12", r12), - REG_OFFSET_NAME_64("%r13", r13), - REG_OFFSET_NAME_64("%r14", r14), - REG_OFFSET_NAME_64("%r15", r15), - REG_OFFSET_END, -}; - -#define regoffset_table x86_64_regoffset_table + return x86_64_regstr_tbl[n]; #endif - -/* Minus 1 for the ending REG_OFFSET_END */ -#define ARCH_MAX_REGS ((sizeof(regoffset_table) / sizeof(regoffset_table[0])) - 1) - -/* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_arch_regstr(unsigned int n) -{ - return (n < ARCH_MAX_REGS) ? regoffset_table[n].name : NULL; -} - -/* Reuse code from arch/x86/kernel/ptrace.c */ -/** - * regs_query_register_offset() - query register offset from its name - * @name: the name of a register - * - * regs_query_register_offset() returns the offset of a register in struct - * pt_regs from its name. If the name is invalid, this returns -EINVAL; - */ -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_offset *roff; - for (roff = regoffset_table; roff->name != NULL; roff++) - if (!strcmp(roff->name, name)) - return roff->offset; - return -EINVAL; } struct dwarf_regs_idx { diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 29a7d0546b82..fbdd7307e0c2 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -42,12 +42,4 @@ static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_source _ void get_powerpc_regs(u32 raw_insn, int is_source, struct annotated_op_loc *op_loc); #endif -#ifdef HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -/* - * Arch should support fetching the offset of a register in pt_regs - * by its name. See kernel's regs_query_register_offset in - * arch/xxx/kernel/ptrace.c. - */ -int regs_query_register_offset(const char *name); -#endif #endif From patchwork Thu Oct 17 00:25:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839189 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 A0185D2F7D7 for ; Thu, 17 Oct 2024 01:14:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zPuJy23SWmMfM/R7Lv+B/JUCmZ6weqPIHtsQlmnrHas=; b=tmJV7tOIhliFzdhuhKW/ke8bWP EuAZZ6XTdvLIheCwj7Z0g/Sf9ejEd9qBTs9iV9md5uoB2r8zRE4tvUMnLdmpbrtrw+1YTyKNhI19u Imi1AXohmL12sRYUfnsjY5k0F9Jn2rkas2q/wzOYGd7S8h1hx+tTDDhIcu3iu2s8nUDEimZg9Ygqb 1HWMrgmriJoP/5cSAmyRgd4Gfb/cQZiBJC6eirS+nLJYQnteMwwcPXmd8iKiYHoj7ZIXMIaDNvjgc AXJXAQB9Kz97hkq7N7foEzrO3sW3071ab5PK9rg/s6iQZU+DSabjGatiJiwU792Ch2XJohqDlyIAo T+EIJVtA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1F5Q-0000000DQhB-1Uoi; Thu, 17 Oct 2024 01:13:56 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKe-0000000DK7v-3qh4 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:38 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e290947f6f8so691376276.2 for ; Wed, 16 Oct 2024 17:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124735; x=1729729535; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=zPuJy23SWmMfM/R7Lv+B/JUCmZ6weqPIHtsQlmnrHas=; b=CklBTy/GfpTvjrc7t4vuITxlXQ1e3vO0MNlQyDe4XXcuYccw7Sdzv/DDq26+OdU9N2 Rc0n1qV+ST3R4BbYHpMJtvdv+lyxV0gmzPhXaGkDn1ammbHr28cHm1y2l1uwAxUsp7aS CAxIxn7rWbYIIJm9MCZgC1udAwhHDviFgL1YnHztUsqpiqUw2sWf+qUYlkFABs2UhHgU pWEBcuzbCna8W4dXtZPDMwI72L0cpqV/xCtHEQJjRphRNU2zBshukVpDzpfyudhm/Y3P rx2M5Xmk8jvRE2p0prOBPB/vrpmsovMHNCf5lI6z2ka6vw9xR6MbJsvZK+Lg/FCUNrsp 3i4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124735; x=1729729535; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zPuJy23SWmMfM/R7Lv+B/JUCmZ6weqPIHtsQlmnrHas=; b=fHEO0e5mgw6XXiKXDJGjgBj1Oj4D0P1DmhrAJ/8n9GV/5CinX1orozr0f4/SJ7PhJT WccyvPllu7pzD7nk6cCm+pHreH574D8diudc0KdX3k0iv0/ZsQeVm06LjK4n+s1CGV73 Vv3mCwN1AfRrTq+MT3rhPFul3Mxw2qz7EJSED5ghx8yqw2t5DXpACgcT8VqzrpMUau52 6uaQ/v0hhST8hxaFQsEV0xRP/D6IKoLG4spMznG4SuCn/78RMmlB5pSP/PcFOMuv+KWT zCRnYgSiRwgeDNw/wqsS2xyBMWcffJI6k+N15EP7gp9yegI7lzRFam5ClQDgUIb+o4Fb iovg== X-Forwarded-Encrypted: i=1; AJvYcCWeAaQZ+pxqEYl/Qe1t/41gQilCXz6TIUYAS44GAGqKfR2wG4l3wtlvSTDOciaVcSj/kdhBCExvRtjfr8WHEOoH@lists.infradead.org X-Gm-Message-State: AOJu0YxRYh5a8LDXTSln1e97rlBsjLw6dnDt7jEB4/4mDmTYRJHnJmUb v1u5RjMsnl6EflAdRZAmuj+P6KfuTFPF8pk/ai/B0xxLwCG4qjCwyaSgj4Ms1EQnglQppXLqlWd QW0YJsA== X-Google-Smtp-Source: AGHT+IGVbm7ifaHt/Fl/drq6Q4bQa5ufX0E3xNqrZof9j3qtFmTHHwBTTD4/diJBn39+kY+JKl2TpaixKpZq X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:aa09:0:b0:e29:74e3:616c with SMTP id 3f1490d57ef6-e29782e9e9cmr2959276.3.1729124735151; Wed, 16 Oct 2024 17:25:35 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:03 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-4-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 03/20] perf dwarf-regs: Add EM_HOST and EF_HOST defines From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172536_989934_0BAD48E9 X-CRM114-Status: GOOD ( 14.44 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Computed from the build architecture defines, EM_HOST and EF_HOST give values that can be used in dwarf register lookup. Place in dwarf-regs.h so the value can be shared. Move some dwarf-regs.c constants used for EM_HOST to dwarf-regs.h. Signed-off-by: Ian Rogers --- tools/perf/util/dwarf-regs.c | 8 ---- tools/perf/util/include/dwarf-regs.h | 72 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 5b7f86c0063f..7c01bc4d7e5b 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -13,14 +13,6 @@ #include #include -#ifndef EM_AARCH64 -#define EM_AARCH64 183 /* ARM 64 bit */ -#endif - -#ifndef EM_LOONGARCH -#define EM_LOONGARCH 258 /* LoongArch */ -#endif - /* Define const char * {arch}_register_tbl[] */ #define DEFINE_DWARF_REGSTR_TABLE #include "../arch/x86/include/dwarf-regs-table.h" diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index fbdd7307e0c2..f4f87ded5e3d 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -2,6 +2,78 @@ #ifndef _PERF_DWARF_REGS_H_ #define _PERF_DWARF_REGS_H_ #include "annotate.h" +#include + +#ifndef EM_AARCH64 +#define EM_AARCH64 183 /* ARM 64 bit */ +#endif + +#ifndef EM_LOONGARCH +#define EM_LOONGARCH 258 /* LoongArch */ +#endif + +/* EM_HOST gives the ELF machine for host, EF_HOST gives additional flags. */ +#if defined(__x86_64__) + #define EM_HOST EM_X86_64 +#elif defined(__i386__) + #define EM_HOST EM_386 +#elif defined(__aarch64__) + #define EM_HOST EM_AARCH64 +#elif defined(__arm__) + #define EM_HOST EM_ARM +#elif defined(__alpha__) + #define EM_HOST EM_ALPHA +#elif defined(__arc__) + #define EM_HOST EM_ARC +#elif defined(__AVR__) + #define EM_HOST EM_AVR +#elif defined(__AVR32__) + #define EM_HOST EM_AVR32 +#elif defined(__bfin__) + #define EM_HOST EM_BLACKFIN +#elif defined(__csky__) + #define EM_HOST EM_CSKY + #if defined(__CSKYABIV2__) + #define EF_HOST EF_CSKY_ABIV2 + #else + #define EF_HOST EF_CSKY_ABIV1 + #endif +#elif defined(__cris__) + #define EM_HOST EM_CRIS +#elif defined(__hppa__) // HP PA-RISC + #define EM_HOST EM_PARISC +#elif defined(__loongarch__) + #define EM_HOST EM_LOONGARCH +#elif defined(__mips__) + #define EM_HOST EM_MIPS +#elif defined(__m32r__) + #define EM_HOST EM_M32R +#elif defined(__microblaze__) + #define EM_HOST EM_MICROBLAZE +#elif defined(__MSP430__) + #define EM_HOST EM_MSP430 +#elif defined(__powerpc64__) + #define EM_HOST EM_PPC64 +#elif defined(__powerpc__) + #define EM_HOST EM_PPC +#elif defined(__riscv) + #define EM_HOST EM_RISCV +#elif defined(__s390x__) + #define EM_HOST EM_S390 +#elif defined(__sh__) + #define EM_HOST EM_SH +#elif defined(__sparc64__) || defined(__sparc__) + #define EM_HOST EM_SPARC +#elif defined(__xtensa__) + #define EM_HOST EM_XTENSA +#else + /* Unknown host ELF machine type. */ + #define EM_HOST EM_NONE +#endif + +#if !defined(EF_HOST) + #define EF_HOST 0 +#endif #define DWARF_REG_PC 0xd3af9c /* random number */ #define DWARF_REG_FB 0xd3affb /* random number */ From patchwork Thu Oct 17 00:25:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839320 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 759D5D2F7DA for ; Thu, 17 Oct 2024 02:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KMncvSxke+r4vucw8oUD2KkaxOVK5uFPUegLmuP56t0=; b=dtGrwbc25/Fm8YlNIG+DT3Kof5 PX/AJX3Et2DHbevk0mHtYHhCiWy5nMRIJqJuGHcZEJWTvKyXTF0atRGX39eTWJ+YMTbpNtVbhgSve MjvBQI0V7SK8Iv0BTn7d+QUAO+j8Y9lFvCbT6xYF+Pqxw482ArQ+xYR6wDhZXqaLHKdo2WPZfALxA B82fgJ/5F61WGsY3sNwcSH+JrZax3CdbEs2pVE04ZoN72Ws3w6Q36cUjreEiRyKWRoii/D2RqdY4e PMmoayUEfFq3YSpVcTjoIxDcYP5uxXSZ8ShXwWb0d8VZ//RHpOl2o81x//m9MBl+uY3CXx0jWm/fH QidDlpWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1G3Q-0000000DWuO-2Le4; Thu, 17 Oct 2024 02:15:56 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKh-0000000DK90-0mu3 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:40 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e2946a143efso584496276.1 for ; Wed, 16 Oct 2024 17:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124738; x=1729729538; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=KMncvSxke+r4vucw8oUD2KkaxOVK5uFPUegLmuP56t0=; b=omyJaILZrN2IWrn9gfEHJvLqTE/l3gaKeXvcfsdrh3Ln65FK1gzn+tw8Txn0In5ktJ AOgLPsVgAbmnLyhYoU8dEhFxJplEMjY8do6uCAf8Nrrt/ChUamJxt6WIDpIJX5SC2tkX YuW0YZw604f9TSx8XM5RTjjWsOhmDaK9nRSrPqQStYDSM2bOhE8F3CzeG9z2DpsTVp/7 yrSjG6AfnPI40pYrIB+s1P2f4tCKFODJoI3d75GC447286do5vMplTxAMfNaBPIyiIt4 aX92pfszEKs+1iZduxsuXHtwWn0rC7jCzDZn445UbGQCLedY/OdyJYcG82dGL017opoS UiRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124738; x=1729729538; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KMncvSxke+r4vucw8oUD2KkaxOVK5uFPUegLmuP56t0=; b=C5+adGucrVOIzpXdCs8KoU2XCNkFxRuYmxF4RTCc4+w9lJntNGyp1ojyPp61chqBKl f7eOexRX/3XuoedJuBK2bLvJNKL7fSkn7UNlmB7LPNoa0ZtgDh69+flc8ZyxCse/+D40 MlE7mRxlyzhwRkLJ3pNHpljINtQ9ChrtHVs9tcEszKlqg9bLl6Sgfv7x0kad20efb6+w cz+MDhp/wSrDf6+wrplZHc5BLcRiXTwF7+JkgaV2uMny1iVA5fj6Po31hlpc0FNJHNwO r6NaZmYQjslLd96s822ZkgpYJFPSoL7b/YHB0McXZ2RmMTlXJEiJ61mO8qqyf5vEPxtU 0YWA== X-Forwarded-Encrypted: i=1; AJvYcCULBJ31SerwAphxLjZHzNw4yXmdBTleEZFBBQj8qCF+cGdo7Os9qiO3dGAeHgphDexa+1cz9UXzxnxNc9dklUgB@lists.infradead.org X-Gm-Message-State: AOJu0YzDoKTcpAbIgqprluwbUItmq4SldYo/8gldcILYf8VEna7ssG11 4wVjuAoIqrr5cqA1nFIfwmo56mGkLRXGGnYv2zU0PfDixPueaCVJSfVTnw/7Koyu6j2r4zWvmZZ kWvCsEQ== X-Google-Smtp-Source: AGHT+IHnKt+0wOaTE7zUTQI2rphyZXnAK5a4MY8raKX1baBAVylSM1xTDZRcbIFg3cQETXVoUICk0Kp05Tww X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:aa0c:0:b0:e1c:ffab:a801 with SMTP id 3f1490d57ef6-e2b9ce000a9mr1691276.2.1729124737505; Wed, 16 Oct 2024 17:25:37 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:04 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-5-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 04/20] perf disasm: Add e_machine/e_flags to struct arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172539_253309_ECC8C5AD X-CRM114-Status: GOOD ( 15.61 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently functions like get_dwarf_regnum only work with the host architecture. Carry the elf machine and flags in struct arch so that in disassembly these can be used to allow cross platform disassembly. Signed-off-by: Ian Rogers --- tools/perf/arch/arc/annotate/instructions.c | 2 ++ tools/perf/arch/arm/annotate/instructions.c | 2 ++ tools/perf/arch/arm64/annotate/instructions.c | 2 ++ tools/perf/arch/csky/annotate/instructions.c | 7 ++++++- tools/perf/arch/loongarch/annotate/instructions.c | 2 ++ tools/perf/arch/mips/annotate/instructions.c | 2 ++ tools/perf/arch/powerpc/annotate/instructions.c | 2 ++ tools/perf/arch/riscv64/annotate/instructions.c | 2 ++ tools/perf/arch/s390/annotate/instructions.c | 2 ++ tools/perf/arch/sparc/annotate/instructions.c | 2 ++ tools/perf/arch/x86/annotate/instructions.c | 3 ++- tools/perf/util/disasm.h | 4 ++++ 12 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tools/perf/arch/arc/annotate/instructions.c b/tools/perf/arch/arc/annotate/instructions.c index 2f00e995c7e3..e5619770a1af 100644 --- a/tools/perf/arch/arc/annotate/instructions.c +++ b/tools/perf/arch/arc/annotate/instructions.c @@ -5,5 +5,7 @@ static int arc__annotate_init(struct arch *arch, char *cpuid __maybe_unused) { arch->initialized = true; arch->objdump.comment_char = ';'; + arch->e_machine = EM_ARC; + arch->e_flags = 0; return 0; } diff --git a/tools/perf/arch/arm/annotate/instructions.c b/tools/perf/arch/arm/annotate/instructions.c index 2ff6cedeb9c5..cf91a43362b0 100644 --- a/tools/perf/arch/arm/annotate/instructions.c +++ b/tools/perf/arch/arm/annotate/instructions.c @@ -53,6 +53,8 @@ static int arm__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->associate_instruction_ops = arm__associate_instruction_ops; arch->objdump.comment_char = ';'; arch->objdump.skip_functions_char = '+'; + arch->e_machine = EM_ARM; + arch->e_flags = 0; return 0; out_free_call: diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arch/arm64/annotate/instructions.c index f86d9f4798bd..d465d093e7eb 100644 --- a/tools/perf/arch/arm64/annotate/instructions.c +++ b/tools/perf/arch/arm64/annotate/instructions.c @@ -113,6 +113,8 @@ static int arm64__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->associate_instruction_ops = arm64__associate_instruction_ops; arch->objdump.comment_char = '/'; arch->objdump.skip_functions_char = '+'; + arch->e_machine = EM_AARCH64; + arch->e_flags = 0; return 0; out_free_call: diff --git a/tools/perf/arch/csky/annotate/instructions.c b/tools/perf/arch/csky/annotate/instructions.c index 5337bfb7d5fc..14270311d215 100644 --- a/tools/perf/arch/csky/annotate/instructions.c +++ b/tools/perf/arch/csky/annotate/instructions.c @@ -43,6 +43,11 @@ static int csky__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->initialized = true; arch->objdump.comment_char = '/'; arch->associate_instruction_ops = csky__associate_ins_ops; - + arch->e_machine = EM_CSKY; +#if defined(__CSKYABIV2__) + arch->e_flags = EF_CSKY_ABIV2; +#else + arch->e_flags = EF_CSKY_ABIV1; +#endif return 0; } diff --git a/tools/perf/arch/loongarch/annotate/instructions.c b/tools/perf/arch/loongarch/annotate/instructions.c index ab43b1ab51e3..70262d5f1444 100644 --- a/tools/perf/arch/loongarch/annotate/instructions.c +++ b/tools/perf/arch/loongarch/annotate/instructions.c @@ -131,6 +131,8 @@ int loongarch__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->associate_instruction_ops = loongarch__associate_ins_ops; arch->initialized = true; arch->objdump.comment_char = '#'; + arch->e_machine = EM_LOONGARCH; + arch->e_flags = 0; } return 0; diff --git a/tools/perf/arch/mips/annotate/instructions.c b/tools/perf/arch/mips/annotate/instructions.c index 340993f2a897..b50b46c613d6 100644 --- a/tools/perf/arch/mips/annotate/instructions.c +++ b/tools/perf/arch/mips/annotate/instructions.c @@ -40,6 +40,8 @@ int mips__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->associate_instruction_ops = mips__associate_ins_ops; arch->initialized = true; arch->objdump.comment_char = '#'; + arch->e_machine = EM_MIPS; + arch->e_flags = 0; } return 0; diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/arch/powerpc/annotate/instructions.c index 54478cf5cccc..ca567cfdcbdb 100644 --- a/tools/perf/arch/powerpc/annotate/instructions.c +++ b/tools/perf/arch/powerpc/annotate/instructions.c @@ -309,6 +309,8 @@ static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->associate_instruction_ops = powerpc__associate_instruction_ops; arch->objdump.comment_char = '#'; annotate_opts.show_asm_raw = true; + arch->e_machine = EM_PPC; + arch->e_flags = 0; } return 0; diff --git a/tools/perf/arch/riscv64/annotate/instructions.c b/tools/perf/arch/riscv64/annotate/instructions.c index 869a0eb28953..55cf911633f8 100644 --- a/tools/perf/arch/riscv64/annotate/instructions.c +++ b/tools/perf/arch/riscv64/annotate/instructions.c @@ -28,6 +28,8 @@ int riscv64__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->associate_instruction_ops = riscv64__associate_ins_ops; arch->initialized = true; arch->objdump.comment_char = '#'; + arch->e_machine = EM_RISCV; + arch->e_flags = 0; } return 0; diff --git a/tools/perf/arch/s390/annotate/instructions.c b/tools/perf/arch/s390/annotate/instructions.c index eeac25cca699..c61193f1e096 100644 --- a/tools/perf/arch/s390/annotate/instructions.c +++ b/tools/perf/arch/s390/annotate/instructions.c @@ -166,6 +166,8 @@ static int s390__annotate_init(struct arch *arch, char *cpuid __maybe_unused) if (s390__cpuid_parse(arch, cpuid)) err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; } + arch->e_machine = EM_S390; + arch->e_flags = 0; } return err; diff --git a/tools/perf/arch/sparc/annotate/instructions.c b/tools/perf/arch/sparc/annotate/instructions.c index 2614c010c235..68c31580ccfc 100644 --- a/tools/perf/arch/sparc/annotate/instructions.c +++ b/tools/perf/arch/sparc/annotate/instructions.c @@ -163,6 +163,8 @@ static int sparc__annotate_init(struct arch *arch, char *cpuid __maybe_unused) arch->initialized = true; arch->associate_instruction_ops = sparc__associate_instruction_ops; arch->objdump.comment_char = '#'; + arch->e_machine = EM_SPARC; + arch->e_flags = 0; } return 0; diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/x86/annotate/instructions.c index c869abe3c31d..ae94b1f0b9cc 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c @@ -202,7 +202,8 @@ static int x86__annotate_init(struct arch *arch, char *cpuid) if (x86__cpuid_parse(arch, cpuid)) err = SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; } - + arch->e_machine = EM_X86_64; + arch->e_flags = 0; arch->initialized = true; return err; } diff --git a/tools/perf/util/disasm.h b/tools/perf/util/disasm.h index 486c269b29ba..c135db2416b5 100644 --- a/tools/perf/util/disasm.h +++ b/tools/perf/util/disasm.h @@ -44,6 +44,10 @@ struct arch { struct data_loc_info *dloc, Dwarf_Die *cu_die, struct disasm_line *dl); #endif + /** @e_machine: ELF machine associated with arch. */ + unsigned int e_machine; + /** @e_flags: Optional ELF flags associated with arch. */ + unsigned int e_flags; }; struct ins { From patchwork Thu Oct 17 00:25:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839190 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 5F1FED2F7D8 for ; Thu, 17 Oct 2024 01:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=48mjrfomMuomFB22b093k885CPaCWm0H0utyyG5sq/o=; b=GD+9GE2zqdzWXzEU7V5xqcryHO Pu/f1eOFqFBTL8x/iothdETdD0emTpEKKES0/iJKXgCGU6rBoxHH3TMoufIrGtlhDv8X7pHZUOU5X +vKCr8rgYVAxrYz/iC72CdAU64Fz1znvbOqHaW58ExCb09J4wHgp0Q+lpJ1n9i3uNdic5Ct9bzITL hJ5WugmSJlfOdIryOjG0m6F2HalLuoClJR1DdOa1iN6k0a39LCwRfXpVRj6NHwLw2NDBIPG+OjRPv uiSxfr0j1QpzVY4kYa0AaauZeVobrAusGwyaJhApqhl+NfBoAKWNStz/zZcVrOlhnGQ1d8oBlDS+E JWKBIkmQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1F8C-0000000DQqR-0tIo; Thu, 17 Oct 2024 01:16:48 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKj-0000000DKAM-3XP4 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:43 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e2928d9e615so642462276.0 for ; Wed, 16 Oct 2024 17:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124740; x=1729729540; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=48mjrfomMuomFB22b093k885CPaCWm0H0utyyG5sq/o=; b=qjylob124mXRvzPYW8GbgmoDVEl3PMToR9ysRtKT36ttVGYBqwJeuZl+bZhmrOBzm4 MZS284IP8HvFOWPr9mm8V4dyiPebzsNfS6BUwI+eqWQehkqh8sa0Wglv1DhCpcHYKefF 36mES/kd3w7PZzY8HzBYZz7v9eeysJSnhAkqK01YWXqG/ztJjxsA7OeulsMyx/ex4L9O hxe+lRrnSoVdQvDaO93LoF/8yc+tMIO2zmB0hbZgP0eltWt8ceabnlAKNtHCRFknC72a 7tqxexO0vQXOhktw5ldKL2JQuBuI33VTo1TKZnKn8LpUAfLuXZ/EHQVHcCQ4AX12vZcQ PeAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124740; x=1729729540; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=48mjrfomMuomFB22b093k885CPaCWm0H0utyyG5sq/o=; b=SPRoukwp8nISDMTiD00qZyNHHfz1uq/tsFbSr4WSPGUMIiX4G0YEcOhoyHb2RNR8uu fRXa/TXEePr/t5fCdUJ9tDC5A8sLxn13zEVucr0cLdYLMvB5GAhSXQg6ouC8AWzhHIYs s7w1RscNyY5z9Wo6LeuWPYP4SAM56y9EdIsQi1Jj7RMdv5gb2NZOirIM9rxZ2aI+iTuT y9SF0rE/2Su3dOzY9xk/f7LF+NqTonf13ufk/6IoCqtzuf4uRE44duuX98eiV2m+PuGy uVxW9mOYArNwLO99xXe0RKN/fISlsDg2utkuT5C3JdjZLSBLzdT1sWxZfh/f4D6yhl/m RcBQ== X-Forwarded-Encrypted: i=1; AJvYcCU1o+MZrp6ga1CYijha/Aa6zxmkKVn3FT7bdIjb/gksz+gHn1/MIIoAtUJQ+RVz5KTdzpnBZUaTGA2meJtXiT2C@lists.infradead.org X-Gm-Message-State: AOJu0YyENiLqgCyKzss886+YvIcw3H5D07kYuYzNmdzaNK7Ren3/LTAN CW0sCxJwFB0ZiATUWmLYAgZyeyWJ5ep8bCf9u9wWM1sXZ9bfeDR6Ths8vJepjfUhmW4921mx0e0 Tkommsw== X-Google-Smtp-Source: AGHT+IG8JiIQK8uXOvPdoaWI2mxht6B92+7n0NisCZoM8iJKAkzjyBLEa7nUOj+aZg/H9XU8lHqJJagHTx/j X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:dc4e:0:b0:e28:f231:1aa8 with SMTP id 3f1490d57ef6-e29782bbb03mr7731276.2.1729124739976; Wed, 16 Oct 2024 17:25:39 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:05 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-6-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 05/20] perf dwarf-regs: Pass accurate disassembly machine to get_dwarf_regnum From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172541_909893_1FCE077F X-CRM114-Status: GOOD ( 17.12 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Rather than pass 0/EM_NONE, use the value computed in the disasm struct arch. Switch the EM_NONE case to EM_HOST, rewriting EM_NONE if it were passed to get_dwarf_regnum. Pass a flags value as architectures like csky need the flags to determine the ABI variant. Signed-off-by: Ian Rogers --- tools/perf/util/annotate.c | 6 +++--- tools/perf/util/dwarf-regs.c | 8 ++++++-- tools/perf/util/include/dwarf-regs.h | 5 +++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 37ce43c4eb8f..b1d98da79be8 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -2292,7 +2292,7 @@ static int extract_reg_offset(struct arch *arch, const char *str, if (regname == NULL) return -1; - op_loc->reg1 = get_dwarf_regnum(regname, 0); + op_loc->reg1 = get_dwarf_regnum(regname, arch->e_machine, arch->e_flags); free(regname); /* Get the second register */ @@ -2305,7 +2305,7 @@ static int extract_reg_offset(struct arch *arch, const char *str, if (regname == NULL) return -1; - op_loc->reg2 = get_dwarf_regnum(regname, 0); + op_loc->reg2 = get_dwarf_regnum(regname, arch->e_machine, arch->e_flags); free(regname); } return 0; @@ -2405,7 +2405,7 @@ int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl, return -1; if (*s == arch->objdump.register_char) - op_loc->reg1 = get_dwarf_regnum(s, 0); + op_loc->reg1 = get_dwarf_regnum(s, arch->e_machine, arch->e_flags); else if (*s == arch->objdump.imm_char) { op_loc->offset = strtol(s + 1, &p, 0); if (p && p != s + 1) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 7c01bc4d7e5b..1321387f6948 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -70,7 +70,7 @@ __weak int get_arch_regnum(const char *name __maybe_unused) } /* Return DWARF register number from architecture register name */ -int get_dwarf_regnum(const char *name, unsigned int machine) +int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int flags __maybe_unused) { char *regname = strdup(name); int reg = -1; @@ -84,8 +84,12 @@ int get_dwarf_regnum(const char *name, unsigned int machine) if (p) *p = '\0'; + if (machine == EM_NONE) { + /* Generic arch - use host arch */ + machine = EM_HOST; + } switch (machine) { - case EM_NONE: /* Generic arch - use host arch */ + case EM_HOST: reg = get_arch_regnum(regname); break; default: diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index f4f87ded5e3d..ee0a734564c7 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -93,12 +93,13 @@ int get_arch_regnum(const char *name); * name: architecture register name * machine: ELF machine signature (EM_*) */ -int get_dwarf_regnum(const char *name, unsigned int machine); +int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int flags); #else /* HAVE_LIBDW_SUPPORT */ static inline int get_dwarf_regnum(const char *name __maybe_unused, - unsigned int machine __maybe_unused) + unsigned int machine __maybe_unused, + unsigned int flags __maybe_unused) { return -1; } From patchwork Thu Oct 17 00:25:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839239 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 A37F0D2F7D8 for ; Thu, 17 Oct 2024 01:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=izrYBPhm17udGFGkR4Iwcv4Dc//bGf094GyDIT7L4tU=; b=exAaNq5fJaPcmSnWLjmoMIo+jo 1cymvh6JEe7matpEmyQf4G52t83WTDw9qk7qJb6wt8v1sgQeHfZiRVncE9oaC+TBMDeRVlzkK3N8J 4cwhIEECRPFYoqyb+L9DWwQ63sxeZz0iat+6PMSDFAn4TrO5IN9tgQkw9nG9e32DuRVSVLgM/m6su bHbAhCTjxkJa+9kEQ9xwq+XmeeKxJSO4Tmiiwef/o7lCenTBcNq/ZO+Dr6XxVJEozegu1UOfw2Wcn z04KUNI+qfWUh/DTAkOqWVLaeUxq9HOepynhnZCMEjgXz7ELUO90d/G0ciU+dvauo1p3Bof0BNXPJ 4vQCwUDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1F9a-0000000DQw3-3Xtn; Thu, 17 Oct 2024 01:18:14 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKl-0000000DKCE-31zj for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:45 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e2a8355786dso663716276.2 for ; Wed, 16 Oct 2024 17:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124742; x=1729729542; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=izrYBPhm17udGFGkR4Iwcv4Dc//bGf094GyDIT7L4tU=; b=rHjGYbSR2ZnVEXQF19bnGw66X0MoQQba8UIErk+4CCgXTCTgDcaW7bKENxSnkX9ro5 CkSTcmlnZcO6jf5+Xd4zlBJDaG/FoAKUHoDYOwq9Y/ZsNh45zgi/uG23CeaKSTMAdv/X sIL/TOy6NAMbq9O2XntA7n5aDGHCaXL4k9rWjS4lyLb5xMQw/bb9AriRKkf7lgoKTSjG 6zQ9ExQ6lriNkT8R4JY0475jMeDG4vemX8zxnQqpP3rPk4S42+iEcFnWE95G2tsdZNRf XyM/OoMY3IdmUXA/ugQ4JRoE86NC9JfJpzPAdRJhHdyxVNHinAlJOuoNV7jJt4OsXk2g 0MDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124742; x=1729729542; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=izrYBPhm17udGFGkR4Iwcv4Dc//bGf094GyDIT7L4tU=; b=I/Nb9gGhMCNTtc+JLFs3DLGepsVKsRhOr7vd7lvSryLVnGbV26cd3FXxUS9yHLbzeV EciyMlEc1ulYrNFdB/n31ucgNbx845enUnhSCeRJ0rcwkhAKHjDm5QFXvl88vujqNHfv LyQRGzjgcCK3cNp0kEGAmycxEd/XuIelwio5Mo206HlXiynMW+ZZFW2nlJGkcTNTBU63 9z/NFSWhKg0ud4tB1GaLXHm+yiaV9aZh5H8dgfxxwEF5bogE69koNT9ZdL2kNs8nmWrZ k8SAjed+C+k2e1jmoaKJc9cxRn8NcAj6AcsQJQNuXeFZJKDJ5jkajImvWfNIM+fo7zZn dTfg== X-Forwarded-Encrypted: i=1; AJvYcCWFGvnneWDKJWDuFciU965fUyZVLiEqvoqrlR+/BkT/iz8MbFZidXzpF+H2IkzM0Q5gxNLIqEOsk6C2/FbFW9uo@lists.infradead.org X-Gm-Message-State: AOJu0YxAoZe+j/73WX+raqG2sdbil26XE7bdKJlsb1WLeehFsGYV+hKL JNv6Z+DZ3I8Opn3Y+bo7HyBj1ZXutnWhF8ECQuAzm5NLLuK8RodA8uUvYa8Lnj3tf6wTH2taK9P tF2PQuw== X-Google-Smtp-Source: AGHT+IGe0qtX+nrFLCMypOG0orC3BMXFb6Kx9df1N+z/dKs05V2ms0PPErMRkoeQh6CQMoXF8+l+PYfUhcwf X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:aaa3:0:b0:e20:25f5:a889 with SMTP id 3f1490d57ef6-e29783030e0mr3217276.5.1729124742291; Wed, 16 Oct 2024 17:25:42 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:06 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-7-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 06/20] perf dwarf-regs: Pass ELF flags to get_dwarf_regstr From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172543_798576_E6C26F0D X-CRM114-Status: GOOD ( 19.38 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Pass a flags value as architectures like csky need the flags to determine the ABI variant. Signed-off-by: Ian Rogers --- tools/perf/util/dwarf-regs.c | 3 ++- tools/perf/util/include/dwarf-regs.h | 11 ++++++----- tools/perf/util/probe-finder.c | 13 +++++++------ tools/perf/util/probe-finder.h | 3 ++- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 1321387f6948..86b3ef638fbb 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -29,7 +29,8 @@ #define __get_dwarf_regstr(tbl, n) (((n) < ARRAY_SIZE(tbl)) ? (tbl)[(n)] : NULL) /* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_dwarf_regstr(unsigned int n, unsigned int machine) +const char *get_dwarf_regstr(unsigned int n, unsigned int machine, + unsigned int flags __maybe_unused) { switch (machine) { case EM_NONE: /* Generic arch - use host arch */ diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index ee0a734564c7..925525405e2d 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -80,12 +80,13 @@ #ifdef HAVE_LIBDW_SUPPORT const char *get_arch_regstr(unsigned int n); -/* - * get_dwarf_regstr - Returns ftrace register string from DWARF regnum - * n: DWARF register number - * machine: ELF machine signature (EM_*) +/** + * get_dwarf_regstr() - Returns ftrace register string from DWARF regnum. + * @n: DWARF register number. + * @machine: ELF machine signature (EM_*). + * @flags: ELF flags for things like ABI differences. */ -const char *get_dwarf_regstr(unsigned int n, unsigned int machine); +const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags); int get_arch_regnum(const char *name); /* diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 8ea15a2a4397..8a932cc2f63d 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -56,7 +56,7 @@ static struct probe_trace_arg_ref *alloc_trace_arg_ref(long offs) */ static int convert_variable_location(Dwarf_Die *vr_die, Dwarf_Addr addr, Dwarf_Op *fb_ops, Dwarf_Die *sp_die, - unsigned int machine, + const struct probe_finder *pf, struct probe_trace_arg *tvar) { Dwarf_Attribute attr; @@ -166,7 +166,7 @@ static int convert_variable_location(Dwarf_Die *vr_die, Dwarf_Addr addr, if (!tvar) return ret2; - regs = get_dwarf_regstr(regn, machine); + regs = get_dwarf_regstr(regn, pf->e_machine, pf->e_flags); if (!regs) { /* This should be a bug in DWARF or this tool */ pr_warning("Mapping for the register number %u " @@ -451,7 +451,7 @@ static int convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf) dwarf_diename(vr_die)); ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops, - &pf->sp_die, pf->machine, pf->tvar); + &pf->sp_die, pf, pf->tvar); if (ret == -ENOENT && pf->skip_empty_arg) /* This can be found in other place. skip it */ return 0; @@ -1134,7 +1134,8 @@ static int debuginfo__find_probes(struct debuginfo *dbg, if (gelf_getehdr(elf, &ehdr) == NULL) return -EINVAL; - pf->machine = ehdr.e_machine; + pf->e_machine = ehdr.e_machine; + pf->e_flags = ehdr.e_flags; do { GElf_Shdr shdr; @@ -1171,7 +1172,7 @@ static int copy_variables_cb(Dwarf_Die *die_mem, void *data) (tag == DW_TAG_variable && vf->vars)) { if (convert_variable_location(die_mem, vf->pf->addr, vf->pf->fb_ops, &pf->sp_die, - pf->machine, NULL) == 0) { + pf, /*tvar=*/NULL) == 0) { vf->args[vf->nargs].var = (char *)dwarf_diename(die_mem); if (vf->args[vf->nargs].var == NULL) { vf->ret = -ENOMEM; @@ -1402,7 +1403,7 @@ static int collect_variables_cb(Dwarf_Die *die_mem, void *data) tag == DW_TAG_variable) { ret = convert_variable_location(die_mem, af->pf.addr, af->pf.fb_ops, &af->pf.sp_die, - af->pf.machine, NULL); + &af->pf, /*tvar=*/NULL); if (ret == 0 || ret == -ERANGE) { int ret2; bool externs = !af->child; diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index dfcf8cdd9e8d..be7b46ea2460 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -68,7 +68,8 @@ struct probe_finder { /* Call Frame Information from .debug_frame. Not owned. */ Dwarf_CFI *cfi_dbg; Dwarf_Op *fb_ops; /* Frame base attribute */ - unsigned int machine; /* Target machine arch */ + unsigned int e_machine; /* ELF target machine arch */ + unsigned int e_flags; /* ELF target machine flags */ struct perf_probe_arg *pvar; /* Current target variable */ struct probe_trace_arg *tvar; /* Current result variable */ bool skip_empty_arg; /* Skip non-exist args */ From patchwork Thu Oct 17 00:25:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839335 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 46DD8D2F7DE for ; Thu, 17 Oct 2024 02:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XkIA/FyfXW8ws5sjRdf4oBh+1+aldg/GVrUyDFRat30=; b=HeXTdCr9LhNmhGNAxgjDcKOiWu kz1CP4PeD24LXKPiWNmMx4Gwyp6+JFOdOkZ0pOgOekE/YRzlsCN9q91InLxWLqSDb8fRxwwIGpNvW rI49Cd8AhHmnr0UwaER7t0f/QqrrylxaO1B47HeAZrXle2EVlrLNnDIgsiOXgi98WDaPxC0GBwSDN LZSX7zZ4SGm4WnA5go606GGtaL9YHIVMb1SGaXnXGxM+hs/yFwh/pyJqRykelYkHMtJ/ogMVPdQIC NssScKEvKmfW/jCp5IiM4cwaMMq41iQw7OU6somIEwSNEadlebXClNCkLGrbeyA4bKQ+n6n0TLdc3 kU2d5gLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1GHw-0000000DYfO-0XEw; Thu, 17 Oct 2024 02:30:56 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKo-0000000DKDV-0ps1 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:48 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e292a6bdd72so697768276.0 for ; Wed, 16 Oct 2024 17:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124745; x=1729729545; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=XkIA/FyfXW8ws5sjRdf4oBh+1+aldg/GVrUyDFRat30=; b=nM1BnWBLCsC0lh5r4MEWrkhrCee1r5QGWhGqqYztohymCf9ge+ZYsHGdWROgtm755M hSxQaqlh2qvyaWsTxIWNlXiseIF8QqliA5k7Uo4COyj1HCdkmDgqTaUum28KHc0egYU4 OpP93JDDFwWReZk9ckLv+UC5n0ft6MsPnZqJxsApdcZOb1dbdg2vMXU5pO/cMpjplS2v 8jcqFyZVL2QHAJ6U46cacNoM9fOjuZJAqYSDNX4K5rlmw8lYhJIzt05dTtJy9EXwTVZX vhqflZJHWxhdL/iRuSSk32FRT2r1rQ7olykmPU5YKCsqXZUpP01qixFks8XFw1kuCenu tR2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124745; x=1729729545; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XkIA/FyfXW8ws5sjRdf4oBh+1+aldg/GVrUyDFRat30=; b=TSqWhB7JLoRIbO0e3RVVEtAgn07rBxMFIe4U31cmAc/PMBYSO5HZ4F0SGIzvpfQ6HP hBFQYNfEy326oRSWUvXLsttCIh3Tjz3RJnK31mg4ggW/LSgGrwRVK3Tr8FEkWkuAmYW8 N+04ogif/4xzJ1KS4VdeR9ESeHQSFyUDkVkMN6/a1KJO1iYdITE2qIpR+SENZgLmxlHS ZSNMeAJwcPRGZKMNPABGxscFh/aW/LV3tL05L8R4NvIu8qISKZWu3uLQxfflz5jS8W8y +xq3HtZ2dlCAyOxQIOBE7BnVanqSXVnFDBc6tKZxDGjJ3St77VjaxcxiE9aW3JfBNU/m 3vFg== X-Forwarded-Encrypted: i=1; AJvYcCVtbDPvtg0TXmT4M7R1KBDNJnhB02D4J6fqZBpKF2X226Ise6o5kTjOzwvvPEW4PekjC/aotYLxMn5njy4CURnT@lists.infradead.org X-Gm-Message-State: AOJu0YxPp9D83JJQ8BPBJZRQVEMi/m0ME/gFWu378BCDy2Pj4Xe8jSwF XQTm7f9JHuZfYV8diiYn10vN13bABsJKMH4MtrXbaorH3tjsLhyyxc7g30QUAsMABcsw1IhJ6HX 1mZc08Q== X-Google-Smtp-Source: AGHT+IFe1Hb6lpRahuVZ4DDC/bHM6yCUrUEOQ+AJ0+tNqmO08JGP6ePh7fxc0X0rMoFvoFsezm94Q0V+zEE6 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:a267:0:b0:e28:ec75:75ed with SMTP id 3f1490d57ef6-e29780ec57amr6223276.0.1729124744652; Wed, 16 Oct 2024 17:25:44 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:07 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-8-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 07/20] perf dwarf-regs: Move x86 dwarf-regs out of arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172546_276539_820A61B1 X-CRM114-Status: GOOD ( 16.65 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move arch/x86/util/dwarf-regs.c to util/dwarf-regs-x86.c and compile in unconditionally. To avoid get_arch_regnum being duplicated, rename to get_x86_regnum and add to get_dwarf_regnum switch. For get_arch_regstr, this was unused on x86 unless the machine type was EM_NONE. Map that case to EM_HOST and remove get_arch_regstr from dwarf-regs-x86.c. Signed-off-by: Ian Rogers --- tools/perf/arch/x86/util/Build | 3 --- tools/perf/util/Build | 1 + .../dwarf-regs.c => util/dwarf-regs-x86.c} | 24 +------------------ tools/perf/util/dwarf-regs.c | 17 +++++++++++++ tools/perf/util/include/dwarf-regs.h | 8 +++++++ 5 files changed, 27 insertions(+), 26 deletions(-) rename tools/perf/{arch/x86/util/dwarf-regs.c => util/dwarf-regs-x86.c} (77%) diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build index 9705cda4f240..70af491a6dd7 100644 --- a/tools/perf/arch/x86/util/Build +++ b/tools/perf/arch/x86/util/Build @@ -12,9 +12,6 @@ perf-util-y += evsel.o perf-util-y += iostat.o perf-util-y += env.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o -perf-util-$(CONFIG_BPF_PROLOGUE) += dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 1eedead5f2f2..4c615611b9d7 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -203,6 +203,7 @@ endif perf-util-$(CONFIG_LIBDW) += probe-finder.o perf-util-$(CONFIG_LIBDW) += dwarf-aux.o perf-util-$(CONFIG_LIBDW) += dwarf-regs.o +perf-util-$(CONFIG_LIBDW) += dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) += debuginfo.o perf-util-$(CONFIG_LIBDW) += annotate-data.o diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/util/dwarf-regs-x86.c similarity index 77% rename from tools/perf/arch/x86/util/dwarf-regs.c rename to tools/perf/util/dwarf-regs-x86.c index 530905118cd4..7a55c65e8da6 100644 --- a/tools/perf/arch/x86/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs-x86.c @@ -11,28 +11,6 @@ #include /* for ARRAY_SIZE */ #include -#define DEFINE_DWARF_REGSTR_TABLE 1 -#include "dwarf-regs-table.h" - -/* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_arch_regstr(unsigned int n) -{ -#if defined(__i386__) - size_t len = ARRAY_SIZE(x86_32_regstr_tbl); -#else - size_t len = ARRAY_SIZE(x86_64_regstr_tbl); -#endif - - if (n >= len) - return NULL; - -#if defined(__i386__) - return x86_32_regstr_tbl[n]; -#else - return x86_64_regstr_tbl[n]; -#endif -} - struct dwarf_regs_idx { const char *name; int idx; @@ -58,7 +36,7 @@ static const struct dwarf_regs_idx x86_regidx_table[] = { { "rip", DWARF_REG_PC }, }; -int get_arch_regnum(const char *name) +int get_x86_regnum(const char *name) { unsigned int i; diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 86b3ef638fbb..eac99a246737 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,9 +32,17 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { +#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 + if (machine == EM_NONE) { + /* Generic arch - use host arch */ + machine = EM_HOST; + } +#endif switch (machine) { +#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); +#endif case EM_386: return __get_dwarf_regstr(x86_32_regstr_tbl, n); case EM_X86_64: @@ -65,10 +73,12 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, return NULL; } +#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 __weak int get_arch_regnum(const char *name __maybe_unused) { return -ENOTSUP; } +#endif /* Return DWARF register number from architecture register name */ int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int flags __maybe_unused) @@ -90,9 +100,16 @@ int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int flags machine = EM_HOST; } switch (machine) { +#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 case EM_HOST: reg = get_arch_regnum(regname); break; +#endif + case EM_X86_64: + fallthrough; + case EM_386: + reg = get_x86_regnum(regname); + break; default: pr_err("ELF MACHINE %x is not supported.\n", machine); } diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 925525405e2d..062623aefd5a 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,10 @@ #define DWARF_REG_FB 0xd3affb /* random number */ #ifdef HAVE_LIBDW_SUPPORT +#if !defined(__x86_64__) && !defined(__i386__) const char *get_arch_regstr(unsigned int n); +#endif + /** * get_dwarf_regstr() - Returns ftrace register string from DWARF regnum. * @n: DWARF register number. @@ -88,7 +91,12 @@ const char *get_arch_regstr(unsigned int n); */ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags); +int get_x86_regnum(const char *name); + +#if !defined(__x86_64__) && !defined(__i386__) int get_arch_regnum(const char *name); +#endif + /* * get_dwarf_regnum - Returns DWARF regnum from register name * name: architecture register name From patchwork Thu Oct 17 00:25:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839240 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 5558DD2F7D7 for ; Thu, 17 Oct 2024 01:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dslSAnjJv4+bi+jw9vLrzNQpv+NsibScELb0cgIuYNw=; b=YI70heJECHQNIiBq0F5QCIWX/H vlAmA7yU/wyKZllmu0O8DVZRyIA9KX5fVRKuNzO0m+tnLExc1uVH4KcBieBz3IHlavEKbtNumxM7G 2gkirOuBfAb/lCQOIWN73UfmMtyOXJBQisLM3fTxH8LiAwRWZcYPNyEu7vaNK+ypAyIygAZHQ7bOP fIr7DQPA7RI8QpsIbkeNYmWvwI545VI2vOuYzaoV6/RM+BXEyUxK+j1TO8qjr+50rm1MnFoTEAGye 5uaWghccn1FbQ+Z8B0JSXSb6YK3FXj8rIdtfF41ccoYQQRd+Jac9jXkfcAIT8YVLu853bh5rV6VRV PauH2CfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1FCN-0000000DR5o-2dOb; Thu, 17 Oct 2024 01:21:07 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKq-0000000DKFC-3yKz for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:50 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e2605ce4276so775877276.3 for ; Wed, 16 Oct 2024 17:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124747; x=1729729547; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=dslSAnjJv4+bi+jw9vLrzNQpv+NsibScELb0cgIuYNw=; b=OoDur39ygJfwjLvRJGQW4ah5Imn0bTgCQy0NSv69eeSyrXqLtA6M1XCSyNXPka+IYA pEENTe/IBIBndVbqQL/vqQeYZkffuqk22cfEFpz5L+hjf7nyKLYhH9BeRJwAsb1XVxO9 uJQYbss5HBzipyerCkkKyvSHHIh6CXc4AfCEiXEg8FvAGh/f1Lzv6it5uh6ktqjCWoTm RgkhzQ6dJEPF1Gl/3gM5onH0Kt2J7PJ08fi+FNIXbLnFj8tmf6OpWD9Y81zUN0QTYkUO CeIDX1rHbSgXDmGfqX6bxKg93bsu1/b3zPw2XBv8Dl+RO5ZamfkyoJl4lVHgvmuaEKNX npPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124747; x=1729729547; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dslSAnjJv4+bi+jw9vLrzNQpv+NsibScELb0cgIuYNw=; b=T9Yt5q/46paFYysibNyDTtEjFP3Mawh/KXxaApe8o1Bk8CReL+eAc5PCeJkuYxq8O3 R661HtA45f8xCsos/Uiu5IxvJ3kvUnvdN3bpua1nqdJVa3O5K5RlkMuHQ698GJeWfBxS HIqfEKhCadOMq/tB7wjkZDR2IyNxeRFW6lX8jdLL1kD+zq9s+D3ud/IPR4Q01JXw4266 j5CC9i70ntbGN1sbXWqvjQbHuqeq/+eHkA3jaZE5K483dSLw8kfvM3vZQjy/XMH7nhjT HiRp3TZ+UYr5xTrZwjF7FlfZpC2lTJAKeD4vE8Ot8COVwYlEXkpiTpULZfz+G8VchEZU +AVw== X-Forwarded-Encrypted: i=1; AJvYcCWmytIS1doNMx2L978BynKf/VpazbMQvrRRTCJ0XNpWTyyDQYAgJTJ5P+aVvU3K25OZJsqH1cl+rC7Fs8uoTuQ9@lists.infradead.org X-Gm-Message-State: AOJu0Yy2XnWK9BZHRiMVpeTRBrdpnxvORk6k8BZSbdaAF0mDH+lK4lIC Ky6wDEEy4AodrF3MVeDV+1UUK7NRCg+Wgg2n7Iqu4G5zo4FBEHAcXp/2SnMaXKjO9K27hW8viEU ALcvTJg== X-Google-Smtp-Source: AGHT+IGX+xXJQajfsUo21pSiHMMPg3ixWu0rLrNuUSYK4yFL/4dyDAI12MBtvoLY2sM/xxmxtpwsQUR20SGF X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a5b:505:0:b0:e28:8f00:896a with SMTP id 3f1490d57ef6-e2978594c30mr3203276.8.1729124747028; Wed, 16 Oct 2024 17:25:47 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:08 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-9-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 08/20] perf arm64: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172549_018136_1520F197 X-CRM114-Status: GOOD ( 20.73 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for arm64 in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/dwarf-regs.c | 80 ------------------------- tools/perf/util/dwarf-regs.c | 4 +- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 84 deletions(-) delete mode 100644 tools/perf/arch/arm64/util/dwarf-regs.c diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build index 4387a6d6a6c3..a74521b79eaa 100644 --- a/tools/perf/arch/arm64/util/Build +++ b/tools/perf/arch/arm64/util/Build @@ -4,7 +4,6 @@ perf-util-y += perf_regs.o perf-util-y += tsc.o perf-util-y += pmu.o perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm64/util/dwarf-regs.c deleted file mode 100644 index 343a62fa4199..000000000000 --- a/tools/perf/arch/arm64/util/dwarf-regs.c +++ /dev/null @@ -1,80 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Will Deacon, ARM Ltd. - */ - -#include -#include -#include -#include -#include - -struct regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} -#define GPR_DWARFNUM_NAME(num) \ - {.name = __stringify(%x##num), .dwarfnum = num} -#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadwarf64.pdf - */ -static const struct regs_dwarfnum regdwarfnum_table[] = { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - GPR_DWARFNUM_NAME(11), - GPR_DWARFNUM_NAME(12), - GPR_DWARFNUM_NAME(13), - GPR_DWARFNUM_NAME(14), - GPR_DWARFNUM_NAME(15), - GPR_DWARFNUM_NAME(16), - GPR_DWARFNUM_NAME(17), - GPR_DWARFNUM_NAME(18), - GPR_DWARFNUM_NAME(19), - GPR_DWARFNUM_NAME(20), - GPR_DWARFNUM_NAME(21), - GPR_DWARFNUM_NAME(22), - GPR_DWARFNUM_NAME(23), - GPR_DWARFNUM_NAME(24), - GPR_DWARFNUM_NAME(25), - GPR_DWARFNUM_NAME(26), - GPR_DWARFNUM_NAME(27), - GPR_DWARFNUM_NAME(28), - GPR_DWARFNUM_NAME(29), - REG_DWARFNUM_NAME("%lr", 30), - REG_DWARFNUM_NAME("%sp", 31), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is not - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct regs_dwarfnum *roff; - - for (roff = regdwarfnum_table; roff->name != NULL; roff++) - if (roff->dwarfnum == n) - return roff->name; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index eac99a246737..18e916c8e993 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,14 +32,14 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { -#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 +#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; } #endif switch (machine) { -#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 +#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 062623aefd5a..e640657f69c8 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,7 @@ #define DWARF_REG_FB 0xd3affb /* random number */ #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839241 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 D8269D2F7D7 for ; Thu, 17 Oct 2024 01:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=um/dxmdAe6wcb5R4JQ4GBtPj+lDN5EAHVRH3aRzp8nM=; b=VPfdzgfl9Z39vwcDW7h1RUQTkY NsKwLGDTDWj3un9uMCshHTYVj0axyf5DKAZfM9N1fQhyC72GMiOq5I4JqoDADUgrb3oGWh88bcElU ICP5x6xiCAIg+qijwJcEJkL5e42Hql1Q41hZe0eDmdg76IVPQEMaV0RkMDC2tzyZM7kHaZm2SO+QG fx7fdZVrjcqcUiFHw1/FYsK2Sd6g8MCdSVSHeqWIw+DYTpX84D+9UK+UtPC/fkrS/hRDZ+H95eRSH KIZdP4TwQjfudY20V36scLFsEgRmKKFFW7rCrDeVyyPeTJ0GsITsMZPtHLiMM9ibBrZn8bPPKni/O 0mw6al1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1FDn-0000000DRPa-2o21; Thu, 17 Oct 2024 01:22:35 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKt-0000000DKGw-1lsC for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:52 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6dbbeee08f0so21879057b3.0 for ; Wed, 16 Oct 2024 17:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124750; x=1729729550; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=um/dxmdAe6wcb5R4JQ4GBtPj+lDN5EAHVRH3aRzp8nM=; b=C/fsDSQuf4e5Lbij2mrp5qghGLacIkjRalsER+QNou9qIMEkgoWJ7QMKo7DzDzwNJ/ vcgdl+Oh7RAIXBuloNmDOGEiqgGfnLhvHZcDZSkDzA9VltmDId7nlc/c+GIj+g2NdjRi PSJLa6d/Ha0FqThtWNvqkaR5y5KMoY5UQDSNeJr/MVXtt6aCm1XFme9vxBp1mZqIBN/n lFzJMgWC6XbnNF9lsc+bzTSp2nag+3mN7DnsdyuMkTC7+Rpn265S9MUrrTGsI0pr82HH cUT82HrTcXtKXWKg0lQFwbHkq1suJFQ2YftBySDkJeYiVQk0rgiX+jDv8PH8isOnj3/e ly+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124750; x=1729729550; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=um/dxmdAe6wcb5R4JQ4GBtPj+lDN5EAHVRH3aRzp8nM=; b=ucRdpBgbz+lx4LBkf2/uVFWqheWvkATvyfX0CXnPnIIAm01Akx4NnSRYwoIL6UBo1S D1NWZLnUAgUfKzfejitf+ZYRTBcwJvBunD2O4yOjO2z2dTOyozkLC5ACThGaDJcQUPuT YI0aEW4eNLxY6O6mog4iUIjmAEnM+DpXcrH4nUx3yaUrtOFB4y5zay4esBbZ/ihpcVeU sIQyG/m8pWJ/OtNouPbO8enSX+H8pKrHeZAmaQLOnf1/9udHqGEujDaZUlw8tOFJxVWX YpcXngHyaufofNgu6+nwdSFVqMxswXajWEfx3McZ/4BfdkcsxfcjrWE//N9dDU8Vgmn6 zUTQ== X-Forwarded-Encrypted: i=1; AJvYcCXz9/nUbOBr1KM3JAIvrHSq+gYWRd3OaJ/j5Pe6FNQdiXHsN6JcDjR8RivzV93vuxSDlL8avgHNE2w6+j13exWg@lists.infradead.org X-Gm-Message-State: AOJu0YwYoVBzD/dCNUy2fnNFmxv2NGhMCXahIJ5v4HQ5H/Zt3OFxW+7i +NYIfcgJWfF1aZga05Vf8kwmp6pGuQLlIc+b3cEXNWYtQYwmLx/YOahCCuwtgKFjQg/bORZVkgj 18Wy+0Q== X-Google-Smtp-Source: AGHT+IEIO7/kIuzXCKLj4vkEiDjLakQIWKT4RUUiJCfFHJfsVrGiZuOblfcM3qLnbWUnO4MbN9NTPRAGbIyC X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:2e45:0:b0:e20:2da6:ed77 with SMTP id 3f1490d57ef6-e2b9ce95b1bmr2417276.5.1729124749588; Wed, 16 Oct 2024 17:25:49 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:09 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-10-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 09/20] perf arm: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172551_498317_4B1D9B80 X-CRM114-Status: GOOD ( 20.71 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for arm in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/arm/util/Build | 2 - tools/perf/arch/arm/util/dwarf-regs.c | 61 --------------------------- tools/perf/util/dwarf-regs.c | 4 +- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 tools/perf/arch/arm/util/dwarf-regs.c diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index e06fea1ea8ff..f7a8b37d1c68 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -1,7 +1,5 @@ perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/arch/arm/util/dwarf-regs.c b/tools/perf/arch/arm/util/dwarf-regs.c deleted file mode 100644 index fc5f71c91802..000000000000 --- a/tools/perf/arch/arm/util/dwarf-regs.c +++ /dev/null @@ -1,61 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Will Deacon, ARM Ltd. - */ - -#include -#include -#include - -struct pt_regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} -#define GPR_DWARFNUM_NAME(num) \ - {.name = __stringify(%r##num), .dwarfnum = num} -#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040a/IHI0040A_aadwarf.pdf - */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] = { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - REG_DWARFNUM_NAME("%fp", 11), - REG_DWARFNUM_NAME("%ip", 12), - REG_DWARFNUM_NAME("%sp", 13), - REG_DWARFNUM_NAME("%lr", 14), - REG_DWARFNUM_NAME("%pc", 15), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is not - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct pt_regs_dwarfnum *roff; - for (roff = regdwarfnum_table; roff->name != NULL; roff++) - if (roff->dwarfnum == n) - return roff->name; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 18e916c8e993..fd21f9e90e40 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,14 +32,14 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags __maybe_unused) { -#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 +#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; } #endif switch (machine) { -#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 +#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index e640657f69c8..0b533409d82a 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,7 @@ #define DWARF_REG_FB 0xd3affb /* random number */ #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839334 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 9D561D2F7DA for ; Thu, 17 Oct 2024 02:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WG2Q2FB5LUQz01Yds7IeFcawWLtm3SGWZPYeFSNMQiM=; b=Vn/2LcE0eT6ZmOOkf4hBrL9r2I musMjv7SFevrcongGK2H4wmh1RIX6hulAr7yQoJWEYKAiVq2HwsBD6pJOvoc6VT4h6s5Hzuow+KAK R8O5MALreRa8zpkySzLfXy5qeJkBsnpeirP/trfkbrrkrsj3AQaZhtG9pLd/K8adlQlw/lo4POQm7 aPNFydMQ+YPsKPBzMo2+5yYw2KWoxEdJWdYdOz9AK7oRCqn+zJua9AKUS4m23sC/a/EE7DEXJMuIW ZScTknpTWxK3lauQ6sfoZH5yg/fDz0zblglhrBMUVAeqX4I8DzUhzVw5oUEVkH5egLrjVHA9GWJoU LjeRLgBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1GHw-0000000DYfT-2uNS; Thu, 17 Oct 2024 02:30:56 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKw-0000000DKI1-0GUi for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:56 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e2974759f5fso519401276.0 for ; Wed, 16 Oct 2024 17:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124752; x=1729729552; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=WG2Q2FB5LUQz01Yds7IeFcawWLtm3SGWZPYeFSNMQiM=; b=OWnlfDYv4pKNN27AuY1oQdaIj/UwWNDmgX0sGhgfu9ZyZ10Er9MpsWkLUp+ZTLwbdX J8oGQBhSucBPwxyF3WUeEtIJCMnnepajQBHOXdl5/B5rL3cK1l1rniar8xtxwx0LLO1U bJN/yMOnhUVUiIUgnxLjmQ4WLBxdfuREwO43ycIMsjANLROHugDg3ECDxu/EJLP7dtFg aAywtYItQHCbm3xs6nAmDRxXfxQHI3zCqmirOg2QGJMIg6ls7ss3P4ZaNk9sRlytShyh VWC45L5hn9gMALzEB0JkKiq7bFoDfExkBh6eQs87LYlgGlzQwhhJchs+t57FTuP/fGgu f+uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124752; x=1729729552; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WG2Q2FB5LUQz01Yds7IeFcawWLtm3SGWZPYeFSNMQiM=; b=V6qrrlgEeQCAAguuQ6VrkRbLeNhDnHu8y+xWddxbDL85IEptNmoPdq42d09X+fCzDH mhy+hEQc4g26QxnuKj1uEf7vKJ5F7OLonejeLqv9cm4pyCFZIfclObuUyBauCF8MqxPO zXm/aHo6rdGAfWyqvI8mxzsaDceAPTf7TuW/S4RKAMrxB1vEsm8rcFctKr8KHx4dglEE h+KEJNmyQiJcGf4HW+QnzKpDsW79fuIhdjtt6MyZDjC0pM2SfjgJUGqBveizwEVyXma/ H2bVkp/jWmANYeo9LlTzf3pScCp7ZWMFLx/bx/X8M2OBS1CM9+ICbmSpM7u4PQckEYQz Bemg== X-Forwarded-Encrypted: i=1; AJvYcCVJz/GpwHzviUtzUjo2pHLxSmkSDJsRl84DsbrE6Fd9oKY8NQRf9HFiOVlPkUbGSg8TQg+HK/YQwtF9gR2y0V9g@lists.infradead.org X-Gm-Message-State: AOJu0YzwLOmTgLO8zLG8ibaHxu9xha3R3JVwYHEsj30w6U2LtbGYeng8 +rOF5ki2u5B8o89lgVRrbgN3sVY7iEZZIRBYuPAZ37U9m294v/1RHJI7Clt0EYtQx2bX6XAtyMu ZhKYBuA== X-Google-Smtp-Source: AGHT+IG59YkLvXbjXDygQC7BU6le1sFVoo2SJFZVP20/F7DRXE23oZyCK22C1Wgez9VaPqSPFNUmUo+ETWGD X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:bd91:0:b0:e0b:f6aa:8088 with SMTP id 3f1490d57ef6-e2b9cdec686mr2964276.1.1729124752310; Wed, 16 Oct 2024 17:25:52 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:10 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-11-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 10/20] perf dwarf-regs: Move csky dwarf-regs out of arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172554_125734_AE03B4FB X-CRM114-Status: GOOD ( 15.99 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move arch/csky/util/dwarf-regs.c to util/dwarf-regs-csky.c and compile in unconditionally. To avoid get_arch_regstr being duplicated, rename to get_csky_regstr and add to get_dwarf_regstr switch. Update #ifdefs to allow ABI V1 and V2 tables at the same time. Determine the table from the ELF flags. Signed-off-by: Ian Rogers --- tools/perf/arch/csky/util/Build | 1 - tools/perf/util/Build | 1 + .../dwarf-regs.c => util/dwarf-regs-csky.c} | 19 ++++++++++--------- tools/perf/util/dwarf-regs.c | 11 +++++++---- tools/perf/util/include/dwarf-regs.h | 2 ++ 5 files changed, 20 insertions(+), 14 deletions(-) rename tools/perf/{arch/csky/util/dwarf-regs.c => util/dwarf-regs-csky.c} (74%) diff --git a/tools/perf/arch/csky/util/Build b/tools/perf/arch/csky/util/Build index 1325310cab6a..5e6ea82c4202 100644 --- a/tools/perf/arch/csky/util/Build +++ b/tools/perf/arch/csky/util/Build @@ -1,4 +1,3 @@ perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 4c615611b9d7..99ae4e2802b8 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -203,6 +203,7 @@ endif perf-util-$(CONFIG_LIBDW) += probe-finder.o perf-util-$(CONFIG_LIBDW) += dwarf-aux.o perf-util-$(CONFIG_LIBDW) += dwarf-regs.o +perf-util-$(CONFIG_LIBDW) += dwarf-regs-csky.o perf-util-$(CONFIG_LIBDW) += dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) += debuginfo.o perf-util-$(CONFIG_LIBDW) += annotate-data.o diff --git a/tools/perf/arch/csky/util/dwarf-regs.c b/tools/perf/util/dwarf-regs-csky.c similarity index 74% rename from tools/perf/arch/csky/util/dwarf-regs.c rename to tools/perf/util/dwarf-regs-csky.c index ca86ecaeacbb..d38ef1f07f3e 100644 --- a/tools/perf/arch/csky/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs-csky.c @@ -5,9 +5,8 @@ #include #include -#if defined(__CSKYABIV2__) -#define CSKY_MAX_REGS 73 -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { +#define CSKY_ABIV2_MAX_REGS 73 +const char *csky_dwarf_regs_table_abiv2[CSKY_ABIV2_MAX_REGS] = { /* r0 ~ r8 */ "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", "%regs2", "%regs3", /* r9 ~ r15 */ @@ -26,9 +25,9 @@ const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "%epc", }; -#else -#define CSKY_MAX_REGS 57 -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { + +#define CSKY_ABIV1_MAX_REGS 57 +const char *csky_dwarf_regs_table_abiv1[CSKY_ABIV1_MAX_REGS] = { /* r0 ~ r8 */ "%sp", "%regs9", "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", /* r9 ~ r15 */ @@ -41,9 +40,11 @@ const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "%epc", }; -#endif -const char *get_arch_regstr(unsigned int n) +const char *get_csky_regstr(unsigned int n, unsigned int flags) { - return (n < CSKY_MAX_REGS) ? csky_dwarf_regs_table[n] : NULL; + if (flags & EF_CSKY_ABIV2) + return (n < CSKY_ABIV2_MAX_REGS) ? csky_dwarf_regs_table_abiv2[n] : NULL; + + return (n < CSKY_ABIV1_MAX_REGS) ? csky_dwarf_regs_table_abiv1[n] : NULL; } diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index fd21f9e90e40..9a76f83af62c 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -29,17 +29,18 @@ #define __get_dwarf_regstr(tbl, n) (((n) < ARRAY_SIZE(tbl)) ? (tbl)[(n)] : NULL) /* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_dwarf_regstr(unsigned int n, unsigned int machine, - unsigned int flags __maybe_unused) +const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags) { -#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM +#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ + || EM_HOST == EM_CSKY if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; } #endif switch (machine) { -#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM +#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ + && EM_HOST != EM_CSKY case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif @@ -51,6 +52,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, return __get_dwarf_regstr(arm_regstr_tbl, n); case EM_AARCH64: return __get_dwarf_regstr(aarch64_regstr_tbl, n); + case EM_CSKY: + return get_csky_regstr(n, flags); case EM_SH: return __get_dwarf_regstr(sh_regstr_tbl, n); case EM_S390: diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 0b533409d82a..b72d9d308ce4 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -83,6 +83,8 @@ const char *get_arch_regstr(unsigned int n); #endif +const char *get_csky_regstr(unsigned int n, unsigned int flags); + /** * get_dwarf_regstr() - Returns ftrace register string from DWARF regnum. * @n: DWARF register number. From patchwork Thu Oct 17 00:25:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839336 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 B5A1BD2F7DA for ; Thu, 17 Oct 2024 02:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qQMh1GkNDXXWwo5/jydOz7DZ+MfVb3HK+m6RjxS97PU=; b=0dodPvvdnSFTLqPG13ZTKXEcf8 Li/UFxZsPy434w9Xxm6rclhsitdDaKRunOg4KI9BzkwgcQhK20XsX0uqzRbbldqJy4bbCNP9hdJZe CPnEeE6tAtWxiexvWsTT+yciZArtvKTkPM/J5MVHtOYGNZqP4+vIwmwWwUPEjYxrtve65zVhgdIq8 qAR5Xmtg7QKxjac/y+87Xp4HMVUhZ27tTaDv6Q5R6xrVswYrEZJjyWCtql8WoNyuxJxNDSI9iIjAU 6k+NeQjg34YUVGrLMHvQqu233zp8TwVJPzihlkBy+E5krp8csB4V8+x01v2V82UEBB9YzwhnBfrL9 21rJLDhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1GHx-0000000DYfv-1EHK; Thu, 17 Oct 2024 02:30:57 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EKy-0000000DKJQ-1ylI for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:58 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6e321d26b38so9563457b3.2 for ; Wed, 16 Oct 2024 17:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124755; x=1729729555; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=qQMh1GkNDXXWwo5/jydOz7DZ+MfVb3HK+m6RjxS97PU=; b=ogGdUEhnHoAEIM3cVEifaAdsZLmKPI624l3S84F7XYSnocFpchFkezsuh1DzLh1Izl /LYBVsBTIv/fvsGS0pg7/3e9bCcrg64bHOaMfOX1zs79HngTBMbV1Pk+ZRDgFTlbppeD BpUPdJoqJ/ZxwUF085XQPLaXEFu6U/eeXRvNKNuN+sLeU0hKLhrJklsVHUGMPIC8gMow bbjpU9KGF9k0x/MEh4UkiGUsG0GcjbXWGvVos4518Ln0RoTGj1rG27JU+pzfUz/xAqfP 5r/PhiVSacBroFeymhXpRJbwpCQce6xuOmqPrmCPM6HgetbcJJspmqIaUJozgF3AVAgW q00A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124755; x=1729729555; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qQMh1GkNDXXWwo5/jydOz7DZ+MfVb3HK+m6RjxS97PU=; b=uM5TfOPFyL17h4s8vM8VYcx6bstqRkqTqX1n/NuqXOmul8v1dXMrrh5X7IjMot17em tw+n83kgE1o+54VoYGp/P9ZKzlbzU64Hyk80YQG9uHJaTDikjz/Zc0dRgvQsGst6U4jz mgqdLlBq3NItL52+ezrNOJmAk0XRCcV1Vr4UDuVWLgEIkLIfh70oI1in2dMXQ/ac2bhe oqwBNX19LGKLlE1nIJ9ToiSXy2pl2P0HkeF/KrTereSIKGgEZVtzekS2epgIyeZ9EE2G dyFzk3idGh0Ct0ovbw3HNvemgRqeNDFHWaGNQVqiZ+Vn6/YRGlqYb4cZJnpEwa+2NCjl M6aQ== X-Forwarded-Encrypted: i=1; AJvYcCUOsbWbCplCZEohPYXZxAEdIwhgGwZ7laAqVNAlWcoNGkp11/VUaPozrf9h8e63hhM3DF2uAluAji0C7oxcIDoY@lists.infradead.org X-Gm-Message-State: AOJu0YwjCj+18k8qSa3bTP2f+65m9BnUKR+GbVSJFa/JPpKpbrx9ozzI 2BQuEhIlOOpbm9PwkRLWv4Ju0CU98BlrrvAHVYpsgFhiGto7INkUBvBDcupVIbmVVbd/IgeSi+L 7uAXTKA== X-Google-Smtp-Source: AGHT+IFbm6vwQJDAC4QPC5+PLfr8ycUWXoPY5PpZT0CV0PYSnLWVe//zo2w300WIdP2MxiCfoWlmNy3scmw0 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a0d:c405:0:b0:6b2:3ecc:817 with SMTP id 00721157ae682-6e3d41eb817mr501607b3.8.1729124754732; Wed, 16 Oct 2024 17:25:54 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:11 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-12-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 11/20] perf loongarch: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172556_620941_AD856CC1 X-CRM114-Status: GOOD ( 18.67 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for loongarch in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/loongarch/util/Build | 1 - tools/perf/arch/loongarch/util/dwarf-regs.c | 34 --------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 3 +- 4 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 tools/perf/arch/loongarch/util/dwarf-regs.c diff --git a/tools/perf/arch/loongarch/util/Build b/tools/perf/arch/loongarch/util/Build index 06ff95394921..0aa31986ecb5 100644 --- a/tools/perf/arch/loongarch/util/Build +++ b/tools/perf/arch/loongarch/util/Build @@ -1,7 +1,6 @@ perf-util-y += header.o perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o diff --git a/tools/perf/arch/loongarch/util/dwarf-regs.c b/tools/perf/arch/loongarch/util/dwarf-regs.c deleted file mode 100644 index bee08fdcf2fd..000000000000 --- a/tools/perf/arch/loongarch/util/dwarf-regs.c +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * dwarf-regs.c : Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2020-2023 Loongson Technology Corporation Limited - */ - -#include -#include /* for EINVAL */ -#include /* for strcmp */ -#include - -struct pt_regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -static struct pt_regs_dwarfnum loongarch_gpr_table[] = { - {"%r0", 0}, {"%r1", 1}, {"%r2", 2}, {"%r3", 3}, - {"%r4", 4}, {"%r5", 5}, {"%r6", 6}, {"%r7", 7}, - {"%r8", 8}, {"%r9", 9}, {"%r10", 10}, {"%r11", 11}, - {"%r12", 12}, {"%r13", 13}, {"%r14", 14}, {"%r15", 15}, - {"%r16", 16}, {"%r17", 17}, {"%r18", 18}, {"%r19", 19}, - {"%r20", 20}, {"%r21", 21}, {"%r22", 22}, {"%r23", 23}, - {"%r24", 24}, {"%r25", 25}, {"%r26", 26}, {"%r27", 27}, - {"%r28", 28}, {"%r29", 29}, {"%r30", 30}, {"%r31", 31}, - {NULL, 0} -}; - -const char *get_arch_regstr(unsigned int n) -{ - n %= 32; - return loongarch_gpr_table[n].name; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 9a76f83af62c..efc41d0fbee9 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,7 +32,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags) { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ - || EM_HOST == EM_CSKY + || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -40,7 +40,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int #endif switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ - && EM_HOST != EM_CSKY + && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index b72d9d308ce4..4f205a58db89 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,7 +79,8 @@ #define DWARF_REG_FB 0xd3affb /* random number */ #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) +#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ + && !defined(__loongarch__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839242 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 D460ED2F7D8 for ; Thu, 17 Oct 2024 01:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=d1gwdO3+1z4qg/OPZ1ChVHm0fXT+3tjeEKhF61J/sGo=; b=GEgRfE4lDm58cV2GaY4gQWjt6W Hs+v/7CfwBLsmuIy5I1T+10l/peKKB5ZyMWB16RiOINJAEykolYGrOtAzZoLciPqd7nboBPxVzXWW dCVVx4QUNSZcchWBZvb7Yxjq3rX/9DhwTXChUSbngX6kfdje6Ykn8pTaedXNnlYGv3Ioi3lGjGyDV N6SCYVSzjcNJNFnTsNObYSk4+jVC7aZpriAcDFlLJ1Nz7r6dBnZJnhyxeOGaMfmw/gJn/qy+0DCHl l0Fe4Dh3TmLFtDgbmUM38flFqvH6Z/V/lBi/BHLp9kuzKSpI5xTnjUGPXlFCAJi+dljXFgCbXczhr rJvy3TNg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1FI1-0000000DSB5-2G09; Thu, 17 Oct 2024 01:26:57 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EL0-0000000DKKv-1fZ1 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:59 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6e59dc7df64so5088887b3.1 for ; Wed, 16 Oct 2024 17:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124757; x=1729729557; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=d1gwdO3+1z4qg/OPZ1ChVHm0fXT+3tjeEKhF61J/sGo=; b=1bJaQM1/UrDw82fE8kPzLZPEIk0zPyo08R3zutc2Cr7pXnxtaL/se2QSfU2w/C9A0i htrEFBP7dc0GdsX/P2kigic8IRDaTjJXGEzsnIPKZBXoOkxkUTg4josAlujHp5o5endT UMNyaSxrj5I9ms61wJhw4LFSHFU8fYuHM8v25gZW5R43fWJzd3Q2LWdYXvR516nojD5i O0FYHVA+cCXTLU1csHC/eNWTUFun7I5YZhwCBgEzK5tOYykVMhlHggwa+U4V2+6hnZLg +b5BmE2VaXi0DhW/GCmoO1SoaM/t0ud0c/Z8UHacovWfS/DhDHsaMkM+uBPrW/xhudXA h9Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124757; x=1729729557; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d1gwdO3+1z4qg/OPZ1ChVHm0fXT+3tjeEKhF61J/sGo=; b=YfgaGnarxrdERyo12l6IqTrovaHQrUc4hrLoyAW6ZcYunc40yHa/zliXwBx/S+uEpN BUpqb/BTeko8bQRuhd7dUEPgFzFKCqytKcG1m0csZVtC/NgPUZ8NytazRaEEweAohLfn kkZfV/wKkkZIpD1hIu/Hfnfw21JacAiHy+WVr7Iv2kdJTB/WFAKiy0HTYJq+8BvlDzu+ Q9vH4QXru876FYk8b3lWoF7SB5kxgie65jmOBdjJVDNO+/RToYqbpfDt930P/uWnfF4N N3DBw3Jvn1lkHM54uYZW73AJTnRUL/J6+JnamaISVkXmhYziiRq93/orw+3H5LjsDdlY 9p6A== X-Forwarded-Encrypted: i=1; AJvYcCXBfeL9Sa+VrTX3gLkyngFaeNh3GkxwW1FAgSI+R2rGC+awwXJ8qyBEbRmSh8HwYbTMLUXzT8jsEGv7eD43prpa@lists.infradead.org X-Gm-Message-State: AOJu0YzO8DeQBZ8ogXg2t5HBmQ71c5nfY0u2xIhHDgIL6cmsnFqrKKcz JLnP9wlD3hDSeunJx4VID2EcTA6QHqcF7hhEg58nNO7FajwEdpscTSZAgj6MTftIazPdSa9Fx9B SLwLtqg== X-Google-Smtp-Source: AGHT+IEOn1sxy9x0RhzE2O4lUwxI35kyyV2nRBroxh4Xt3euuArl/KNycbORbJCMSm8H+wpY0Zuqg0FylbxQ X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:2d04:b0:6e2:c1c7:ec27 with SMTP id 00721157ae682-6e5a3d1cb28mr93127b3.1.1729124757072; Wed, 16 Oct 2024 17:25:57 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:12 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-13-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 12/20] perf mips: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172558_560847_471215F6 X-CRM114-Status: GOOD ( 21.72 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for mips in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/mips/util/Build | 1 - tools/perf/arch/mips/util/dwarf-regs.c | 38 -------------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 tools/perf/arch/mips/util/dwarf-regs.c diff --git a/tools/perf/arch/mips/util/Build b/tools/perf/arch/mips/util/Build index b328109fc16c..691fa2051958 100644 --- a/tools/perf/arch/mips/util/Build +++ b/tools/perf/arch/mips/util/Build @@ -1,3 +1,2 @@ perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o diff --git a/tools/perf/arch/mips/util/dwarf-regs.c b/tools/perf/arch/mips/util/dwarf-regs.c deleted file mode 100644 index 25c13a91c2a7..000000000000 --- a/tools/perf/arch/mips/util/dwarf-regs.c +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * dwarf-regs.c : Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2013 Cavium, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include -#include - -static const char *mips_gpr_names[32] = { - "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", - "$10", "$11", "$12", "$13", "$14", "$15", "$16", "$17", "$18", "$19", - "$20", "$21", "$22", "$23", "$24", "$25", "$26", "$27", "$28", "$29", - "$30", "$31" -}; - -const char *get_arch_regstr(unsigned int n) -{ - if (n < 32) - return mips_gpr_names[n]; - if (n == 64) - return "hi"; - if (n == 65) - return "lo"; - return NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index efc41d0fbee9..d536964df43c 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,7 +32,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags) { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ - || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH + || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -40,7 +40,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int #endif switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ - && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH + && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 4f205a58db89..1f771b635789 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -80,7 +80,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ - && !defined(__loongarch__) + && !defined(__loongarch__) && !defined(__mips__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839300 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 0BE92D2F7DD for ; Thu, 17 Oct 2024 02:01:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=458YiwCEQu0xyWW32bw076GTqYPd++B/pRRG623ToYM=; b=JkRamx7OQ5zVt5rKFMQhE+h5ev mj6LKn2QUP1LB71Ikh7tRZW4Oai7sydwHLmFI1fB1GSIMwT6rgpTXz/4OnzgM98UuDdPNZKpSLr5t k7RgO90/orLdpwFzBHF2NMx2dXHvbN/X0fwCk9FBIlduNU/4o8Dg2nvsUF6DiYkLqiysxZ8sk2Nrh oeSGd1J0/jPdwzV9YwigKlRRJwmLk8fxVRkGESEgT6zj44XYzG+dXUYnGKWtCuqXjaPF1jFlosIyT vexGtODDz72x+BzMz5qz6KsHq3ASpDcWNVHfboWPWoPRRt3QCfG76FOQWJOM5dUDimRpN/9UY2Cb6 LuXIEzEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Fox-0000000DVLf-3tmL; Thu, 17 Oct 2024 02:00:59 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EL3-0000000DKMW-0P6C for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:02 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6e38562155bso7238687b3.1 for ; Wed, 16 Oct 2024 17:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124759; x=1729729559; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=458YiwCEQu0xyWW32bw076GTqYPd++B/pRRG623ToYM=; b=wF3ybmJ0JgGorPnm3OQs17s1rKhCZ1K0ooiZRkpkdYUfjIwVluXNUxDr7rhoxYFjIX Jt5OMfruyN293U64C3vZE/d9f6w4klSdsJmy12y9daKCfv04baCzmnFjPcPMGiuiaR0v /r//naEQJa3c2j9A5Vc0VYEmXQV9NGmvpMEqzfV8is287LOHXamMDlFDX8Amer3m80Og 9pkLtVHa/1xZXGUgcYIJbreAn2FWsB2dyryqp8s9tWkVkupc45baV/6zMOQmYWxF0742 CTIBy2MKJ4TXuwmB7M0EnEkQDOEuiRf1e4DrZR559YZl8bRRXbanh7Jc+cPwoGc+zCWq LbNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124759; x=1729729559; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=458YiwCEQu0xyWW32bw076GTqYPd++B/pRRG623ToYM=; b=TGBktxDZ0/yXokmtCxejWW88hL4Ya9l7sey9GsazUkJWHI8jZHMz9+3knsyWoalUT6 C6R7Z01UBusHb+UaNiHAHCI1ljP3zqy82ZMlx9iOcsZPduSDAW6BKljVUk2dlA7SU2TB 8utRII9uWT9YG9GW87EkXkhJ+1zc901w4r4V2aJdYxiKoLXnMd0nXGkYJb0Nv0mvYVmV 3MNslFpw51qnBdp8kYkVIhEHMdvlp+ZsfS1F3AdjifHcJZxLa+U/IsFGyH9oQEv70juD fV9kGiRUJSlwmLPxWcEawipoY2jrtDq2thgK+aLPfqaE2SkSVBYDRqfyGgnb8TVl0Hkq FJEQ== X-Forwarded-Encrypted: i=1; AJvYcCWnwFxIxuLw9VybiyFtzW7/CJhztjt+iFl8F2r98SG7Wdb+5XqCrslny8lrypR77fr9y3eNS6ka35u1gXQRJaI2@lists.infradead.org X-Gm-Message-State: AOJu0YwqPCQRWx5H3Cp/fMs9ZFBppZcyQzApmyBlmAYB+l+WUGWjgcOC 9rbuZf+2yRx2mIpossHuJMGRyLQLc6OsVB510nFtywnQppy5/G5p+LeGdM5nBw+H/xZJntQHv+9 p2A0Abw== X-Google-Smtp-Source: AGHT+IHe2nHx8WZSMOYKcxMW4gIJHHBFN2zTVNS46VHOfujhdM1R4tNVwqUCaJ+215uPJw6HHmJzRBUSoCC9 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:3345:b0:6e3:d670:f603 with SMTP id 00721157ae682-6e3d670fa35mr870367b3.3.1729124759496; Wed, 16 Oct 2024 17:25:59 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:13 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-14-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 13/20] perf dwarf-regs: Move powerpc dwarf-regs out of arch From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172601_151305_D7B29BF6 X-CRM114-Status: GOOD ( 25.83 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Move arch/powerpc/util/dwarf-regs.c to util/dwarf-regs-powerpc.c and compile in unconditionally. get_arch_regstr is redundant when EM_NONE is treated as EM_HOST so remove and update dwarf-regs.c conditions. Make get_powerpc_regs unconditionally available whwn libdw is. Signed-off-by: Ian Rogers --- tools/perf/arch/powerpc/util/Build | 1 - tools/perf/arch/powerpc/util/dwarf-regs.c | 141 ---------------------- tools/perf/util/Build | 1 + tools/perf/util/dwarf-regs-powerpc.c | 61 ++++++++++ tools/perf/util/dwarf-regs.c | 6 +- tools/perf/util/include/dwarf-regs.h | 9 +- 6 files changed, 70 insertions(+), 149 deletions(-) delete mode 100644 tools/perf/arch/powerpc/util/dwarf-regs.c create mode 100644 tools/perf/util/dwarf-regs-powerpc.c diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build index 3d979480a188..ed82715080f9 100644 --- a/tools/perf/arch/powerpc/util/Build +++ b/tools/perf/arch/powerpc/util/Build @@ -7,7 +7,6 @@ perf-util-y += sym-handling.o perf-util-y += evsel.o perf-util-y += event.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LIBDW) += skip-callchain-idx.o perf-util-$(CONFIG_LIBUNWIND) += unwind-libunwind.o diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/powerpc/util/dwarf-regs.c deleted file mode 100644 index 23846c59a522..000000000000 --- a/tools/perf/arch/powerpc/util/dwarf-regs.c +++ /dev/null @@ -1,141 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Ian Munsie, IBM Corporation. - */ - -#include -#include -#include -#include -#include -#include - -struct regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) \ - {.name = __stringify(%)__stringify(r), .dwarfnum = num} -#define GPR_DWARFNUM_NAME(num) \ - {.name = __stringify(%gpr##num), .dwarfnum = num} -#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} - -/* - * Reference: - * http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html - */ -static const struct regs_dwarfnum regdwarfnum_table[] = { - GPR_DWARFNUM_NAME(0), - GPR_DWARFNUM_NAME(1), - GPR_DWARFNUM_NAME(2), - GPR_DWARFNUM_NAME(3), - GPR_DWARFNUM_NAME(4), - GPR_DWARFNUM_NAME(5), - GPR_DWARFNUM_NAME(6), - GPR_DWARFNUM_NAME(7), - GPR_DWARFNUM_NAME(8), - GPR_DWARFNUM_NAME(9), - GPR_DWARFNUM_NAME(10), - GPR_DWARFNUM_NAME(11), - GPR_DWARFNUM_NAME(12), - GPR_DWARFNUM_NAME(13), - GPR_DWARFNUM_NAME(14), - GPR_DWARFNUM_NAME(15), - GPR_DWARFNUM_NAME(16), - GPR_DWARFNUM_NAME(17), - GPR_DWARFNUM_NAME(18), - GPR_DWARFNUM_NAME(19), - GPR_DWARFNUM_NAME(20), - GPR_DWARFNUM_NAME(21), - GPR_DWARFNUM_NAME(22), - GPR_DWARFNUM_NAME(23), - GPR_DWARFNUM_NAME(24), - GPR_DWARFNUM_NAME(25), - GPR_DWARFNUM_NAME(26), - GPR_DWARFNUM_NAME(27), - GPR_DWARFNUM_NAME(28), - GPR_DWARFNUM_NAME(29), - GPR_DWARFNUM_NAME(30), - GPR_DWARFNUM_NAME(31), - REG_DWARFNUM_NAME(msr, 66), - REG_DWARFNUM_NAME(ctr, 109), - REG_DWARFNUM_NAME(link, 108), - REG_DWARFNUM_NAME(xer, 101), - REG_DWARFNUM_NAME(dar, 119), - REG_DWARFNUM_NAME(dsisr, 118), - REG_DWARFNUM_END, -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is not - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct regs_dwarfnum *roff; - - for (roff = regdwarfnum_table; roff->name != NULL; roff++) - if (roff->dwarfnum == n) - return roff->name; - return NULL; -} - -#define PPC_OP(op) (((op) >> 26) & 0x3F) -#define PPC_RA(a) (((a) >> 16) & 0x1f) -#define PPC_RT(t) (((t) >> 21) & 0x1f) -#define PPC_RB(b) (((b) >> 11) & 0x1f) -#define PPC_D(D) ((D) & 0xfffe) -#define PPC_DS(DS) ((DS) & 0xfffc) -#define OP_LD 58 -#define OP_STD 62 - -static int get_source_reg(u32 raw_insn) -{ - return PPC_RA(raw_insn); -} - -static int get_target_reg(u32 raw_insn) -{ - return PPC_RT(raw_insn); -} - -static int get_offset_opcode(u32 raw_insn) -{ - int opcode = PPC_OP(raw_insn); - - /* DS- form */ - if ((opcode == OP_LD) || (opcode == OP_STD)) - return PPC_DS(raw_insn); - else - return PPC_D(raw_insn); -} - -/* - * Fills the required fields for op_loc depending on if it - * is a source or target. - * D form: ins RT,D(RA) -> src_reg1 = RA, offset = D, dst_reg1 = RT - * DS form: ins RT,DS(RA) -> src_reg1 = RA, offset = DS, dst_reg1 = RT - * X form: ins RT,RA,RB -> src_reg1 = RA, src_reg2 = RB, dst_reg1 = RT - */ -void get_powerpc_regs(u32 raw_insn, int is_source, - struct annotated_op_loc *op_loc) -{ - if (is_source) - op_loc->reg1 = get_source_reg(raw_insn); - else - op_loc->reg1 = get_target_reg(raw_insn); - - if (op_loc->multi_regs) - op_loc->reg2 = PPC_RB(raw_insn); - - /* TODO: Implement offset handling for X Form */ - if ((op_loc->mem_ref) && (PPC_OP(raw_insn) != 31)) - op_loc->offset = get_offset_opcode(raw_insn); -} diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 99ae4e2802b8..eeab8684ddcc 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -204,6 +204,7 @@ perf-util-$(CONFIG_LIBDW) += probe-finder.o perf-util-$(CONFIG_LIBDW) += dwarf-aux.o perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LIBDW) += dwarf-regs-csky.o +perf-util-$(CONFIG_LIBDW) += dwarf-regs-powerpc.o perf-util-$(CONFIG_LIBDW) += dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) += debuginfo.o perf-util-$(CONFIG_LIBDW) += annotate-data.o diff --git a/tools/perf/util/dwarf-regs-powerpc.c b/tools/perf/util/dwarf-regs-powerpc.c new file mode 100644 index 000000000000..caf77a234c78 --- /dev/null +++ b/tools/perf/util/dwarf-regs-powerpc.c @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Mapping of DWARF debug register numbers into register names. + * + * Copyright (C) 2010 Ian Munsie, IBM Corporation. + */ + +#include + +#define PPC_OP(op) (((op) >> 26) & 0x3F) +#define PPC_RA(a) (((a) >> 16) & 0x1f) +#define PPC_RT(t) (((t) >> 21) & 0x1f) +#define PPC_RB(b) (((b) >> 11) & 0x1f) +#define PPC_D(D) ((D) & 0xfffe) +#define PPC_DS(DS) ((DS) & 0xfffc) +#define OP_LD 58 +#define OP_STD 62 + +static int get_source_reg(u32 raw_insn) +{ + return PPC_RA(raw_insn); +} + +static int get_target_reg(u32 raw_insn) +{ + return PPC_RT(raw_insn); +} + +static int get_offset_opcode(u32 raw_insn) +{ + int opcode = PPC_OP(raw_insn); + + /* DS- form */ + if ((opcode == OP_LD) || (opcode == OP_STD)) + return PPC_DS(raw_insn); + else + return PPC_D(raw_insn); +} + +/* + * Fills the required fields for op_loc depending on if it + * is a source or target. + * D form: ins RT,D(RA) -> src_reg1 = RA, offset = D, dst_reg1 = RT + * DS form: ins RT,DS(RA) -> src_reg1 = RA, offset = DS, dst_reg1 = RT + * X form: ins RT,RA,RB -> src_reg1 = RA, src_reg2 = RB, dst_reg1 = RT + */ +void get_powerpc_regs(u32 raw_insn, int is_source, + struct annotated_op_loc *op_loc) +{ + if (is_source) + op_loc->reg1 = get_source_reg(raw_insn); + else + op_loc->reg1 = get_target_reg(raw_insn); + + if (op_loc->multi_regs) + op_loc->reg2 = PPC_RB(raw_insn); + + /* TODO: Implement offset handling for X Form */ + if ((op_loc->mem_ref) && (PPC_OP(raw_insn) != 31)) + op_loc->offset = get_offset_opcode(raw_insn); +} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index d536964df43c..3d98c2bf6035 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,7 +32,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags) { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ - || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS + || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS || EM_HOST == EM_PPC \ + || EM_HOST == EM_PPC64 if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -40,7 +41,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int #endif switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ - && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS + && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS && EM_HOST != EM_PPC \ + && EM_HOST != EM_PPC64 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 1f771b635789..1763280855ce 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -80,7 +80,8 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ - && !defined(__loongarch__) && !defined(__mips__) + && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc__) \ + && !defined(__powerpc64__) const char *get_arch_regstr(unsigned int n); #endif @@ -107,6 +108,8 @@ int get_arch_regnum(const char *name); */ int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int flags); +void get_powerpc_regs(u32 raw_insn, int is_source, struct annotated_op_loc *op_loc); + #else /* HAVE_LIBDW_SUPPORT */ static inline int get_dwarf_regnum(const char *name __maybe_unused, @@ -115,16 +118,12 @@ static inline int get_dwarf_regnum(const char *name __maybe_unused, { return -1; } -#endif -#if !defined(__powerpc__) || !defined(HAVE_LIBDW_SUPPORT) static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_source __maybe_unused, struct annotated_op_loc *op_loc __maybe_unused) { return; } -#else -void get_powerpc_regs(u32 raw_insn, int is_source, struct annotated_op_loc *op_loc); #endif #endif From patchwork Thu Oct 17 00:25:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839316 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 7A12FD2F7DE for ; Thu, 17 Oct 2024 02:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=f+6tiaKaV6HvKOoydGJA88FSVOYPAhxZOHcfM2Yk7U8=; b=nxoLOjZVzaluUTh9up0U5bXDzJ fZzYtzjJwwI7Rnc5YW4qdvvmAZystMyHkTcmW0Lu6Lui/DnCI6OcBrQVbhSRl3p4+TTftCqy7AQtn 4zHpt4auUf5NOzF1g3rxuztBJZxog2TbDYxThR8682c9axctWojsjWP16VWwcQ658b1KFhjVEbCxi zBURTBV5jsvu16UyO99I8e0Cu4fCrtWEh6f3unSrdCjF/nT2XHKzVrZpWjUhQ2Hzi2CunGma7W4Ex 26vX893DdDRuUHK1CXLvQ9wyoYIo0KIkEcbwdvZijkCHd8hPcaIbHW/tbFw6swd99mt5SWj7M974m itRxhowA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1G3R-0000000DWuY-0rXI; Thu, 17 Oct 2024 02:15:57 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EL6-0000000DKNi-2SZ0 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:05 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6e35199eb2bso8983877b3.3 for ; Wed, 16 Oct 2024 17:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124762; x=1729729562; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=f+6tiaKaV6HvKOoydGJA88FSVOYPAhxZOHcfM2Yk7U8=; b=Paybn0vJdtPVp1+DED9V21p9a3JO84ykGRuLXyh9NXHgft5/g8jjQcAHztgwB8FkNr IaTgTj9l4+Myp3dbYqa2Xabq9CfVnvjRstPrl62nJKlIoayPI+JNoAAjawMWkN/x4lug WHqHfKCcj4Wpe7gCt/99+Cb7iUt3BAtXsw2yV98PUy1ih35Meigz6ecQEzlQIZhpk33R xaveJdP5LONn9bX3PdBABHykffjyNgxbucILSX3EoIdvBQD+ecsFVm9v5Mdp8iTUbC79 XYDuZtD+mzXbCbbJ+vn6JPt2ySz23YxhLki5BQ9D6IeMpM9OuXVhTINgsfxMBc6JPc9g kCgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124762; x=1729729562; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=f+6tiaKaV6HvKOoydGJA88FSVOYPAhxZOHcfM2Yk7U8=; b=a8WSfXQ4AYakyw5EQ1ypbHrBzjoT8v1FZrtySAQLENYne4qYghB1qFCqSNLByHzsVs qIRpcdWsqlrdYFvzgJ9UjmXzQOfkWNpB0UhrYutXnaEoAFMLn4LDJjaSfrrjiRYKJUeu LzUGyfhnr0yZiMBeiZDK6Z8le6AEWuS+8tQPvHngRdPdoXSQhWamwCrDKzRY5QY7Acvm J65yQAX2EuYaRXPcXhoHnYstPmTY1niQYxacIaUl1qHrUJsdfra7OBzTtfqaObJjpSkg jfulkaB9BxJrbJunDGb35fObNd8Gb2jmfrF+gGf/iQT7o9qDo2ffXH+br8VL973Gyd8S Z3dQ== X-Forwarded-Encrypted: i=1; AJvYcCVsk697l8Vd0z4seXy5pkLD6PbAIigslWCJxjmPNQ7pNXiFaHgMDSGokCvCoD7he3M6LE5KtKuhgG1TlzI7yblF@lists.infradead.org X-Gm-Message-State: AOJu0Ywa/1SacZX6RoMdaKaZMtm8u9QIG5l8L2zAQG2ns/qKBXg32N+B rDzLW5yrfwE3zJfbuuFQMv6BBrTGpNIC/MJ9qy4IR64A/eyFIoPtN3VZ4511U0FcfVkfLvVMzzm DD2CnlA== X-Google-Smtp-Source: AGHT+IF8vR2ODszdvUkiRs2C6hBOma5C+iYC6PWCAbaWDyF1xQHgEj5TqToGlUQxetf5HbIY0PdC8v7iaIAq X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:870c:0:b0:e25:5cb1:77cd with SMTP id 3f1490d57ef6-e2978585305mr4689276.10.1729124761924; Wed, 16 Oct 2024 17:26:01 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:14 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-15-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 14/20] perf riscv: Remove dwarf-regs.c and add dwarf-regs-table.h From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172604_637084_283C924E X-CRM114-Status: GOOD ( 18.19 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case, and the register table is provided in a header file, the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for riscv in dwarf-regs.c. Signed-off-by: Ian Rogers Acked-by: Palmer Dabbelt --- .../dwarf-regs-table.h} | 32 ++++--------------- tools/perf/arch/riscv/util/Build | 1 - tools/perf/util/dwarf-regs.c | 7 ++-- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 12 insertions(+), 30 deletions(-) rename tools/perf/arch/riscv/{util/dwarf-regs.c => include/dwarf-regs-table.h} (56%) diff --git a/tools/perf/arch/riscv/util/dwarf-regs.c b/tools/perf/arch/riscv/include/dwarf-regs-table.h similarity index 56% rename from tools/perf/arch/riscv/util/dwarf-regs.c rename to tools/perf/arch/riscv/include/dwarf-regs-table.h index a9c4402ae57e..a45b63a6d5a8 100644 --- a/tools/perf/arch/riscv/util/dwarf-regs.c +++ b/tools/perf/arch/riscv/include/dwarf-regs-table.h @@ -1,23 +1,10 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. - * Mapping of DWARF debug register numbers into register names. - */ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifdef DEFINE_DWARF_REGSTR_TABLE +/* This is included in perf/util/dwarf-regs.c */ -#include -#include /* for EINVAL */ -#include /* for strcmp */ -#include +#define REG_DWARFNUM_NAME(reg, idx) [idx] = "%" #reg -struct regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name = r, .dwarfnum = num} -#define REG_DWARFNUM_END {.name = NULL, .dwarfnum = 0} - -struct regs_dwarfnum riscv_dwarf_regs_table[] = { +static const char * const riscv_regstr_tbl[] = { REG_DWARFNUM_NAME("%zero", 0), REG_DWARFNUM_NAME("%ra", 1), REG_DWARFNUM_NAME("%sp", 2), @@ -50,13 +37,6 @@ struct regs_dwarfnum riscv_dwarf_regs_table[] = { REG_DWARFNUM_NAME("%t4", 29), REG_DWARFNUM_NAME("%t5", 30), REG_DWARFNUM_NAME("%t6", 31), - REG_DWARFNUM_END, }; -#define RISCV_MAX_REGS ((sizeof(riscv_dwarf_regs_table) / \ - sizeof(riscv_dwarf_regs_table[0])) - 1) - -const char *get_arch_regstr(unsigned int n) -{ - return (n < RISCV_MAX_REGS) ? riscv_dwarf_regs_table[n].name : NULL; -} +#endif diff --git a/tools/perf/arch/riscv/util/Build b/tools/perf/arch/riscv/util/Build index 8f93091b8345..58a672246024 100644 --- a/tools/perf/arch/riscv/util/Build +++ b/tools/perf/arch/riscv/util/Build @@ -2,5 +2,4 @@ perf-util-y += perf_regs.o perf-util-y += header.o perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 3d98c2bf6035..2c6b197556dd 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -20,6 +20,7 @@ #include "../arch/arm64/include/dwarf-regs-table.h" #include "../arch/sh/include/dwarf-regs-table.h" #include "../arch/powerpc/include/dwarf-regs-table.h" +#include "../arch/riscv/include/dwarf-regs-table.h" #include "../arch/s390/include/dwarf-regs-table.h" #include "../arch/sparc/include/dwarf-regs-table.h" #include "../arch/xtensa/include/dwarf-regs-table.h" @@ -33,7 +34,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS || EM_HOST == EM_PPC \ - || EM_HOST == EM_PPC64 + || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -42,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS && EM_HOST != EM_PPC \ - && EM_HOST != EM_PPC64 + && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif @@ -63,6 +64,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int case EM_PPC: case EM_PPC64: return __get_dwarf_regstr(powerpc_regstr_tbl, n); + case EM_RISCV: + return __get_dwarf_regstr(riscv_regstr_tbl, n); case EM_SPARC: case EM_SPARCV9: return __get_dwarf_regstr(sparc_regstr_tbl, n); diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 1763280855ce..35f4f33205da 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc__) \ - && !defined(__powerpc64__) + && !defined(__powerpc64__) && !defined(__riscv__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839181 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 23A5DD2F7D7 for ; Thu, 17 Oct 2024 01:02:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+vS3pAQ+haKP/8iv+6aAP7RJEQP9tkb6yzoJLAeVBwY=; b=M3lou/FvgVVAaH7lANOe7Q95aX AVqiLuO+Ya2Ey+aHqdj8gHP+75R+4UPqYseUNuQubMClCUVTz75tm6AQa/FZeZ4tOyvqdtTygi1LS EGkIYuFjJ4G7zy5nvMzJKujl0OC133e5YAmpPJq4VkrZSjfUPbdx2wA0uodnM/d7byxpnEGoEI0kQ /gYKKPMdhsMI48LayopnVLg8/Ko0UtEzojxq7K+KrlVz4EAfAutPE5K/VVzUgDgTs0/Q163v91A2c xvUxSCfAKq8XoE3mgvyca6uAm5RAI/VCDbEPNgTcVnsbirLuln4Xl+F3TJlBlV5QUyO8I9s+uvNmh aauvYBTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1EuI-0000000DPog-2GOW; Thu, 17 Oct 2024 01:02:26 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1EL8-0000000DKOd-1qOG for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:07 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6e32b43e053so7804177b3.1 for ; Wed, 16 Oct 2024 17:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124765; x=1729729565; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=+vS3pAQ+haKP/8iv+6aAP7RJEQP9tkb6yzoJLAeVBwY=; b=JlLUJdNR6Gj7mo+IzAgXwHyclcDChaKIEuERfSvb85iLLEMWC7w95BKJzB+3o51mnC FXHpzr7FUQ3os8403lYKvGMjbOCfalpfzlL+y7uX/yKN7Fq/MQ8rgS1eSeCFpP5Q+zvt JzoJVXRFuJYdf/uWN2PlGAjIZjPt0wTqUAxCM+G0uMzkpDrc97Mk8ZfTFPMOFnsM6X2l JaypoQ7DEzqKYpgoWPWW+qmDzwdXfVpuv77TZhPc6/NRplqCTZeRelbCSlPm7ww61v/b Xa01olxLF1G93Gc3Ly76eMUzZeZWdIalWlCKPXjx1mdEIPG9KV7X7AVk6QQIbVpEOz5K 4QEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124765; x=1729729565; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+vS3pAQ+haKP/8iv+6aAP7RJEQP9tkb6yzoJLAeVBwY=; b=fpQUwCkJmbbs7RsPZ3mDAV2vBx3ybktry4me0Y+CcxmJaoGVxsBqZJ2QZLDw4hPHI7 OSaIyAbb9gw20bH8prK/DHvZvXKtaJ4HPIzTp/HScU/9Xq1NA1r7jRFAcbdZ2Dq86P4E EXKsf3HIwG4EPNxVTKstarBF00ZLJjjIGntKhP1G70X1e6X9xJe1QIYGH0ScxJaQoGef 2M7AtHo2gsGYXg5kJSeBv+GlBMlgtXtZG3WBA8XD3l18HHu5CMgZ5g7OkZWmOMSeiNOH 7VhoqjjdEmJ+whvd3q3C5CkyHZ1HRgFfsfX9tXhC9J+r7XnncU1EOgQI0yrLLKzOSZns 6qUw== X-Forwarded-Encrypted: i=1; AJvYcCV8xanMD/4x7fvggiUGXFhgbNZ1jWuclWQPgOiCEecJ/hHpu7SUMjrmh2IkalLIR3IWiuKIcp0UNUj299JMm1Ho@lists.infradead.org X-Gm-Message-State: AOJu0YxGykX7zIiRWlJMzfpGOiNrFKyXFlX2dp5wwAH0FAmw2z78rcPh m3IwXNCNjgLkYeS09F9IHy24T4pTGBDqh9FgiquZs9kNo8JkVuFnm8oYwyE+EaSgemfIFXrC4vz oL8+8bg== X-Google-Smtp-Source: AGHT+IHww5hKkYtrtEd7xFxuwiqgL1g9EP1jrDvOSFsM0YJ3aBoaypiL1q7z5gT/re1gw8cKAYiVLMh2TMTK X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:690c:9a84:b0:6e3:19d7:382a with SMTP id 00721157ae682-6e3d3f7f52fmr1338867b3.1.1729124764951; Wed, 16 Oct 2024 17:26:04 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:15 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-16-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 15/20] perf s390: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172606_503670_406F7B43 X-CRM114-Status: GOOD ( 17.98 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. Tidy up the EM_NONE cases for s390 in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/s390/util/Build | 1 - tools/perf/arch/s390/util/dwarf-regs.c | 16 ---------------- tools/perf/util/dwarf-regs.c | 4 ++-- tools/perf/util/include/dwarf-regs.h | 2 +- 4 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 tools/perf/arch/s390/util/dwarf-regs.c diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Build index 787410f99bb3..736c0ad09194 100644 --- a/tools/perf/arch/s390/util/Build +++ b/tools/perf/arch/s390/util/Build @@ -2,7 +2,6 @@ perf-util-y += header.o perf-util-$(CONFIG_LIBTRACEEVENT) += kvm-stat.o perf-util-y += perf_regs.o -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o perf-util-y += machine.o diff --git a/tools/perf/arch/s390/util/dwarf-regs.c b/tools/perf/arch/s390/util/dwarf-regs.c deleted file mode 100644 index 5bcf3192623a..000000000000 --- a/tools/perf/arch/s390/util/dwarf-regs.c +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright IBM Corp. 2010, 2017 - * Author(s): Hendrik Brueckner - * - */ - -#include -#include "dwarf-regs-table.h" - -const char *get_arch_regstr(unsigned int n) -{ - return (n >= ARRAY_SIZE(s390_dwarf_regs)) ? NULL : s390_dwarf_regs[n]; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 2c6b197556dd..1649fc07f4f5 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -34,7 +34,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS || EM_HOST == EM_PPC \ - || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV + || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV || EM_HOST == EM_S390 if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -43,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS && EM_HOST != EM_PPC \ - && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV + && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV && EM_HOST != EM_S390 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 35f4f33205da..25f3d6b90f10 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc__) \ - && !defined(__powerpc64__) && !defined(__riscv__) + && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839182 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 D5D8DD2F7D8 for ; Thu, 17 Oct 2024 01:04:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IfgOrXuzIi5D9S6tBKQjs6ZaYP759vz/COjt5onTx3c=; b=h2xeljlkmEyvtnO0kOQLAl99py 0amOGpPnZ4afsLkmCePu2H7nJCyA7xKJ05aaDFaOTWfJsxO4KRF1M0EqzHqAW7YICqmAM+ZbRBQQQ VbAAHUBXPLpLygDogBSABE/vQAgOY5Gip/EBsd9Zf1KKd579Y0NW94yioo9fnvnFUWLtjNvNnWaUB bqujHDq/AXdybDc7Zr5v66A1OiS4AmeeqwlFcY2NwvSCnWDPpBLRsr0fgFZCuVqDiL1OhXobP1UxB GDl4YFx1dxqjv5hcC43JdVHRIBgLizS+YkfzOCDTQMBlJ4CIzX/3TtN6nGvf+JSQRVxcC6zphDqiT zuTVi5Ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Evg-0000000DPzJ-3yVN; Thu, 17 Oct 2024 01:03:53 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1ELA-0000000DKPc-3Lpm for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:10 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e2b9f71917bso195747276.0 for ; Wed, 16 Oct 2024 17:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124767; x=1729729567; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=IfgOrXuzIi5D9S6tBKQjs6ZaYP759vz/COjt5onTx3c=; b=A3EpC0oz9BH59AK90x87xE2QEQTS8FjhYp+UQ8cp84PWuCLmtV6JuDpI7v4xyfscR/ EnYJr/K4UkaG/sO5Z40UKPyGsJXKK7rCsv+bS06vFKJSSjoBLUUvXehBVjOMuxI9/i8s VCGnVGJ3fwpOoa3m4yAJzCObAckHyCgoVrLcOkY5UptZe09Q+0RyolARD3Z9FJxzI5gg 4pLZmeLo6EGr9waSZVTNZB1SwfRXcBKUQhAyFFWL3dFtwOJuHKMmHrI9gqbLOAKctKEY qxir/A1pQgsSTt/GXa/yZJiWcB0gqZtoEWIrauUYCFPLoq4cj8kDVlumWpuFyKoY9bVZ zS4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124767; x=1729729567; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IfgOrXuzIi5D9S6tBKQjs6ZaYP759vz/COjt5onTx3c=; b=Xa9mUDki+LTSN62lsDOeD044XRO3E/ZU2UXVvXJnGmNJH42uehbvNyy8QqoRKnoPhK piE5Vr9NhWEtiMiomSs7tCBckzEOfsuocCh7dOd846oZy5p56VyUVzaJw+llFVXl6thJ UaGs9CSeTIoodN6+9ArkzuL0iDrSSLmwMtnHbBsC4tfiz21+zx1Y15zMMGvGLnAAVbEq jiyV8xvs3VYXvI/BetExpq4ZMxKPVR83AuWSb5PdUvo3MBOagQJJMkQ/Xta5gt8SECWe 1MdpnMnauYWnRaA26QM7sF6CB8RbYN0mpJ5mDDDZLJzI1kAz5RTmEUT58ujH+xffNxFg Wo8w== X-Forwarded-Encrypted: i=1; AJvYcCVNndd5mWih07jIS9GAVU/lRYpIj69QHE2x6rSgh1bOB84s5kkF9o5cwu8b1NJgJLNzzMaMLNMs6tMXDmUlDr3j@lists.infradead.org X-Gm-Message-State: AOJu0YzCKzRbRVfKqP98wgahQIbf95Jqb2FR48JvbJrCbWxGTyl1C+DS vsxNK0pGLxu7wnot2UHc+6Zn9mMClxTSzypG2H7oJisYFb4+5Vi8V22Y3RFPbhvkBVx1muOJmzB vFWR1Ug== X-Google-Smtp-Source: AGHT+IFt+bqmIASGNbZ3TFisN0iIRghMq2JpjsLpeMTXAlMa2KnLBBPyKnoUzSRzo42bXC3TE8xo0dk3pEWH X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:664c:0:b0:e29:7454:e773 with SMTP id 3f1490d57ef6-e2b9d02921cmr1392276.5.1729124767112; Wed, 16 Oct 2024 17:26:07 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:16 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-17-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 16/20] perf sh: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172608_869409_FD7CB75C X-CRM114-Status: GOOD ( 18.73 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. As this is the only file in the arch/sh/util clean up Build files. Tidy up the EM_NONE cases for sh in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/sh/Build | 1 - tools/perf/arch/sh/util/Build | 1 - tools/perf/arch/sh/util/dwarf-regs.c | 41 ---------------------------- tools/perf/util/dwarf-regs.c | 4 +-- tools/perf/util/include/dwarf-regs.h | 2 +- 5 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 tools/perf/arch/sh/Build delete mode 100644 tools/perf/arch/sh/util/Build delete mode 100644 tools/perf/arch/sh/util/dwarf-regs.c diff --git a/tools/perf/arch/sh/Build b/tools/perf/arch/sh/Build deleted file mode 100644 index e63eabc2c8f4..000000000000 --- a/tools/perf/arch/sh/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-y += util/ diff --git a/tools/perf/arch/sh/util/Build b/tools/perf/arch/sh/util/Build deleted file mode 100644 index 2337a0b710a2..000000000000 --- a/tools/perf/arch/sh/util/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o diff --git a/tools/perf/arch/sh/util/dwarf-regs.c b/tools/perf/arch/sh/util/dwarf-regs.c deleted file mode 100644 index 4b17fc86c73b..000000000000 --- a/tools/perf/arch/sh/util/dwarf-regs.c +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 Matt Fleming - */ - -#include -#include - -/* - * Generic dwarf analysis helpers - */ - -#define SH_MAX_REGS 18 -const char *sh_regs_table[SH_MAX_REGS] = { - "r0", - "r1", - "r2", - "r3", - "r4", - "r5", - "r6", - "r7", - "r8", - "r9", - "r10", - "r11", - "r12", - "r13", - "r14", - "r15", - "pc", - "pr", -}; - -/* Return architecture dependent register string (for kprobe-tracer) */ -const char *get_arch_regstr(unsigned int n) -{ - return (n < SH_MAX_REGS) ? sh_regs_table[n] : NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 1649fc07f4f5..944ff4ef0290 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -34,7 +34,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS || EM_HOST == EM_PPC \ - || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV || EM_HOST == EM_S390 + || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV || EM_HOST == EM_S390 || EM_HOST == EM_SH if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -43,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS && EM_HOST != EM_PPC \ - && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV && EM_HOST != EM_S390 + && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV && EM_HOST != EM_S390 && EM_HOST != EM_SH case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 25f3d6b90f10..2b212ed70a15 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,7 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc__) \ - && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x__) + && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x__) && !defined(__sh__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839319 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 DCE6DD2F7DA for ; Thu, 17 Oct 2024 02:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oW9Ciltxw29Qn009jBViVw/a9LBQmaz3mh3OQFZm1hk=; b=R/W4Wa/77anYnjDRzuouu/NPWV ZwswAk8IME9o3GVTWKENEV3deAlTfSlywpnGY00ZrC89d7hTqu48a2hyZd1uT+pklOM2vgcMmGODQ yHE1tE5cV4UC4+rCxzKqXtaGLISqZJOaDX4MIXbcZNJE9dh2RopvduBsTHWie7uSCnOf2dPlDb0K9 iueLW2KfQ/6T4lkMqS6pfnW7RSdT9GTsSMHvF3tXs6nMxLxKRR4DiKbLiSOIg77/FSAlqITktZoFV Hs4ze4EMtpyIRm1GwxIlhQKAM38bpuBoI4LCHXj4F2hIGXK684xC52TGcLeYXZPhYr6J9LjQ5Qky1 OFZz7sYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1G3S-0000000DWvD-1rlZ; Thu, 17 Oct 2024 02:15:58 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1ELE-0000000DKQv-0Ma1 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:13 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-6e3204db795so7268887b3.2 for ; Wed, 16 Oct 2024 17:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124770; x=1729729570; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=oW9Ciltxw29Qn009jBViVw/a9LBQmaz3mh3OQFZm1hk=; b=0fHQxjbt9sd7YO7opQoxiC4wFGxA7tRdSEkh/9V/qT/c5Ez4sxk5P2rOZ4QesQMKEJ +coXtTdqGbYXNxjD+b3wmqr0JSC85Atl2k1bM3oU7enw1JF8qxmCWrxuiTP+5cdzafPB ep6PTilja1y6JpLZgXGMNTeppWIMAXunBC1Rs8A+V4ENTgOenQ9/h8ZwfmdO57KqOZCB R0xmL1tYBG1w8DMkinkNPRzBJWJ8B1KhyEyEZL4CNo/zCeruHg8u0YmjgqHE03rL90pe n/rA1JE82LQ5PkI+OK5N6P9pqZvSMTj+8LZMsYOKJq8/G9UR/YoE+j1Ovm5MaUgQawYp 2awA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124770; x=1729729570; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oW9Ciltxw29Qn009jBViVw/a9LBQmaz3mh3OQFZm1hk=; b=gTXf+a7k2s69MonSwdQCzWSoxh0CNZiJ+a5beCOcIcMzMUZmVlpFZqCqQLPV3uWGEA qyQxjFRGvFjlX10JFINyTywQeQTb642EFmaoUtQ3KDpG6aTficAx2HNLrEqdJngigPnu MOX+xv3qIuLmog428LwlAfbQxUZq2P2nv1ZmQDG8h7dFvEz0G7SmY6IbJTDPEccSM/Eh MQsbpI/FCLv1UWAFb+YkFmvLZyNz9m/LJlVu3TXim1xb4/tHXGbclrI7YSYGNM6hQLyU L9/1crelM5WldrczSnC5oPcyaZbtJJ1QnfsUX5Wc41WqGWskPLp+iSMR4qOYNIsAYS5p PCqw== X-Forwarded-Encrypted: i=1; AJvYcCVhP7HKbaWWaUxeRnwuKnWQLOW9noKWhphKNFIQB+Kuby/5NALN01lIQYrxn0faP0dLa/Zkt/2soam03m7cUwYJ@lists.infradead.org X-Gm-Message-State: AOJu0YwyM6kh9NJhZZ7+Ibczrb+EpPEfb87Sv/QiV8QRrYbTfSVTnr+H xK6zQdbQiVyM+CRGTQk1IOH7FxDUtXPbIegV1iFftzW4vMI2iM95xAd+NdbUw+is+D+Yp6EHOgV zlx5EHg== X-Google-Smtp-Source: AGHT+IGmO4W0BoMjp2vNweM4XGVSqpJs6KmKQXMJOVyvfkUJl62y1U0AKaZtgLbMJwRejRGMM6dtDDGo4NIo X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a5b:60e:0:b0:e28:e97f:5394 with SMTP id 3f1490d57ef6-e29783006ccmr3235276.4.1729124769707; Wed, 16 Oct 2024 17:26:09 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:17 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-18-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 17/20] perf sparc: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172612_160615_F9E6A156 X-CRM114-Status: GOOD ( 20.80 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. As this is the only file in the arch/sparc/util clean up Build files. Tidy up the EM_NONE cases for sparc in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/sparc/Build | 1 - tools/perf/arch/sparc/util/Build | 1 - tools/perf/arch/sparc/util/dwarf-regs.c | 39 ------------------------- tools/perf/util/dwarf-regs.c | 6 ++-- tools/perf/util/include/dwarf-regs.h | 3 +- 5 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 tools/perf/arch/sparc/Build delete mode 100644 tools/perf/arch/sparc/util/Build delete mode 100644 tools/perf/arch/sparc/util/dwarf-regs.c diff --git a/tools/perf/arch/sparc/Build b/tools/perf/arch/sparc/Build deleted file mode 100644 index e63eabc2c8f4..000000000000 --- a/tools/perf/arch/sparc/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-y += util/ diff --git a/tools/perf/arch/sparc/util/Build b/tools/perf/arch/sparc/util/Build deleted file mode 100644 index 2337a0b710a2..000000000000 --- a/tools/perf/arch/sparc/util/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c b/tools/perf/arch/sparc/util/dwarf-regs.c deleted file mode 100644 index 1282cb2dc7bd..000000000000 --- a/tools/perf/arch/sparc/util/dwarf-regs.c +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (C) 2010 David S. Miller - */ - -#include -#include - -#define SPARC_MAX_REGS 96 - -const char *sparc_regs_table[SPARC_MAX_REGS] = { - "%g0", "%g1", "%g2", "%g3", "%g4", "%g5", "%g6", "%g7", - "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%sp", "%o7", - "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", - "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%fp", "%i7", - "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", - "%f8", "%f9", "%f10", "%f11", "%f12", "%f13", "%f14", "%f15", - "%f16", "%f17", "%f18", "%f19", "%f20", "%f21", "%f22", "%f23", - "%f24", "%f25", "%f26", "%f27", "%f28", "%f29", "%f30", "%f31", - "%f32", "%f33", "%f34", "%f35", "%f36", "%f37", "%f38", "%f39", - "%f40", "%f41", "%f42", "%f43", "%f44", "%f45", "%f46", "%f47", - "%f48", "%f49", "%f50", "%f51", "%f52", "%f53", "%f54", "%f55", - "%f56", "%f57", "%f58", "%f59", "%f60", "%f61", "%f62", "%f63", -}; - -/** - * get_arch_regstr() - lookup register name from it's DWARF register number - * @n: the DWARF register number - * - * get_arch_regstr() returns the name of the register in struct - * regdwarfnum_table from it's DWARF register number. If the register is not - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - return (n < SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 944ff4ef0290..a0bcc2529cb0 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -34,7 +34,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int { #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS || EM_HOST == EM_PPC \ - || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV || EM_HOST == EM_S390 || EM_HOST == EM_SH + || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV || EM_HOST == EM_S390 || EM_HOST == EM_SH \ + || EM_HOST == EM_SPARC || EM_HOST == EM_SPARCV9 if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -43,7 +44,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int switch (machine) { #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS && EM_HOST != EM_PPC \ - && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV && EM_HOST != EM_S390 && EM_HOST != EM_SH + && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV && EM_HOST != EM_S390 && EM_HOST != EM_SH \ + && EM_HOST != EM_SPARC && EM_HOST != EM_SPARCV9 case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 2b212ed70a15..b2cf7d9e4785 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -81,7 +81,8 @@ #ifdef HAVE_LIBDW_SUPPORT #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc__) \ - && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x__) && !defined(__sh__) + && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x__) && !defined(__sh__) \ + && !defined(__sparc64__) && !defined(__sparc__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839183 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 28A8BD2F7D8 for ; Thu, 17 Oct 2024 01:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uq9AxXLwl+md7pGfplbuMGPRmw11SaZaUSrHTUrrfs0=; b=QMWQ+fzSlQ0xnPfhuMx+djl6rR fllemsDU86YFZC9yg3meJWMeWuOGhwDsauSVXEfHpppESVjQx8GCobNXF5bsLYXXsCIrWwcYyUUVP B5W6tsYvzZ/Hfh5EJZJ2y2rm5A0aof2P8r6QqS4BZ8dFQhWfK41UadlOcCilvMZ+JhDCBno3d+YR+ i6ggtWdJvagjLFXLviSDDppzGB011biNGWFp1HlElEevXXgsp0wIMrx8lqxSOvvGRRbowsRDKsJZZ g8Pup+NMc+GX5tbGS7aOK+bogLVZwYinW0XRxvTg5B4FdiSinhfKGg0CZTIJAVn3DYimTO0icr+sR krxewyMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1EyT-0000000DQBv-11tA; Thu, 17 Oct 2024 01:06:45 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1ELK-0000000DKTb-0HQb for linux-arm-kernel@bombadil.infradead.org; Thu, 17 Oct 2024 00:26:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uq9AxXLwl+md7pGfplbuMGPRmw11SaZaUSrHTUrrfs0=; b=m09i8OCyaW8dHmw8FNS9G2R92Y rKSk7WMym9MxmYGJvnEgJuoQMz4Wq47MIpldNdbCM8AOSDIfeu4MYKnKuhEJ5fztX1PhBQ9hpmEED LsQBTj4jUzWB4rGfL5MzUH1dhr61H+qMT75Zv05WPmRNVxav/G7XJMg25ovOb0umtFMUoSJa6138y Pz5b7qZ3ecULzImWnOuyLxgEWbKNGL14gg4K8sYd+LUtxiouqF1cogMu+OZrW1exW6J/kje42gXPV MYlwpuu2OLxUl2zfLo19PmcLUNXyWlc2MUq7cGxAokdP8vd2FM9LbCjs/q77wSDpJySF5c4uXxI9V ssPJR4XQ==; Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1ELG-00000006yLn-1kJ5 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:16 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e0b8fa94718so589025276.0 for ; Wed, 16 Oct 2024 17:26:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124773; x=1729729573; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=uq9AxXLwl+md7pGfplbuMGPRmw11SaZaUSrHTUrrfs0=; b=hZTPf3wjZo5gv0SwMD1K7wwNrMmvax9ObdMPWMxgIBKZ8s+mfmi+LGYIks2dGnxPEF PnUsflblAob9ceohQFH1aAH4EI9ZU/UpFUfW6O2MQHAMcFjsIQodWV2MYOSJF+hCgtGY D8TsfT9GhThm5NscGnel2bD3+M1ztgTuPLHnxmtslq4ARQhMf37wQa+H3af6DI2hLNpj cmwTJwT1Nqqorpm8cRlxdGO0IO6jlMnYw/7b5nstqKuho9f7dPg4FbjR6oo39rUG4eqp gzWdiupdf9WroQ8ufq8m8IrrGbokSoUqHAJt9roFgx9t8+QS8PNXtbR05sJpqjx9QIul SeeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124773; x=1729729573; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uq9AxXLwl+md7pGfplbuMGPRmw11SaZaUSrHTUrrfs0=; b=Rv+RDs4I0HPSiiNgXZFcf3FMhcZlUPsj8o1vDGjpY7zbuMPuafaiE5f3fujY5FemLQ Ms9hW4uSakRnRN8QHvRzpos0QAXGhGB/maQ9lcNggOxLHvUwlU2kTt9ZHhd1BuXJsiHH gjAczUabD8WNXB8aFnq35cvWteEv+HfHIh17JmaOj88GDNoPgI6ZXHm6IZN+jkk1TrGr hOCovNHnWdvdzmxmVHZG01LrwWX14D/lOGIRyoY7xJxkdEmPYATgX5wvbfUyXlVYZBOo V0yQEPFl7PYL2tpSe2/UNRXaHEtITHbI0F7gFRw3OUTeKRMVvqiTgpievtXAA0ShIflR pGhg== X-Forwarded-Encrypted: i=1; AJvYcCWal0WM0ODwV3pUXEk80kboDs+gresTz8XjoYAsyYVdM4pC0Bsm811lvtNXGgLss69zj9C0w3K1/RIIFkg5DPHv@lists.infradead.org X-Gm-Message-State: AOJu0YwJiJul3qDf/oNdEy1Kxafnhz4acEwcWJimVnPpuJdrnIYFOYZP YuNsCbuarxQh2psVcP+AVD0sg0xwZlUyRLBocCytsNwM18N5mZyvNjazltQW/9XJTQaE+LWLlMO ySMSSwQ== X-Google-Smtp-Source: AGHT+IFblE5b3blF81m60FrHwxXihWa7btaVQayshFuqPR503LpiCQwiOp0I0Sdca5Yyel3RIIDwjSVp3STP X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:7e04:0:b0:e25:fcb:3205 with SMTP id 3f1490d57ef6-e29785695e6mr5028276.8.1729124772530; Wed, 16 Oct 2024 17:26:12 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:18 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-19-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 18/20] perf xtensa: Remove dwarf-regs.c From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241017_012615_174022_26299189 X-CRM114-Status: GOOD ( 18.84 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The file just provides the function get_arch_regstr, however, if in the only caller get_dwarf_regstr EM_HOST is used for the EM_NONE case the function can never be called. So remove as dead code. As this is the only file in the arch/xtensa/util clean up Build files. Tidy up the EM_NONE cases for xtensa in dwarf-regs.c. Signed-off-by: Ian Rogers --- tools/perf/arch/xtensa/Build | 1 - tools/perf/arch/xtensa/util/Build | 1 - tools/perf/arch/xtensa/util/dwarf-regs.c | 21 --------------------- tools/perf/util/dwarf-regs.c | 4 ++-- tools/perf/util/include/dwarf-regs.h | 2 +- 5 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 tools/perf/arch/xtensa/Build delete mode 100644 tools/perf/arch/xtensa/util/Build delete mode 100644 tools/perf/arch/xtensa/util/dwarf-regs.c diff --git a/tools/perf/arch/xtensa/Build b/tools/perf/arch/xtensa/Build deleted file mode 100644 index e63eabc2c8f4..000000000000 --- a/tools/perf/arch/xtensa/Build +++ /dev/null @@ -1 +0,0 @@ -perf-util-y += util/ diff --git a/tools/perf/arch/xtensa/util/Build b/tools/perf/arch/xtensa/util/Build deleted file mode 100644 index 2d1a48696ad9..000000000000 --- a/tools/perf/arch/xtensa/util/Build +++ /dev/null @@ -1 +0,0 @@ -perf-$(CONFIG_LIBDW) += dwarf-regs.o diff --git a/tools/perf/arch/xtensa/util/dwarf-regs.c b/tools/perf/arch/xtensa/util/dwarf-regs.c deleted file mode 100644 index 12f5457300f5..000000000000 --- a/tools/perf/arch/xtensa/util/dwarf-regs.c +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * Mapping of DWARF debug register numbers into register names. - * - * Copyright (c) 2015 Cadence Design Systems Inc. - */ - -#include -#include - -#define XTENSA_MAX_REGS 16 - -const char *xtensa_regs_table[XTENSA_MAX_REGS] = { - "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", - "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15", -}; - -const char *get_arch_regstr(unsigned int n) -{ - return n < XTENSA_MAX_REGS ? xtensa_regs_table[n] : NULL; -} diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index a0bcc2529cb0..05fff75a8f59 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -35,7 +35,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int #if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS || EM_HOST == EM_PPC \ || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV || EM_HOST == EM_S390 || EM_HOST == EM_SH \ - || EM_HOST == EM_SPARC || EM_HOST == EM_SPARCV9 + || EM_HOST == EM_SPARC || EM_HOST == EM_SPARCV9 || EM_HOST == EM_XTENSA if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; @@ -45,7 +45,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int #if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS && EM_HOST != EM_PPC \ && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV && EM_HOST != EM_S390 && EM_HOST != EM_SH \ - && EM_HOST != EM_SPARC && EM_HOST != EM_SPARCV9 + && EM_HOST != EM_SPARC && EM_HOST != EM_SPARCV9 && EM_HOST != EM_XTENSA case EM_NONE: /* Generic arch - use host arch */ return get_arch_regstr(n); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index b2cf7d9e4785..9dfc9abfdddd 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -82,7 +82,7 @@ #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc__) \ && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x__) && !defined(__sh__) \ - && !defined(__sparc64__) && !defined(__sparc__) + && !defined(__sparc64__) && !defined(__sparc__) && !defined(__xtensa__) const char *get_arch_regstr(unsigned int n); #endif From patchwork Thu Oct 17 00:25:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839317 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 8A302D2F7E0 for ; Thu, 17 Oct 2024 02:16:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KNbBqi1saNqYXEAAo8guTprpDL0iavWB2aVE9Nn4lPM=; b=IOcIVwUJ6AeizIFkZnYOINV1Se w33DW1z5oZOdwm7B/3vxC7RBMAqw8/e5xKyfTs2SxR21Q5/VG/rPYaj71mqnpjVF45hIR4wmV25TY hWB3caa9bP0jiLAiMskNBhGsAud1JzNI1IDg5W0LtORx+n296t5tLPXQ8IS3QN2Ad1jlrrdb9xNoT KuQVJHJ7H5EiR0GFVhBc/sBFs0BF86xJnJPOVkadrc03CfgOCa5Qwzptji+xYiAwBwM6bIvEfhvAV dY3YiBi891JddNCOGLZrZmUlBgPGYG+gTS/oEnCUTinHAM21KmFK0Il/RFWpwZn9ewU5J8qSpYTfo cPCd+Qlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1G3V-0000000DWxg-0Ccl; Thu, 17 Oct 2024 02:16:01 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1ELI-0000000DKSb-2vUy for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:19 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e290947f6f8so692231276.2 for ; Wed, 16 Oct 2024 17:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124775; x=1729729575; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=KNbBqi1saNqYXEAAo8guTprpDL0iavWB2aVE9Nn4lPM=; b=XJF9gVL1tAwnEK6e9Uo6LYeKEre/NgYh+AT1w2rcazGbLFSMHJ6HdPFpb6+05p1bWk XCknr16X+yhaKID0peTwMwnZIBDIfoKPmWcIR7Ea9Tez3O3f4gJzsnQBaHGTOlpo7PZ4 xlM6ihGRLOCII2x6J8oOuCGBRT4IM0ph11TH4aJeETTS1ECIUQMEU7+ZpY/jy4wjIvCN zxD45sBFaoJx7Rtm8Rrv0VzMDlCUPEgnRAXjHRiw0oDctb6NJp/pQvtLuf6KBLcHoQjg blRQBiEj6PQhk1O8hd7hv95jAhMqQEm+JNxW9MNSydVIPsG+PzjMZYW1yz/sWROxAyDE U5lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124775; x=1729729575; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KNbBqi1saNqYXEAAo8guTprpDL0iavWB2aVE9Nn4lPM=; b=bo62LWYsJbSmo/MpS9H+rsW9y5+dS6G9Q1jqYOiA+iHQknizqa26sFy23+AI5LxeOi OGTO9t/5JFapheEUfhM/9Wj3nXlIHadNik6xIMDA37CIK9acrTQAk29sD1U8gPQbW4yu APglqU6On9P5sQZyjMh6mOMDzQB1bg4SEfzfFo5VqSO/IjQjxwdp83fNkYuLv6ZaP2i7 zIIDqB16qhicgfIWrB4uTJ5geIO3/9q2qzQ06m7cgWrVA9xcTCWD5d1HCOhMkyBmK6ha +o9DgUJRmWdziqem+fx/yoQidtkdCHbQjxZ4/Pf/rDU+l6xC8CbrfCHcjy2Az56Hl0x3 E+5Q== X-Forwarded-Encrypted: i=1; AJvYcCVmXTive01H/G/Ae0FAua+oK22oj8bMLqNR/2zrj2uH2EYcAWTjxYhZI6kUdKSl3IrPRINJVxhFDrXZTniqf0Ir@lists.infradead.org X-Gm-Message-State: AOJu0Yy7G+NUGGEjAHjSSMZ/nvYxX/R85yHr+OfCmx7CzK4VQnODN6dG oAbOUOLDKc6kdPG/2dhuvw7QxmmONugRDvW3e5lJCe++3hNkjyW+3UbwqfyY/LQExK+sJSWGslW VR+cNBA== X-Google-Smtp-Source: AGHT+IEbHtnjVfs/XyOXwRVtcImn7Ac6sTdT7J05MnwMea9QA/h1ss5WMT/c3lNVvH8+kCZUWXSdbtC8V8yG X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:dc02:0:b0:e1c:ed3d:7bb7 with SMTP id 3f1490d57ef6-e29782c757dmr2976276.1.1729124774808; Wed, 16 Oct 2024 17:26:14 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:19 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-20-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 19/20] perf dwarf-regs: Remove get_arch_regstr code From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172616_765156_85412B30 X-CRM114-Status: GOOD ( 11.58 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org get_arch_regstr no longer exists so remove declaration. Associated ifs and switches are made unconditional. Signed-off-by: Ian Rogers --- tools/perf/util/dwarf-regs.c | 12 ------------ tools/perf/util/include/dwarf-regs.h | 7 ------- 2 files changed, 19 deletions(-) diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c index 05fff75a8f59..28a1cfdf26d4 100644 --- a/tools/perf/util/dwarf-regs.c +++ b/tools/perf/util/dwarf-regs.c @@ -32,23 +32,11 @@ /* Return architecture dependent register string (for kprobe-tracer) */ const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags) { -#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \ - || EM_HOST == EM_CSKY || EM_HOST == EM_LOONGARCH || EM_HOST == EM_MIPS || EM_HOST == EM_PPC \ - || EM_HOST == EM_PPC64 || EM_HOST == EM_RISCV || EM_HOST == EM_S390 || EM_HOST == EM_SH \ - || EM_HOST == EM_SPARC || EM_HOST == EM_SPARCV9 || EM_HOST == EM_XTENSA if (machine == EM_NONE) { /* Generic arch - use host arch */ machine = EM_HOST; } -#endif switch (machine) { -#if EM_HOST != EM_X86_64 && EM_HOST != EM_386 && EM_HOST != EM_AARCH64 && EM_HOST != EM_ARM \ - && EM_HOST != EM_CSKY && EM_HOST != EM_LOONGARCH && EM_HOST != EM_MIPS && EM_HOST != EM_PPC \ - && EM_HOST != EM_PPC64 && EM_HOST != EM_RISCV && EM_HOST != EM_S390 && EM_HOST != EM_SH \ - && EM_HOST != EM_SPARC && EM_HOST != EM_SPARCV9 && EM_HOST != EM_XTENSA - case EM_NONE: /* Generic arch - use host arch */ - return get_arch_regstr(n); -#endif case EM_386: return __get_dwarf_regstr(x86_32_regstr_tbl, n); case EM_X86_64: diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 9dfc9abfdddd..6ee95cc69917 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -79,13 +79,6 @@ #define DWARF_REG_FB 0xd3affb /* random number */ #ifdef HAVE_LIBDW_SUPPORT -#if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && !defined(__arm__) \ - && !defined(__loongarch__) && !defined(__mips__) && !defined(__powerpc__) \ - && !defined(__powerpc64__) && !defined(__riscv__) && !defined(__s390x__) && !defined(__sh__) \ - && !defined(__sparc64__) && !defined(__sparc__) && !defined(__xtensa__) -const char *get_arch_regstr(unsigned int n); -#endif - const char *get_csky_regstr(unsigned int n, unsigned int flags); /** From patchwork Thu Oct 17 00:25:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839318 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 D6F73D2F7DD for ; Thu, 17 Oct 2024 02:16:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :References:Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SquaAPD0AcQIjNNI8ogmi7jeRDo2TBHiGE7l1NG90xo=; b=qpBvdQsptkaXGXFrPyGG/9oDee UMlpp82FNmEgx7D3/PixuZNyPWB9OtsTKlHUWvkZ0zj67FFilrShHDKGqColt3qBOn9lWw5fwbhTQ tWu2Y2quUBN1LAqZn4OwNRZN0+CDFnjD698jtfN2TMZmlJ8+RvFsSv8RNH210T+X7zE9l2QYXyFao zz9rCxVvlkye6R3bQuefPzRHtAaEX6VHr8hDRjnKv63O9c+BqxA+eWQfwRmFaX1yp65BMVqGPwlwb 45nex/Oyog9xBQVhx4BrW9hUAs9GaOr2ErEoiewpsPTCf1al8+Tdl0q2ptA5ccxY2aCew+p9YJpCO v6lcEo0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1G3V-0000000DWyI-3IGt; Thu, 17 Oct 2024 02:16:01 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1ELM-0000000DKUu-1enE for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:26:21 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e2605ce4276so776309276.3 for ; Wed, 16 Oct 2024 17:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124779; x=1729729579; darn=lists.infradead.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=SquaAPD0AcQIjNNI8ogmi7jeRDo2TBHiGE7l1NG90xo=; b=VGOPM7WyvG0hGyo4Jy8JxI8ZIzcZucSIKfztHfcm1DV22k2TPe6JXu/vcv1AeuCL2f A1rBJbYG5Q2WYt9MT7RY3X5Bq5/RhgG7g37LD8PS9rARE+QSoBWgCBrJbbCE2ySTj3yu YwOYL2AADLCDwYj/5RZmc8Rgcc/EsKDf3d0gGVTX9rzRJlxuf1SV622SNkB98mPFiejB KFmTr8DqZZB7SyOieW56XZvv56FPRU6M9oPh2QO3NhuGyovEJD2GXvNkEaVMOg8/v8N0 UFwOs6uAy7VxVak50ZCr6nyOcv25Q9A4w7ePfhSPwYv9fDL6ue2TVSjhDCLVbL4hUXYx V0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124779; x=1729729579; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SquaAPD0AcQIjNNI8ogmi7jeRDo2TBHiGE7l1NG90xo=; b=Lg91vvb1jZu75WI5MIDnuJtzZraGT3fX/K30Bn1tz3poxj50kpwiLDulJrOic91pi7 a9CzxvYhoYZpG1oFScaTdYqA5N2iZj0ZfB0RwHHcOgcduoP7gg4b/xWuqZwoEW6iUXen cvjyiZC7u6f2BZXSATkxcAaquoom5M+/4IDwKY7Ryn/wTrNztVwwGznS8IRwtK2gk9RF +A0dTkCamjenIDiLzGksVezySM1pj14uLiywRA/ezmQTK7ma6knPYu2/ESkn3j+0rkbk lFyFZNTIxT/GmAmw+8ussw2csP1W7EQd38+Si2IpIFplvmArJgdXYOkDFmDPGK3OXCC8 D2AA== X-Forwarded-Encrypted: i=1; AJvYcCVCLth2Oc8GnEZEmSBDFwAqZiOI1xdlKWdi9i/l0WTlUTwvAhoWxbgPqcdNTSM+HeauYx0k1unBhB4XR+mrB0xZ@lists.infradead.org X-Gm-Message-State: AOJu0YwCnj4oI9QOnAl0nIZhXjZWtZuL6PlWYzv6bqDQ35gEmFA+R+bG 3EsZ3MX0Tgh5NUJGtHSfeO4CGdHPRny+Rty4fUZ6qiY4yC5tCYJ+82oKf+MwFfr8UhsZgrUKl/m O2vhBzQ== X-Google-Smtp-Source: AGHT+IGs4WdpXIM0biaGJT8f6W/Ar64INlqNJ5uuSoIpjWhZg3wOMLE81Q/Ij8NPQT52fZqpf6BkfGWtnGFO X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a25:26c4:0:b0:e28:ef6f:3624 with SMTP id 3f1490d57ef6-e2978319b29mr3216276.5.1729124778489; Wed, 16 Oct 2024 17:26:18 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:20 -0700 In-Reply-To: <20241017002520.59124-1-irogers@google.com> Message-Id: <20241017002520.59124-21-irogers@google.com> Mime-Version: 1.0 References: <20241017002520.59124-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 20/20] perf build: Remove PERF_HAVE_DWARF_REGS From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nick Terrell , "Masami Hiramatsu (Google)" , Changbin Du , Guilherme Amadio , Yang Jihong , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Bibo Mao , Huacai Chen , Kajol Jain , Atish Patra , Shenlin Liang , Anup Patel , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Przemek Kitszel , "David S. Miller" , Alexander Lobakin , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_172620_463165_EA7CC5B3 X-CRM114-Status: GOOD ( 16.60 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org PERF_HAVE_DWARF_REGS was true when an architecture had a dwarf-regs.c file. There are no more architecture dwarf-regs.c files, selection is done using constants from the ELF file rather than conditional compilation. When removing PERF_HAVE_DWARF_REGS was the only variable in the Makefile, remove the Makefile. Add missing SPDX for RISC-V Makefile. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 13 ++++--------- tools/perf/arch/arm/Makefile | 3 --- tools/perf/arch/arm64/Makefile | 3 --- tools/perf/arch/csky/Makefile | 4 ---- tools/perf/arch/loongarch/Makefile | 3 --- tools/perf/arch/mips/Makefile | 4 ---- tools/perf/arch/powerpc/Makefile | 4 ---- tools/perf/arch/riscv/Makefile | 4 +--- tools/perf/arch/s390/Makefile | 3 --- tools/perf/arch/sh/Makefile | 4 ---- tools/perf/arch/sparc/Makefile | 4 ---- tools/perf/arch/x86/Makefile | 3 --- tools/perf/arch/xtensa/Makefile | 4 ---- 13 files changed, 5 insertions(+), 51 deletions(-) delete mode 100644 tools/perf/arch/csky/Makefile delete mode 100644 tools/perf/arch/sh/Makefile delete mode 100644 tools/perf/arch/xtensa/Makefile diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 1d3f7dcc6b66..87dae64c0501 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -551,15 +551,10 @@ ifndef NO_LIBELF endif ifndef NO_LIBDW - ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) - $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled) - NO_LIBDW := 1 - else - CFLAGS += -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) - LDFLAGS += $(LIBDW_LDFLAGS) - EXTLIBS += ${DWARFLIBS} - $(call detected,CONFIG_LIBDW) - endif # PERF_HAVE_DWARF_REGS + CFLAGS += -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) + LDFLAGS += $(LIBDW_LDFLAGS) + EXTLIBS += ${DWARFLIBS} + $(call detected,CONFIG_LIBDW) endif # NO_LIBDW ifndef NO_LIBBPF diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile index 9b164d379548..8b59ce8efb89 100644 --- a/tools/perf/arch/arm/Makefile +++ b/tools/perf/arch/arm/Makefile @@ -1,5 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif PERF_HAVE_JITDUMP := 1 diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index ca2e35961287..91570d5d428e 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif PERF_HAVE_JITDUMP := 1 HAVE_KVM_STAT_SUPPORT := 1 diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile deleted file mode 100644 index 119b06a64bed..000000000000 --- a/tools/perf/arch/csky/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch/Makefile index 79b432744296..52544d59245b 100644 --- a/tools/perf/arch/loongarch/Makefile +++ b/tools/perf/arch/loongarch/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif PERF_HAVE_JITDUMP := 1 HAVE_KVM_STAT_SUPPORT := 1 diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile index 733f7b76f52d..827168f1077a 100644 --- a/tools/perf/arch/mips/Makefile +++ b/tools/perf/arch/mips/Makefile @@ -1,8 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif - # Syscall table generation for perf out := $(OUTPUT)arch/mips/include/generated/asm header := $(out)/syscalls_n64.c diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile index ae05727835d8..dc8f4fb8e324 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -1,8 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif - HAVE_KVM_STAT_SUPPORT := 1 PERF_HAVE_JITDUMP := 1 diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile index f01ab2171fd0..087e099fb453 100644 --- a/tools/perf/arch/riscv/Makefile +++ b/tools/perf/arch/riscv/Makefile @@ -1,5 +1,3 @@ -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif +# SPDX-License-Identifier: GPL-2.0 PERF_HAVE_JITDUMP := 1 HAVE_KVM_STAT_SUPPORT := 1 diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile index 58e79f5b67a4..c431c21b11ef 100644 --- a/tools/perf/arch/s390/Makefile +++ b/tools/perf/arch/s390/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif HAVE_KVM_STAT_SUPPORT := 1 PERF_HAVE_JITDUMP := 1 diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile deleted file mode 100644 index 119b06a64bed..000000000000 --- a/tools/perf/arch/sh/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile index 7741184894c8..8b59ce8efb89 100644 --- a/tools/perf/arch/sparc/Makefile +++ b/tools/perf/arch/sparc/Makefile @@ -1,6 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif - PERF_HAVE_JITDUMP := 1 diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index 51cf267f4d85..a6b6e0a9308a 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile @@ -1,7 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif HAVE_KVM_STAT_SUPPORT := 1 PERF_HAVE_JITDUMP := 1 diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makefile deleted file mode 100644 index 119b06a64bed..000000000000 --- a/tools/perf/arch/xtensa/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -ifndef NO_LIBDW -PERF_HAVE_DWARF_REGS := 1 -endif