From patchwork Thu Oct 17 00:25:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13839160 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 69269D2F7D8 for ; Thu, 17 Oct 2024 00:54:40 +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 :Mime-Version:Message-Id:Date:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=0MVEopwQelkynI+vONSt1eNqCP+P10MdFmkRWcj813Q=; b=zoLuNvEJpq2aN66IGy9ChA6zBH BAF7YV0YPu/i74zziEBGFhdO12lxxK5Zkx9ImvKjXmdX7nMkdkBFx1oITLSSWndiKWeyCshy/Q7yA dVvEN7RUVy0LM/9dWNBcHGS/nZjysw4XQ0UUJO+6m02O7YFRrnR66Y8CwIhe6OjHSeDj696DDdxfd hc6iI0i5E0NkiqAobdpya6NogORMHXJ2um5K0b07HtRWKZyRwk6q2F/AM92odFUi7bMQCzaD4V9Xk MONZkAX/h6tapHaNTsxkfEaxUQHMmD3Md+Zc9myuLEIJ9hnCA1tEe2Ps1xIFvK2CjdQR4D/8+lF2J KbDoW4eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Emc-0000000DOk0-2nyh; Thu, 17 Oct 2024 00:54:30 +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-0000000DK4n-2hjr for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 00:25:30 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-e290947f6f8so691270276.2 for ; Wed, 16 Oct 2024 17:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729124726; x=1729729526; darn=lists.infradead.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=0MVEopwQelkynI+vONSt1eNqCP+P10MdFmkRWcj813Q=; b=fOI8Xq30P/CpTlH3hukoh3b5ggUNoufXa2SlyceQ0uaB4ViNZAAOLtALfqcUs7AZtA taru1cRwk+K/XEKXi9mQWyEFzlnOy7O3UXO4pecx2ADEvdlC5QaGP3CQus+Am/2bQqx8 /uxw0iwO8harv8qzbEbmHR3LqRr3CMVvObnAS4WCNNt2MmCOH3TwqPuY9pT+6sU5XBEB 6L2e0JtcwILh6o/dAN//wvgJ37taq0lnAqeIRZ1zUkycKpL4e56sPR6Vg6ycn7hL9iBz gmXuueoe2WJC3rfCnI//eOMxWETuRmLeSk7kklO1HR3i3S97Z3Z8hb5tR4bNWI3YsPAS eUhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729124726; x=1729729526; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=0MVEopwQelkynI+vONSt1eNqCP+P10MdFmkRWcj813Q=; b=kpdWJ36i55oUjHW4rwxHDwpjfvWWW9W+B2pLln+asSeIFGg+0y8VTqIcUmYZA/Wj6S nFXGfvHD7Jb1RYEUSB+cjLyouA0WOS8dNqdt/SVkRDjROV/J7ITUBwEZHmeyT+AXfYi8 ngkydLMAvW3VyXE04Vn1lO46lKbqhgKv95vGMQbBreVWLXYfYXofbICQG4rf4QjDCWhD P4XPajwBiKjClItDvjsKQOSOVTViZdQQToxGaVM/0q9CeRP5OkXRn7fUs8uKPa+p5T1I AjYpizcQ0ldEjB6GzsM6cmU43lEigBCpjWlceF1Ffj3ohRbCWIz6qaV+K6eQ493Q79pk f3BA== X-Forwarded-Encrypted: i=1; AJvYcCVHlCq0OyyYgzEPzhiRlfAHjShqDGbqewMULG78CdzVJ7K8frttp1YiAEYxiHR48wAGqYp8R/rIiR2cY2tBkgcr@lists.infradead.org X-Gm-Message-State: AOJu0YyOCJhaOIgeuvR1dCA6ZdqTl3Cw+lLTOeTm13LVs+xyf08zfJLl ZdoLZQykuMbKSLH1gYeuW74aCbLE7GETTR6oceE3wC+NJmd+G/K979M+3PchIvXrhTJDQqujSO0 zHqGHew== X-Google-Smtp-Source: AGHT+IGs6rtJljCigsHxy+gP6Zvfa6mMr4o1JCjh56mqE4HiFoyek51h2OZvh4lGlezQ3sjgUNIEEbqKPWUq X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:a00a:f237:9bc0:79c]) (user=irogers job=sendgmr) by 2002:a05:6902:2d08:b0:e28:f6b3:3666 with SMTP id 3f1490d57ef6-e2978567367mr4642276.7.1729124726404; Wed, 16 Oct 2024 17:25:26 -0700 (PDT) Date: Wed, 16 Oct 2024 17:25:00 -0700 Message-Id: <20241017002520.59124-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog Subject: [PATCH v3 00/20] 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_172528_723777_117FF127 X-CRM114-Status: GOOD ( 21.93 ) 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 These changes are on top of: https://lore.kernel.org/lkml/20241017001354.56973-1-irogers@google.com/ Prior to these patches PERF_HAVE_DWARF_REGS indicated the presence of dwarf-regs.c in the arch directory. dwarf-regs.c provided upto 4 functions: 1) regs_query_register_offset would translate a register name into a pt_regs offset and was used by BPF prologues. BPF prologues existed for BPF events and support for these was removed many releases ago. This code was dead and could be removed. 2) get_arch_regstr duplicated get_dwarf_regstr and so it could be removed. The case for csky was a little more complicated as the ABI controlled the string. The callers of get_dwarf_regstr were updated to also pass the ELF flags so that on csky the ABI appropriate table could be used. As the argument is only used on csky this a no-op for everything else. 3) get_arch_regnum translated a register name back to a dwarf number and only existed on x86 where "al", "ax", "eax" and "rax" could all mean register 0. This code was moved to util with similar machine/flags logic to get_arch_regstr and for consistency with it. 4) get_powerpc_regs a PowerPC specific function used by annotate that should really be in util. 2 and 3 required the wiring through of the ELF machine and flags in callers to get_dwarf_regstr and get_dwarf_regnum. When these values weren't dependent on an ELF file a new EM_HOST and EF_HOST were added to give the host ELF machine and flags. These 2 #defines got rid of the existing separate arch files and #ifdefs. v3: These files were separated from the rest of the v2 libdw clean up in: https://lore.kernel.org/lkml/CAP-5=fVZH3L-6y_sxLwSmT8WyMXDMFnuqUksNULdQYJCPNBFYw@mail.gmail.com/ Ian Rogers (20): perf bpf-prologue: Remove unused file perf dwarf-regs: Remove PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET perf dwarf-regs: Add EM_HOST and EF_HOST defines perf disasm: Add e_machine/e_flags to struct arch perf dwarf-regs: Pass accurate disassembly machine to get_dwarf_regnum perf dwarf-regs: Pass ELF flags to get_dwarf_regstr perf dwarf-regs: Move x86 dwarf-regs out of arch perf arm64: Remove dwarf-regs.c perf arm: Remove dwarf-regs.c perf dwarf-regs: Move csky dwarf-regs out of arch perf loongarch: Remove dwarf-regs.c perf mips: Remove dwarf-regs.c perf dwarf-regs: Move powerpc dwarf-regs out of arch perf riscv: Remove dwarf-regs.c and add dwarf-regs-table.h perf s390: Remove dwarf-regs.c perf sh: Remove dwarf-regs.c perf sparc: Remove dwarf-regs.c perf xtensa: Remove dwarf-regs.c perf dwarf-regs: Remove get_arch_regstr code perf build: Remove PERF_HAVE_DWARF_REGS tools/perf/Makefile.config | 17 +- tools/perf/arch/arc/annotate/instructions.c | 2 + tools/perf/arch/arm/Makefile | 3 - tools/perf/arch/arm/annotate/instructions.c | 2 + tools/perf/arch/arm/util/Build | 2 - tools/perf/arch/arm/util/dwarf-regs.c | 61 ------- tools/perf/arch/arm64/Makefile | 4 - tools/perf/arch/arm64/annotate/instructions.c | 2 + tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/dwarf-regs.c | 92 ----------- tools/perf/arch/csky/Makefile | 4 - tools/perf/arch/csky/annotate/instructions.c | 7 +- tools/perf/arch/csky/util/Build | 1 - tools/perf/arch/loongarch/Makefile | 4 - .../arch/loongarch/annotate/instructions.c | 2 + tools/perf/arch/loongarch/util/Build | 1 - tools/perf/arch/loongarch/util/dwarf-regs.c | 44 ----- tools/perf/arch/mips/Makefile | 4 - tools/perf/arch/mips/annotate/instructions.c | 2 + tools/perf/arch/mips/util/Build | 1 - tools/perf/arch/mips/util/dwarf-regs.c | 38 ----- tools/perf/arch/powerpc/Makefile | 5 - .../perf/arch/powerpc/annotate/instructions.c | 2 + tools/perf/arch/powerpc/util/Build | 1 - tools/perf/arch/powerpc/util/dwarf-regs.c | 153 ------------------ tools/perf/arch/riscv/Makefile | 5 +- .../arch/riscv/include/dwarf-regs-table.h | 42 +++++ tools/perf/arch/riscv/util/Build | 1 - tools/perf/arch/riscv/util/dwarf-regs.c | 72 --------- .../perf/arch/riscv64/annotate/instructions.c | 2 + tools/perf/arch/s390/Makefile | 4 - tools/perf/arch/s390/annotate/instructions.c | 2 + tools/perf/arch/s390/util/Build | 1 - tools/perf/arch/s390/util/dwarf-regs.c | 43 ----- tools/perf/arch/sh/Build | 1 - tools/perf/arch/sh/Makefile | 4 - tools/perf/arch/sh/util/Build | 1 - tools/perf/arch/sh/util/dwarf-regs.c | 41 ----- tools/perf/arch/sparc/Build | 1 - tools/perf/arch/sparc/Makefile | 4 - tools/perf/arch/sparc/annotate/instructions.c | 2 + tools/perf/arch/sparc/util/Build | 1 - tools/perf/arch/sparc/util/dwarf-regs.c | 39 ----- tools/perf/arch/x86/Makefile | 4 - tools/perf/arch/x86/annotate/instructions.c | 3 +- tools/perf/arch/x86/util/Build | 3 - tools/perf/arch/x86/util/dwarf-regs.c | 153 ------------------ tools/perf/arch/xtensa/Build | 1 - tools/perf/arch/xtensa/Makefile | 4 - tools/perf/arch/xtensa/util/Build | 1 - tools/perf/arch/xtensa/util/dwarf-regs.c | 21 --- tools/perf/util/Build | 3 + tools/perf/util/annotate.c | 6 +- tools/perf/util/bpf-prologue.h | 37 ----- tools/perf/util/disasm.h | 4 + .../dwarf-regs.c => util/dwarf-regs-csky.c} | 19 +-- tools/perf/util/dwarf-regs-powerpc.c | 61 +++++++ tools/perf/util/dwarf-regs-x86.c | 50 ++++++ tools/perf/util/dwarf-regs.c | 38 +++-- tools/perf/util/include/dwarf-regs.h | 110 ++++++++++--- tools/perf/util/probe-finder.c | 13 +- tools/perf/util/probe-finder.h | 3 +- 62 files changed, 328 insertions(+), 927 deletions(-) delete mode 100644 tools/perf/arch/arm/util/dwarf-regs.c delete mode 100644 tools/perf/arch/arm64/util/dwarf-regs.c delete mode 100644 tools/perf/arch/csky/Makefile delete mode 100644 tools/perf/arch/loongarch/util/dwarf-regs.c delete mode 100644 tools/perf/arch/mips/util/dwarf-regs.c delete mode 100644 tools/perf/arch/powerpc/util/dwarf-regs.c create mode 100644 tools/perf/arch/riscv/include/dwarf-regs-table.h delete mode 100644 tools/perf/arch/riscv/util/dwarf-regs.c delete mode 100644 tools/perf/arch/s390/util/dwarf-regs.c delete mode 100644 tools/perf/arch/sh/Build delete mode 100644 tools/perf/arch/sh/Makefile delete mode 100644 tools/perf/arch/sh/util/Build delete mode 100644 tools/perf/arch/sh/util/dwarf-regs.c 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 delete mode 100644 tools/perf/arch/x86/util/dwarf-regs.c delete mode 100644 tools/perf/arch/xtensa/Build delete mode 100644 tools/perf/arch/xtensa/Makefile delete mode 100644 tools/perf/arch/xtensa/util/Build delete mode 100644 tools/perf/arch/xtensa/util/dwarf-regs.c delete mode 100644 tools/perf/util/bpf-prologue.h rename tools/perf/{arch/csky/util/dwarf-regs.c => util/dwarf-regs-csky.c} (74%) create mode 100644 tools/perf/util/dwarf-regs-powerpc.c create mode 100644 tools/perf/util/dwarf-regs-x86.c Reviewed-by: Masami Hiramatsu (Google)