From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7BB11607B7 for ; Sat, 5 Oct 2024 19:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158163; cv=none; b=RCdX3oXk/PJMk2/kpbIJgEgWNq51DRefwl5wGTt/J2lxBnxG4EjnIJiOoeEgN9NT8TDKARzbJBV38H620MfCee9zKjquZ6UllhFleXrLLONWO1Czd6h5g9KTFEati+Xg1jdLcOCed1RMPSttSUty/fZquTfOqaz2DDpvD2E4xaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158163; c=relaxed/simple; bh=Nd6RHayxE7oTIZe/nTOAsaRSjloYkVrh9oX/tOULgio=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=SAboxHXIFkRUgsWEHGMvNxxU4iKmXU6v7VOUsiacbuE8LAmUlCkBZodtrTs2gA7XO6dJWhy+Gj7n/kSKfu+XxqAa4OU/qOVuxnjCgHsL1tL3RT5jpApiN1snyLucTEQ4Ny970f3U28ul6O/pTpr+LIKx/H2nPy2CbC+0DFC3blU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=L+TZhidI; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="L+TZhidI" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e2605ce4276so5649811276.3 for ; Sat, 05 Oct 2024 12:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158161; x=1728762961; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=51NaLIW8tkOJtUxwqHcUszT78OCapOaZVU3wITST3Jk=; b=L+TZhidI+7fp5JoVCb2OtHADuQmMsDZEwYQCbr/Dnm/DHaXZyhAMncg3aRkbAxhfcf TqnQe/ycWd5aSxJAwLjfke8kEL5q8CLMLhT+Ejwt/5wQ8aiE6Ow9Xb5f2Uf7XfNvkDcQ AnTfUyudKerR9UGGaH4zwYZev2wzPb2TIGww1xDCeb7OXLyXp4N4oMLcPWuRjazwp3Zi VocjJ3SOoO0nnR1nwhdaTkNzWVtSBhijB/B10V2RP5eEyc0ofllBnxvIOkEDCmKSJsVu eKMzd9+kqYxkw9GBn/g7o9dAK9agWfbtNuWTKtjbirUMR/nWAtbeTIQHXKbmCFhyW+Ru 1nhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158161; x=1728762961; 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=51NaLIW8tkOJtUxwqHcUszT78OCapOaZVU3wITST3Jk=; b=icuk2UheG9iPIdjnFasLMuY8Ckb4NWqRe0p5Y5SivHQjbiI4f1SIQCwzxgV8cQ94st fRIZZo9U0akePWKAI5cjWUDny3rY9jsasfeg79BT6OcBCfR8pICT9GGGUdKomEE+zt6N AIPPVMt6t/cxL6wTigrIwMVnJXbg08DvraJv+qA/LIbwzxLNWGH7Y13xTATeMM/ugzah 5NQ/KVhk9y/9HaCmma6KOQIx77GBbe0DWsY/q/xU78xe0crdMKbYaheqMsM4wECCeYcJ ohrNg1cU0efQ1oookyWzYDaKxn8aoK/6YujNl9Tspvkw6cKUuEFgD9WWrXgnkpIWf39i ux1w== X-Forwarded-Encrypted: i=1; AJvYcCUM7Z8O12MW/hoKof3gRz1nOUsh7I/Rhq6pI5GSC6tlZ8Zelgywn3mwMVbf3qoHIWr/YbUm7ncOjnJbAWI=@vger.kernel.org X-Gm-Message-State: AOJu0YxYV8Dj+eR6ZcEk71VA8r5QFxsvaeJ+THPKZubPrhNnFWOpKOsL TP3l1QiyYKZ7jGTClOKSIR5TgZz7lSKeBohjMeBqbBQ9EfxynXQbvxr3Q83KGDV5G4ra4/zIn0T knZoruw== X-Google-Smtp-Source: AGHT+IFpB52T3N6GTujE7GYOdQ2rq5N60dCtmqvE7W4eZxrgo/OkvusaceR/GdwO/vSP+j8IGglTUnlNtHZl X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:ce0b:0:b0:e25:c8fc:b78c with SMTP id 3f1490d57ef6-e289393997bmr4258276.9.1728158160211; Sat, 05 Oct 2024 12:56:00 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:11 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-2-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 01/31] perf build: Fix !HAVE_DWARF_GETLOCATIONS_SUPPORT 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Testing with a LIBDW_DIR showed some issues. In dwarf-aux.h if HAVE_DWARF_GETLOCATIONS_SUPPORT isn't defined then the code uses an undefined errno value, so add errno.h. In Makefile.config the dwarf feature tests need the LIBDW_DIR setting in the CFLAGS/LDFLAGS. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 6 ++++++ tools/perf/util/dwarf-aux.h | 1 + 2 files changed, 7 insertions(+) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 4dcf7a0fd235..5e26d3a91b36 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -159,8 +159,14 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) DWARFLIBS +=3D -lebl endif endif +FEATURE_CHECK_CFLAGS-dwarf :=3D $(LIBDW_CFLAGS) +FEATURE_CHECK_LDFLAGS-dwarf :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) +FEATURE_CHECK_CFLAGS-dwarf_getlocations :=3D $(LIBDW_CFLAGS) +FEATURE_CHECK_LDFLAGS-dwarf_getlocations :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) +FEATURE_CHECK_CFLAGS-dwarf_getcfi :=3D $(LIBDW_CFLAGS) +FEATURE_CHECK_LDFLAGS-dwarf_getcfi :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) =20 # for linking with debug library, run like: # make DEBUG=3D1 LIBBABELTRACE_DIR=3D/opt/libbabeltrace/ diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h index 336a3a183a78..925a9bb9fb15 100644 --- a/tools/perf/util/dwarf-aux.h +++ b/tools/perf/util/dwarf-aux.h @@ -177,6 +177,7 @@ void die_collect_vars(Dwarf_Die *sc_die, struct die_var= _type **var_types); void die_collect_global_vars(Dwarf_Die *cu_die, struct die_var_type **var_= types); =20 #else /* HAVE_DWARF_GETLOCATIONS_SUPPORT */ +#include =20 static inline int die_get_var_range(Dwarf_Die *sp_die __maybe_unused, Dwarf_Die *vr_die __maybe_unused, --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4917165EFA for ; Sat, 5 Oct 2024 19:56:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158166; cv=none; b=HK/ngKj/FgHGm76G45rxQTVkCAgczTtQ+1ke/n3P7xW+VFKTPasAmor40mCt6T1FJbtk1nvQKnC0yFyKGYgnsY10Bu+qiZNc4u/r36IgdaPLMTPGI8Uhd7t6O8EevknC+ztMiqWNWqmD+osVLEH50nJ/nC1HhqIHyv2qqdUD9ww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158166; c=relaxed/simple; bh=FpDVYgI9IrJgwdqYzij6DFpKW/36XS8ZvFd3RBLOWt0=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=HXy6FAtG0+dBgjJVNfbIjtj+KlWAo94WT248uwdkAYyRp+DLHucy/oH6OgPjzb1D4n+1NVI3YxnTN37NE0AQpFC7C1XRkwOpyQ11Q2YPcOrTKu0fgNkwU1ql6KYFNKVv/PU7R5UKtk7xcliz7Zs1VHxBLZKqXz73bUBDNa4fceI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GAU8lAiV; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GAU8lAiV" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e22f0be237so59581907b3.1 for ; Sat, 05 Oct 2024 12:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158163; x=1728762963; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=/LMYv3+WdvZc4gaJkJ+8/1ILPLPMhWUj3Y+GZomvDIY=; b=GAU8lAiVCq/qhldYnDTpnz6nMF9utYzHURAfYfxwagQOvGHlZQyYfecg9CJ/7x6t9c Qd4fk8pMFILSULSWCitjOowBmamvmlhW8upC3oyyylwN8rpuKSxBqxVfE7scNEYcjT28 dNYFFHxynkxokbbhP+ooc2Qhf5+0nl4oGfw7JPvPQiL4gpAq3PrXuxqicpBR1optuLv2 +GbhrtXsEeuY9uqn9VoKSjO9wN85Ljsrj321TI4GeEGNs5rc1DbfLlmhg9LXVLlBxLwc ZiryYXZ3bd3Ac5/aQvkrQORHHAoNAtK/eHhoAfJ6z8IsK8MQ1Gi7GrHpE9WzKj1woWvQ 9nhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158163; x=1728762963; 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=/LMYv3+WdvZc4gaJkJ+8/1ILPLPMhWUj3Y+GZomvDIY=; b=kbmq+pzWQ5eNkBXNK+3KbqrTI14UV4tMCDzX6uIWYOHuRHPYMvZPGkkoPlhD/kfiiN psZJARx7VDf9WtaRplhPlGdTpTG/g0oLiKHaDb0dav9W0c6kRG9uKnYRyFmfSwf5x4tF YSsWm63CGYbC1QUa3MUo99DjSQY9hG+okkxg1mMZpB7wu4PCCq7pot31g3yIwLNJoC6w d9+kxCXsHWKHOzJqyA1blXjmRDJRhNTWhYks5FvlsocDsn+j/53YQisyRMDy+W+Jkpz0 A3kRJbYsY3jXfHv3r6zUmzxDwjOgOh6yZm96jkMHa5I8XuiDUDOPCtNm4Whqa4RpRO1q ID3w== X-Forwarded-Encrypted: i=1; AJvYcCV7nuC+bPJSfaBQtf1cXCVSBGd9y/vAbwEdOfZGunYZVIw/JB41mn5an6IunHzM6y/SplbSVcX8XYUtKQw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5saVG2E0Hf02kXuumAvUXbM8qOa45NAmzPmcThcl4t7Jgqqbz K3XYSpie5g8W0fGwAotYtLuKZKbiRppA/zul77noyXwG4PeYV0+XlMPC55LFKw5nIvlTSOhuEAJ bLV+XdA== X-Google-Smtp-Source: AGHT+IGQHKIO34wQCQbrD8UvzGXo3ZMOZtjT5rfqvG6YFvrAHuL8IEFzPTbx87DWPLMqG36F8DvjEKtUPK2U X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:2b8e:b0:6dd:d138:d823 with SMTP id 00721157ae682-6e2c72adbdamr920707b3.8.1728158162987; Sat, 05 Oct 2024 12:56:02 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:12 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-3-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 02/31] perf build: Rename NO_DWARF to NO_LIBDW 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" NO_DWARF could mean more than NO_LIBDW support, in particular no libunwind support. Rename to be more intention revealing. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 16 ++++++++-------- tools/perf/Makefile.perf | 2 +- tools/perf/arch/arm/Makefile | 2 +- tools/perf/arch/arm64/Makefile | 2 +- tools/perf/arch/csky/Makefile | 2 +- tools/perf/arch/loongarch/Makefile | 2 +- tools/perf/arch/mips/Makefile | 2 +- tools/perf/arch/powerpc/Makefile | 2 +- tools/perf/arch/riscv/Makefile | 2 +- tools/perf/arch/s390/Makefile | 2 +- tools/perf/arch/sh/Makefile | 2 +- tools/perf/arch/sparc/Makefile | 2 +- tools/perf/arch/x86/Makefile | 2 +- tools/perf/arch/xtensa/Makefile | 2 +- tools/perf/builtin-probe.c | 2 +- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 5e26d3a91b36..55a39211496d 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -429,7 +429,7 @@ ifeq ($(feature-file-handle), 1) endif =20 ifdef NO_LIBELF - NO_DWARF :=3D 1 + NO_LIBDW :=3D 1 NO_LIBUNWIND :=3D 1 NO_LIBDW_DWARF_UNWIND :=3D 1 NO_LIBBPF :=3D 1 @@ -471,9 +471,9 @@ else endif endif ifneq ($(feature-dwarf), 1) - ifndef NO_DWARF + ifndef NO_LIBDW $(warning No libdw.h found or old libdw.h found or elfutils is old= er than 0.138, disables dwarf support. Please install new elfutils-devel/li= bdw-dev) - NO_DWARF :=3D 1 + NO_LIBDW :=3D 1 endif else ifneq ($(feature-dwarf_getlocations), 1) @@ -496,7 +496,7 @@ ifeq ($(feature-libaio), 1) endif endif =20 -ifdef NO_DWARF +ifdef NO_LIBDW NO_LIBDW_DWARF_UNWIND :=3D 1 endif =20 @@ -574,17 +574,17 @@ ifndef NO_LIBELF endif endif =20 - ifndef NO_DWARF + ifndef NO_LIBDW ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) $(warning DWARF register mappings have not been defined for architec= ture $(SRCARCH), DWARF support disabled) - NO_DWARF :=3D 1 + NO_LIBDW :=3D 1 else CFLAGS +=3D -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) LDFLAGS +=3D $(LIBDW_LDFLAGS) EXTLIBS +=3D ${DWARFLIBS} $(call detected,CONFIG_DWARF) endif # PERF_HAVE_DWARF_REGS - endif # NO_DWARF + endif # NO_LIBDW =20 ifndef NO_LIBBPF ifeq ($(feature-bpf), 1) @@ -633,7 +633,7 @@ ifdef PERF_HAVE_JITDUMP endif =20 ifeq ($(SRCARCH),powerpc) - ifndef NO_DWARF + ifndef NO_LIBDW CFLAGS +=3D -DHAVE_SKIP_CALLCHAIN_IDX endif endif diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 9dd2e8d3f3c9..a144bfaf8aeb 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -40,7 +40,7 @@ include ../scripts/utilities.mak # # Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS. # -# Define NO_DWARF if you do not want debug-info analysis feature at all. +# Define NO_LIBDW if you do not want debug-info analysis feature at all. # # Define WERROR=3D0 to disable treating any warnings as errors. # diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile index 1d88fdab13bf..9b164d379548 100644 --- a/tools/perf/arch/arm/Makefile +++ b/tools/perf/arch/arm/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif PERF_HAVE_JITDUMP :=3D 1 diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile index 5735ed4479bb..8a5ffbfe809f 100644 --- a/tools/perf/arch/arm64/Makefile +++ b/tools/perf/arch/arm64/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif PERF_HAVE_JITDUMP :=3D 1 diff --git a/tools/perf/arch/csky/Makefile b/tools/perf/arch/csky/Makefile index 88c08eed9c7b..119b06a64bed 100644 --- a/tools/perf/arch/csky/Makefile +++ b/tools/perf/arch/csky/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif diff --git a/tools/perf/arch/loongarch/Makefile b/tools/perf/arch/loongarch= /Makefile index c89d6bb6b184..1cc5eb01f32b 100644 --- a/tools/perf/arch/loongarch/Makefile +++ b/tools/perf/arch/loongarch/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile index cd0b011b3be5..733f7b76f52d 100644 --- a/tools/perf/arch/mips/Makefile +++ b/tools/perf/arch/mips/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif =20 diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Mak= efile index bf6d323574f6..7672d555f6cd 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif =20 diff --git a/tools/perf/arch/riscv/Makefile b/tools/perf/arch/riscv/Makefile index 90c3c476a242..4664a78a1afd 100644 --- a/tools/perf/arch/riscv/Makefile +++ b/tools/perf/arch/riscv/Makefile @@ -1,4 +1,4 @@ -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile index 56994e63b43a..3f66e2ede3f7 100644 --- a/tools/perf/arch/s390/Makefile +++ b/tools/perf/arch/s390/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif HAVE_KVM_STAT_SUPPORT :=3D 1 diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile index 88c08eed9c7b..119b06a64bed 100644 --- a/tools/perf/arch/sh/Makefile +++ b/tools/perf/arch/sh/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile index 4031db72ba71..7741184894c8 100644 --- a/tools/perf/arch/sparc/Makefile +++ b/tools/perf/arch/sparc/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif =20 diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile index 67b4969a6738..9aa58acb5564 100644 --- a/tools/perf/arch/x86/Makefile +++ b/tools/perf/arch/x86/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif HAVE_KVM_STAT_SUPPORT :=3D 1 diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makef= ile index 88c08eed9c7b..119b06a64bed 100644 --- a/tools/perf/arch/xtensa/Makefile +++ b/tools/perf/arch/xtensa/Makefile @@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only -ifndef NO_DWARF +ifndef NO_LIBDW PERF_HAVE_DWARF_REGS :=3D 1 endif diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 003a3bcebfdf..91672bb3047c 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -616,7 +616,7 @@ __cmd_probe(int argc, const char **argv) set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE); set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE); #else -# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_DWARF= =3D1", c) +# define set_nobuild(s, l, c) set_option_nobuild(options, s, l, "NO_LIBDW= =3D1", c) set_nobuild('L', "line", false); set_nobuild('V', "vars", false); set_nobuild('\0', "externs", false); --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0276516A959 for ; Sat, 5 Oct 2024 19:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158167; cv=none; b=iWK0+Dar007ZXerHkw+H489ze3rI+mCfHk50QwEX+ThaFQ2iyxTkrWhsVLoZ7EorAMepT7YbaFpLBooomVNXdEaqum0pvh9arr0kBt64emyKtEA4N5nvbpVM/v5OC/rk6vWXVHdDDpLCVqlhvkQ2Pjursze1HZmwD+qmmu5R0AI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158167; c=relaxed/simple; bh=7T62nVUnz2I2Gia0eUGZ0foLAAktxEd4nUH/IRsxY3g=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=pxfYZMteq8QsCh27S3fHntqOz5ncJNG53s8xcZvcWdrL1jN/CI5vEJqNsWfa3tUN8kE1sNK9NGT5LUqIfwsCoi/2MGDzbMqmD3m2nqiGjO4s5FEfmPZ3T/SktEYawCxPLh1rGqWUQTOSprBkLNG32sSZKJ3SlnexLSexnyKJe9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=W4Qiv7ef; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="W4Qiv7ef" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e278b2a5c4so58284987b3.2 for ; Sat, 05 Oct 2024 12:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158165; x=1728762965; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=Kkv8bNfBm9/dMXp08m7d8I1ujeupVoM1qxtGNFcSU78=; b=W4Qiv7efgEzDsL33w+nE3HaqipEbVLcG4WzhVoPj0p2ahQcifKeKhEhiXLKzK+HYSt w4O23pcdudTEowpSHk5O2Zj7ripu0ZM9dEVA8cAybT894YjrrzF0xAxgwNs14CmjM1Ld N3fH72KPs93hW6xzf9AjQ+ncxIwjlX9EBZ46dOsGU4HuxQ7RgQScXTf6TGG44P/jZ0FD EtHZqv8MDC9f91hsSW0WcxYV359eQotFZxLx5DB0PYB1vOjql5jb//Kbn46GNxYmMCi6 H+Lp2g5ejVQg5qQCKDzKu4L+O53nast+sPyIsrx9Syzpp4fXz8b+JL1uD9efNnjenuc+ SuWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158165; x=1728762965; 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=Kkv8bNfBm9/dMXp08m7d8I1ujeupVoM1qxtGNFcSU78=; b=Gb7smqQATEHKngiaYHzrxjCLuZPZ3ufCWk8l6VsFGCn14LRzPGLd/JFX98eugd5a56 LAEIfySJQYO538oCw+yxy2g/NdZ7Ky8xufLD/15kyuAA9H/8uRka7esm4gqtCQpdF3uE EWOtWqcBptMA68+7kX1ER7JL2dF6fN4yxJ0KVJJf4HiAe/mRp72nRPDIpROECTJotTar n/ancEOT8YxEsTeFjqzE932sH6pOgER6zGa3TuZGRXsSAhJLiuK1XiVJmWfVt2p1M17J 9ItGpEhr21uH6jxuG8wpPK9Ahj1HH6PdFDPui1WJi0fIjxBDoJULoIq10njbPEfsQ++Q v6HA== X-Forwarded-Encrypted: i=1; AJvYcCXR7QLx4alkmbDkmnK32AzmPxQmjvuRCm39M+05URVl6NqFkfqKW6e7nS5PTTPBIweobC/aFSqfdSp40Zg=@vger.kernel.org X-Gm-Message-State: AOJu0Yx86tDwG5INQywmyVhkjoaW8BZrryg72Vf03OyCw51CXJLRRp6N ner1hnbWe8rMq0k40T6IUrXuQFw0LNsNzoe1AUFUFT2JfJ6bEe5m2aen/MbKFO+yVDJHI3hxvck UD2j+3Q== X-Google-Smtp-Source: AGHT+IHhkYnBtrBd+SOkXzP7+HOoF5g3/WxbcOIpY5cilwtjjCAK86WSpPWlw1sMJUnsYpXgeVLoazZjXm6V X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:7446:0:b0:e16:6771:a299 with SMTP id 3f1490d57ef6-e289394dd4dmr4215276.11.1728158164909; Sat, 05 Oct 2024 12:56:04 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:13 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-4-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 03/31] perf build: Remove defined but never used variable 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Previously NO_DWARF_UNWIND was part of conditional compilation but it is now unused so remove. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 55a39211496d..182e14e39cd5 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -753,8 +753,6 @@ endif ifeq ($(dwarf-post-unwind),1) CFLAGS +=3D -DHAVE_DWARF_UNWIND_SUPPORT $(call detected,CONFIG_DWARF_UNWIND) -else - NO_DWARF_UNWIND :=3D 1 endif =20 ifndef NO_LOCAL_LIBUNWIND --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D41616FF37 for ; Sat, 5 Oct 2024 19:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158171; cv=none; b=gsPnxF2rQzjW5Kljwx/zBDl0S1idg0wyPxB9hyMbR3ThKgDzf2b+puscTHPAeOsQW9XTbNX0/0Es2qN7HnuZq9eC1KC+zDhoMJu3C4B49QK30pXZWGoHrDdpkjxNq5dJVMccJfEKx3hl4As4r/zpX4U35Sw/thg266N3gtMhP/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158171; c=relaxed/simple; bh=8pm5i1eGHWDDXJHC4BfkaRu28Wigks0+wYzENVnnTRs=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=VtYeQ7Tdw8ZJ8A821cQlhX1I2XXWh3iomrwInQ/mfTgCRnCfacL1FHW56HqjCFUioGZR10hoyq6zI/90a1nPubwCQTvnbaS32qyxWOj6qIjMf19n4EywkzpjvxaAKmd0esj76363zMH3pkWO8c4OBuoaE8BVuhgDI+UReJpDSOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GRtLJ0BW; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GRtLJ0BW" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e25e3d7f514so4754115276.0 for ; Sat, 05 Oct 2024 12:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158167; x=1728762967; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=jKCAAT8Yq0zCoRQSEuvmwmrXtedkR549ZkEZtq8vZwU=; b=GRtLJ0BWrlPLkUiKJ9w/bX9CnlLyv7tGx0rjvCsH7B9y/fZniMM4SS7OPDC/8AMJdU jw73g+iiARnsJzvOP6WCMMs8B6oSYWzPmdor4fay82Q7afsbvYXmgz6xD1cRWmtNhilO eSHLp4cbHRzZ3+DjUkatZlrxvGfM7gw4NQk7U88lSiI0j2SvIb9UiPSeCXc3hZJi8WIW F7B2aljMv3svEkeJrCx8A20L8p27WO+giXN1hFMZ6APW98pRbGrbNSpd/D/5+nclrqMe 53orjh5K+6QDlyYjvXLKBiQ4+Q/yRB6LB4UhHfEcfOegF5tu9zZpth97NLRfsl0iQDi6 hIjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158167; x=1728762967; 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=jKCAAT8Yq0zCoRQSEuvmwmrXtedkR549ZkEZtq8vZwU=; b=s82wmges4+siJIGARJyEBXYU8t8J072TE1XsH7G3ufBsNxtclEOU5FkfEE4pEV2Os2 fuBsBQJ318G9occ/bm3THuDMKeMu2R3PV56D5CPfNNVsXvCliHcyAoprH3PEAkF8XHBS d66uYFTziyMkAsphaJKYeSoqiV3enpSSnvmmKO0V+mTiurQsWWflg02eacSbYrDkWt9W LiAeMYewV7TCfmre3qNRoYRY+BXG5oHOEfpara9+OYFKAmniz4Kkq9ByGrJoAAc6osHT nBwlRXLmwJ3AxMeF6RizA08qIcuI2GzQ5ByY5A9ES9MT/ujM9SQMTTmfiNnIM/hh8Q0m x0mQ== X-Forwarded-Encrypted: i=1; AJvYcCX+5Wz/LZ/UtqahmMxXsVYs2wCAQLPbnWBHNDhLnLKFJWqA/eTKs7Ru1zk1QtDOlcoLxq0Zl5y4eSmbybU=@vger.kernel.org X-Gm-Message-State: AOJu0YwdCKdfCwE2U0wLgBFFE/RdaTCNSVEzj3WNdmMziLQt7M0pjZ+W lIDcNKqKqWlDYL2F7SbfMrcXvXCNwzDbGjkx7asWZ86LAtdrY7TBj+iLb0ikAKS2M3LwadjCOyS YIMjehg== X-Google-Smtp-Source: AGHT+IG0rU9ibGjtPmAL08yq2KEhHsCm45b7xwYMGISD4T+sjFBkBvKxulNTeU2lvZfpr29mKdjAqeZdA/VR X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:adc2:0:b0:e24:9584:52d3 with SMTP id 3f1490d57ef6-e28936b99bamr11206276.2.1728158167274; Sat, 05 Oct 2024 12:56:07 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:14 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-5-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 04/31] perf build: Rename test-dwarf to test-libdw 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Be more intention revealing that the dwarf test is actually testing for libdw support. Signed-off-by: Ian Rogers --- tools/build/Makefile.feature | 6 +++--- tools/build/feature/Makefile | 16 ++++++++-------- tools/build/feature/test-all.c | 6 +++--- .../build/feature/{test-dwarf.c =3D> test-libdw.c} | 0 tools/perf/Makefile.config | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) rename tools/build/feature/{test-dwarf.c =3D> test-libdw.c} (100%) diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index ffd117135094..6025810cc346 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -30,7 +30,7 @@ endef # FEATURE_TESTS_BASIC :=3D \ backtrace \ - dwarf \ + libdw \ dwarf_getlocations \ dwarf_getcfi \ eventfd \ @@ -120,7 +120,7 @@ ifeq ($(FEATURE_TESTS),all) endif =20 FEATURE_DISPLAY ?=3D \ - dwarf \ + libdw \ dwarf_getlocations \ glibc \ libbfd \ @@ -233,7 +233,7 @@ endef =20 # # generates feature value assignment for name, like: -# $(call feature_assign,dwarf) =3D=3D feature-dwarf=3D1 +# $(call feature_assign,libdw) =3D=3D feature-libdw=3D1 # feature_assign =3D feature-$(1)=3D$(feature-$(1)) =20 diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 5938cf799dc6..bece326ac93b 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -5,7 +5,7 @@ FILES=3D \ test-all.bin \ test-backtrace.bin \ test-bionic.bin \ - test-dwarf.bin \ + test-libdw.bin \ test-dwarf_getlocations.bin \ test-dwarf_getcfi.bin \ test-eventfd.bin \ @@ -168,9 +168,9 @@ $(OUTPUT)test-libopencsd.bin: $(BUILD) # -lopencsd_c_api -lopencsd provided by # $(FEATURE_CHECK_LDFLAGS-libopencsd) =20 -DWARFLIBS :=3D -ldw +DWLIBS :=3D -ldw ifeq ($(findstring -static,${LDFLAGS}),-static) - DWARFLIBS +=3D -lelf -lz -llzma -lbz2 -lzstd + DWLIBS +=3D -lelf -lz -llzma -lbz2 -lzstd =20 LIBDW_VERSION :=3D $(shell $(PKG_CONFIG) --modversion libdw) LIBDW_VERSION_1 :=3D $(word 1, $(subst ., ,$(LIBDW_VERSION))) @@ -179,18 +179,18 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) # Elfutils merged libebl.a into libdw.a starting from version 0.177, # Link libebl.a only if libdw is older than this version. ifeq ($(shell test $(LIBDW_VERSION_2) -lt 177; echo $$?),0) - DWARFLIBS +=3D -lebl + DWLIBS +=3D -lebl endif endif =20 -$(OUTPUT)test-dwarf.bin: - $(BUILD) $(DWARFLIBS) +$(OUTPUT)test-libdw.bin: + $(BUILD) $(DWLIBS) =20 $(OUTPUT)test-dwarf_getlocations.bin: - $(BUILD) $(DWARFLIBS) + $(BUILD) $(DWLIBS) =20 $(OUTPUT)test-dwarf_getcfi.bin: - $(BUILD) $(DWARFLIBS) + $(BUILD) $(DWLIBS) =20 $(OUTPUT)test-libelf-getphdrnum.bin: $(BUILD) -lelf diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 6f4bf386a3b5..d60e072b6eca 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -38,8 +38,8 @@ # include "test-glibc.c" #undef main =20 -#define main main_test_dwarf -# include "test-dwarf.c" +#define main main_test_libdw +# include "test-libdw.c" #undef main =20 #define main main_test_dwarf_getlocations @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) main_test_get_current_dir_name(); main_test_gettid(); main_test_glibc(); - main_test_dwarf(); + main_test_libdw(); main_test_dwarf_getlocations(); main_test_eventfd(); main_test_libelf_getphdrnum(); diff --git a/tools/build/feature/test-dwarf.c b/tools/build/feature/test-li= bdw.c similarity index 100% rename from tools/build/feature/test-dwarf.c rename to tools/build/feature/test-libdw.c diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 182e14e39cd5..c8e157cc0c5e 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -159,8 +159,8 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) DWARFLIBS +=3D -lebl endif endif -FEATURE_CHECK_CFLAGS-dwarf :=3D $(LIBDW_CFLAGS) -FEATURE_CHECK_LDFLAGS-dwarf :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) +FEATURE_CHECK_CFLAGS-libdw :=3D $(LIBDW_CFLAGS) +FEATURE_CHECK_LDFLAGS-libdw :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-dwarf_getlocations :=3D $(LIBDW_CFLAGS) @@ -470,7 +470,7 @@ else $(warning No libdw DWARF unwind found, Please install elfutils-dev= el/libdw-dev >=3D 0.158 and/or set LIBDW_DIR) endif endif - ifneq ($(feature-dwarf), 1) + ifneq ($(feature-libdw), 1) ifndef NO_LIBDW $(warning No libdw.h found or old libdw.h found or elfutils is old= er than 0.138, disables dwarf support. Please install new elfutils-devel/li= bdw-dev) NO_LIBDW :=3D 1 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E9DE171E70 for ; Sat, 5 Oct 2024 19:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158172; cv=none; b=j82qVI/+Vxkwho5SzKe1jp9mTJ+LeXmo5OgZjd6paU7U81tddmep9DHmYmVPYB/4wnJYRWoZPx+VXl7ogWNeQLXVor/m3sg8DcTr5uE4rkPqBdHGta2/3fbznJni/PaVYcLKnbStFtmtnFM7q3MlbRYazttU5qKH8IduVYV2UFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158172; c=relaxed/simple; bh=/emFBd27SIpNkbWFY8CWoalwr1F9D3lqF9EGRJG1AJ0=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=j/YlgI4lJ237F7j38hhu4NxMSLMOP5b9wRGXG2hyD+SOTQjZzI4NqGW48JWYgQRedIJdyw+9Iv+b4QngV5W4odtSF7lRPq1nhS9Ve4SN6Ucln1x+ODl3UIWDuzws+NOr4y7lxRTG5x0IKhEpCBEsy04EQb/1c58FemByoQztwTo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=2ALQdxAQ; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2ALQdxAQ" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2364f45a4so42687197b3.2 for ; Sat, 05 Oct 2024 12:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158170; x=1728762970; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=HHCrs5RpxQhB9H4vvM4MCWIjboq5jYaTqx9B2UPb0W4=; b=2ALQdxAQYFlhRqObFteK3CW5/y3WpjyNmG+hF2jw5DCNVFIS/6HzQ8qYuk/Q7TesLA MQ+4/EclnBoHCeDtsg5E3JRO0723SNdpAtEyP8OhNGMvC7J2p1GPSrvRtTwwRziZOdW8 j0BsalTV73iur8EWpG2TEK/1EhBL+aqlv5yslBKmF7b0FiOMlqmwi0Kgg2deCViZcDXt 3GAZgYD2ZdYGxFvhNfI1zcQgWYBH+1HVf0eac8d1s3U3IMUIaa/dsDrqEr8WNQHcunr+ heloiKEnOFz6eKkiDdhmWP/cdGf+tvaC0gCQA3udOwEsy7XL9+Fm4ovrHcebIuHX8E4v PqOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158170; x=1728762970; 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=HHCrs5RpxQhB9H4vvM4MCWIjboq5jYaTqx9B2UPb0W4=; b=UPVUecX8otUVIJf8oJ8MNBpF3FBGj4ZDxd0Zo9JgVNzAksdY5f2uZ8n92PZzXC4osY 56+SObuirD41ELgd084OQDwIsYPSQq9V8b6TEHFfOusnf534eJjCD9ArSK12PXd61V8I GXUHxzG0Nn3mAfE+mvW/kJ+INxUNXrXNXE9ehm1rT15NivbgILh8lutFk92PobjzByGi KEbN+ibFZic2gT1++4fdKH1YZE6VY6T9MIcwMZ+NbAkF8y3Uhw/cC0seR12f01dBlZfm zm4doyDQeLfD/VQA6IX91fsGCl3DZJd4A5s3Bz0yeIpGNeqpeQnzTY6gEniH2vAq0vGy sk8w== X-Forwarded-Encrypted: i=1; AJvYcCVIUPVCQvAmO7v53mYzkbmlxXGSMMjVXHanRMhIWfoXpDeetLXfswUY4InaNAKfUxhX8XoCU0/0GrzJzFw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx7vXQBOZ5vMS9n3e6P4orwbOW0XNZnoJ5TQIkBIZVXvZmt5kcc kHIG5f4aa8wdnUE+TY3irIyzvyceNfCGrMpp/I9cdYaOGTXR6aI6TEUNfbwj1+pzJehdI4aA1Bq i38HMNw== X-Google-Smtp-Source: AGHT+IEhekuG7RUOfycyDG27OWqeWfPbamRuutC2Jb29fG/nD/NbI3iivYWnvTJB6Fr1oIlRUAUSSAQRUKkv X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:6e13:b0:6e2:120b:be57 with SMTP id 00721157ae682-6e2c7292042mr1661887b3.5.1728158169620; Sat, 05 Oct 2024 12:56:09 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:15 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 05/31] perf build: Combine libdw-dwarf-unwind into libdw feature tests 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Support in libdw has been present for 10 years so let's simplify the build logic with a single feature test. Signed-off-by: Ian Rogers --- tools/build/Makefile.feature | 2 -- tools/build/feature/Makefile | 4 ---- tools/build/feature/test-all.c | 5 ----- tools/build/feature/test-libdw-dwarf-unwind.c | 14 -------------- tools/build/feature/test-libdw.c | 19 ++++++++++++++++++- tools/perf/Makefile.config | 8 -------- 6 files changed, 18 insertions(+), 34 deletions(-) delete mode 100644 tools/build/feature/test-libdw-dwarf-unwind.c diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 6025810cc346..db3695ec5f83 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -60,7 +60,6 @@ FEATURE_TESTS_BASIC :=3D \ reallocarray \ stackprotector-all \ timerfd \ - libdw-dwarf-unwind \ zlib \ lzma \ get_cpuid \ @@ -133,7 +132,6 @@ FEATURE_DISPLAY ?=3D \ libpython \ libcrypto \ libunwind \ - libdw-dwarf-unwind \ libcapstone \ llvm-perf \ zlib \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index bece326ac93b..7bb409c1f7e6 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -52,7 +52,6 @@ FILES=3D \ test-pthread-barrier.bin \ test-stackprotector-all.bin \ test-timerfd.bin \ - test-libdw-dwarf-unwind.bin \ test-libbabeltrace.bin \ test-libcapstone.bin \ test-compile-32.bin \ @@ -314,9 +313,6 @@ $(OUTPUT)test-backtrace.bin: $(OUTPUT)test-timerfd.bin: $(BUILD) =20 -$(OUTPUT)test-libdw-dwarf-unwind.bin: - $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind) - $(OUTPUT)test-libbabeltrace.bin: $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace) =20 diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index d60e072b6eca..863c82516433 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -98,10 +98,6 @@ # include "test-stackprotector-all.c" #undef main =20 -#define main main_test_libdw_dwarf_unwind -# include "test-libdw-dwarf-unwind.c" -#undef main - #define main main_test_zlib # include "test-zlib.c" #undef main @@ -202,7 +198,6 @@ int main(int argc, char *argv[]) main_test_numa_num_possible_cpus(); main_test_timerfd(); main_test_stackprotector_all(); - main_test_libdw_dwarf_unwind(); main_test_zlib(); main_test_pthread_attr_setaffinity_np(); main_test_pthread_barrier(); diff --git a/tools/build/feature/test-libdw-dwarf-unwind.c b/tools/build/fe= ature/test-libdw-dwarf-unwind.c deleted file mode 100644 index ed03d9505609..000000000000 --- a/tools/build/feature/test-libdw-dwarf-unwind.c +++ /dev/null @@ -1,14 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include - -int main(void) -{ - /* - * This function is guarded via: __nonnull_attribute__ (1, 2). - * Passing '1' as arguments value. This code is never executed, - * only compiled. - */ - dwfl_thread_getframes((void *) 1, (void *) 1, NULL); - return 0; -} diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-li= bdw.c index 8d474bd7371b..793f4ac49514 100644 --- a/tools/build/feature/test-libdw.c +++ b/tools/build/feature/test-libdw.c @@ -1,11 +1,28 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include =20 -int main(void) +int test_libdw(void) { Dwarf *dbg =3D dwarf_begin(0, DWARF_C_READ); =20 return (long)dbg; } + +int test_libdw_unwind(void) +{ + /* + * This function is guarded via: __nonnull_attribute__ (1, 2). + * Passing '1' as arguments value. This code is never executed, + * only compiled. + */ + dwfl_thread_getframes((void *) 1, (void *) 1, NULL); + return 0; +} + +int main(void) +{ + return test_libdw() + test_libdw_unwind(); +} diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index c8e157cc0c5e..93fd6bd74d20 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -161,8 +161,6 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) endif FEATURE_CHECK_CFLAGS-libdw :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-libdw :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) -FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_CFLAGS) -FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-dwarf_getlocations :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-dwarf_getlocations :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-dwarf_getcfi :=3D $(LIBDW_CFLAGS) @@ -464,12 +462,6 @@ else endif endif else - ifndef NO_LIBDW_DWARF_UNWIND - ifneq ($(feature-libdw-dwarf-unwind),1) - NO_LIBDW_DWARF_UNWIND :=3D 1 - $(warning No libdw DWARF unwind found, Please install elfutils-dev= el/libdw-dev >=3D 0.158 and/or set LIBDW_DIR) - endif - endif ifneq ($(feature-libdw), 1) ifndef NO_LIBDW $(warning No libdw.h found or old libdw.h found or elfutils is old= er than 0.138, disables dwarf support. Please install new elfutils-devel/li= bdw-dev) --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E322B173331 for ; Sat, 5 Oct 2024 19:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158175; cv=none; b=MvcJtWgCn1Vaz4hAdQVwmUVV3Qu3infaC3908QSUESLD4TKZIiVm/2CYRAjchkYdXzu0qMhiRs6Acq9UL2QU4zyjBWEuWEeBKeMkxaSN4+N5oLGfklNcQidnllToykTUZxzHH4/9IFgBH+7h3exgMNPOJrWmYg8ax405PwZYJtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158175; c=relaxed/simple; bh=q4ft2hc9O4eMqPDP0cD0efN6RrA3dpWYVF7Lq3jWEYo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=gHXna7rpI4pA5SqOZRT+YQ9+MeLhGtlZhQhUcCFNrGaB38aGMAF/ytxoqkdGX4cDP5G0l2vAhPwcfgvIv1vth0SB0e/CgY+p3GXzBGX4XYb9D+tRnFY4KrXWQH93BdexneN4xmSZ/628YSpAM7Th2BxqCP99kgej28tZLOUWH20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=yz7DyHmX; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="yz7DyHmX" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2317d1cb7so50293377b3.3 for ; Sat, 05 Oct 2024 12:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158172; x=1728762972; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=5T5tCPOGyJCvNBSpHWk2GY1SqD0ik3fhg7b1kYtWk8k=; b=yz7DyHmX2bhTqDLAQX7KOnjJGZRxn60ZSzAjxdIWKRR8PoKCVczG4EVoBEUwUVzTAV o5WTiAeWQTHfmt4rocbA9mFlY4M3lAr2qyaGqocz4gWqN8u9yLnb6ZFbijNHOZONdC4Z k7XWSb4OI7Pp+bd+03VHdxd0/JsI5/h03Gvw5JNiruDQ+OKnjLh2rWmTq4QdMJhcQpN2 k/sdgRZeV2Kib2Y4hUXPoAp6IO+LWxY53C1zQaUPFOfNFOEF2kLU6p0xFTQ7mSBGaoP5 aaIQSVr/P8IqtiloHZe8PGny13EY27NNiKX1XNh4Mc+COFp2ZOtvfI3Tda91+0zG07wV PgQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158172; x=1728762972; 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=5T5tCPOGyJCvNBSpHWk2GY1SqD0ik3fhg7b1kYtWk8k=; b=YXBwjRHxWgtWHbGXUDE+hzGzSyWy8gLjE5OTA/PbLJmQrU0Czx90JxhYPpBLnjuxql 4H8njZ6h9hzQ8oHUWPyWRPTcEFsWz2W1Mvrz/km8/I4fYxXnQHsckvXkmy/NaLmBQVRp QUVv2RlwmPm5eIOv2LHzuiFqKOvwmIYxGTPKDQEdRoxGqe14Y6t7rVvh6j5CB3olxmOZ jzhqBO0eDkirDXeix+TUvKRoXDOY5KhT1ecUBhgiDyekIs7vzK10iTQ3muF5EN6DD6MM 7CrzjdnUNl7FZt4n+DKYFyLZjo3JzTCCisqWLxLYc7MK462rHCtZ2R2VQ6I1Tivpl4Oq ArBA== X-Forwarded-Encrypted: i=1; AJvYcCU5jT3Sp7KWM0TC1RNW8P9pgaYAzzC4u/Fq+uYxnXzrjZKKu2lqba2YFa1j3dPLqvW+nuDWYH5DWb4HjiM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2I8sf0Uks4hIi2IN+DA0EMrQMMRSdzdbN+epWIfHjL/x+Dv9f niZ8zofRgtsp5rgsz6wsoaWECHfDSpGHqCy26wXL2vkx+qnSQQvmOG1Ztek/WQb4kRluUJgUDs4 Xbs9OFg== X-Google-Smtp-Source: AGHT+IFUof9q2cilWVpyDs4oVP+nAlyKWLNvJCEvU13NF2KeKjgTJ+lCLvaeS32rFGhkBh06FROgvfGUuw0Q X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:3581:b0:6e2:6f2:efc with SMTP id 00721157ae682-6e2c7290b3emr1498087b3.5.1728158171884; Sat, 05 Oct 2024 12:56:11 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:16 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-7-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 06/31] perf build: Combine test-dwarf-getlocations into test-libdw 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" dwarf_getlocations support in libdw is more than 10 years old. Make libdw imply dwarf_getlocations support and simplify build logic. Signed-off-by: Ian Rogers --- tools/build/Makefile.feature | 2 -- tools/build/feature/Makefile | 4 ---- tools/build/feature/test-all.c | 5 ----- tools/build/feature/test-dwarf_getlocations.c | 13 ------------- tools/build/feature/test-libdw.c | 14 +++++++++++++- tools/perf/Makefile.config | 10 ++-------- 6 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 tools/build/feature/test-dwarf_getlocations.c diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index db3695ec5f83..cf6a967575ea 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -31,7 +31,6 @@ endef FEATURE_TESTS_BASIC :=3D \ backtrace \ libdw \ - dwarf_getlocations \ dwarf_getcfi \ eventfd \ fortify-source \ @@ -120,7 +119,6 @@ endif =20 FEATURE_DISPLAY ?=3D \ libdw \ - dwarf_getlocations \ glibc \ libbfd \ libbfd-buildid \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 7bb409c1f7e6..7683d171f744 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -6,7 +6,6 @@ FILES=3D \ test-backtrace.bin \ test-bionic.bin \ test-libdw.bin \ - test-dwarf_getlocations.bin \ test-dwarf_getcfi.bin \ test-eventfd.bin \ test-fortify-source.bin \ @@ -185,9 +184,6 @@ endif $(OUTPUT)test-libdw.bin: $(BUILD) $(DWLIBS) =20 -$(OUTPUT)test-dwarf_getlocations.bin: - $(BUILD) $(DWLIBS) - $(OUTPUT)test-dwarf_getcfi.bin: $(BUILD) $(DWLIBS) =20 diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 863c82516433..59ef3d7fe6a4 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -42,10 +42,6 @@ # include "test-libdw.c" #undef main =20 -#define main main_test_dwarf_getlocations -# include "test-dwarf_getlocations.c" -#undef main - #define main main_test_eventfd # include "test-eventfd.c" #undef main @@ -184,7 +180,6 @@ int main(int argc, char *argv[]) main_test_gettid(); main_test_glibc(); main_test_libdw(); - main_test_dwarf_getlocations(); main_test_eventfd(); main_test_libelf_getphdrnum(); main_test_libelf_gelf_getnote(); diff --git a/tools/build/feature/test-dwarf_getlocations.c b/tools/build/fe= ature/test-dwarf_getlocations.c deleted file mode 100644 index 78fb4a1fa68c..000000000000 --- a/tools/build/feature/test-dwarf_getlocations.c +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include - -int main(void) -{ - Dwarf_Addr base, start, end; - Dwarf_Attribute attr; - Dwarf_Op *op; - size_t nops; - ptrdiff_t offset =3D 0; - return (int)dwarf_getlocations(&attr, offset, &base, &start, &end,= &op, &nops); -} diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-li= bdw.c index 793f4ac49514..83ea5d5f235d 100644 --- a/tools/build/feature/test-libdw.c +++ b/tools/build/feature/test-libdw.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#include #include #include #include @@ -22,7 +23,18 @@ int test_libdw_unwind(void) return 0; } =20 +int test_libdw_getlocations(void) +{ + Dwarf_Addr base, start, end; + Dwarf_Attribute attr; + Dwarf_Op *op; + size_t nops; + ptrdiff_t offset =3D 0; + + return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &= nops); +} + int main(void) { - return test_libdw() + test_libdw_unwind(); + return test_libdw() + test_libdw_unwind() + test_libdw_getlocations(); } diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 93fd6bd74d20..903de48c140d 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -161,8 +161,6 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) endif FEATURE_CHECK_CFLAGS-libdw :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-libdw :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) -FEATURE_CHECK_CFLAGS-dwarf_getlocations :=3D $(LIBDW_CFLAGS) -FEATURE_CHECK_LDFLAGS-dwarf_getlocations :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) FEATURE_CHECK_CFLAGS-dwarf_getcfi :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-dwarf_getcfi :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) =20 @@ -464,15 +462,11 @@ else else ifneq ($(feature-libdw), 1) ifndef NO_LIBDW - $(warning No libdw.h found or old libdw.h found or elfutils is old= er than 0.138, disables dwarf support. Please install new elfutils-devel/li= bdw-dev) + $(warning No libdw.h found or old libdw.h found or elfutils is old= er than 0.157, disables dwarf support. Please install new elfutils-devel/li= bdw-dev) NO_LIBDW :=3D 1 endif else - ifneq ($(feature-dwarf_getlocations), 1) - $(warning Old libdw.h, finding variables at given 'perf probe' poi= nt will not work, install elfutils-devel/libdw-dev >=3D 0.157) - else - CFLAGS +=3D -DHAVE_DWARF_GETLOCATIONS_SUPPORT - endif # dwarf_getlocations + CFLAGS +=3D -DHAVE_DWARF_GETLOCATIONS_SUPPORT ifneq ($(feature-dwarf_getcfi), 1) $(warning Old libdw.h, finding variables at given 'perf probe' poi= nt will not work, install elfutils-devel/libdw-dev >=3D 0.142) else --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03C3F175D37 for ; Sat, 5 Oct 2024 19:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158176; cv=none; b=aOV5yF5GKUi1gylidPIhrk7EV/fZVe57ZZglmD/WkcqJV+l8w8KNC+o0nKkM5Ufa8UnHICBKgwldlEPrRIW9/hOdgbUN0HUtGQinLEaDNyy2IMHlzPJIFCSUwm3n5B7NZvN7g5acxBuLv25vCpRSZay1xLq+qsvZUPJjsuI21Ko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158176; c=relaxed/simple; bh=cVIpvRAVS4B/q4rtsfLauVRqeL+8GYFjJpX7gyN/oeo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=GZQ2MHP9pQyqZ3bbCip84dSRvMJc8dBC64saV0tCt6wZ5QVEtON9eusEueO5hOWyjcZTOkHsEBMar+dVMD1+T/fEpMR8Qccsw6LK7taao2SjXzgTsRSDnpFkX4mEG4Ha7AKIj8Hrqsx3uaTyKwOqT7vebEupqvV1kXwFxGW7ZqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wPnmTGC2; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wPnmTGC2" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2261adfdeso53824997b3.2 for ; Sat, 05 Oct 2024 12:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158174; x=1728762974; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=0crp/bMgJAdiK6d8c23KKPaC1XR/kHsld8YeBJQYGmI=; b=wPnmTGC2XHYpBNuIPm6cocnpBXFLyR5Qg7Uj1Ubj7UIKy1WN0psjfFVpZAKVD+O7o6 ASKXAc1znuC71NQ6+sBJ1cfnDwNk/BJ9s7jfSICREVKHQZkUSIB0vO16yb9PAOUncP66 oen6m4yddg+Wt6lb5NoFOZZdWS1O/pkQRzsR9aDiNjN4/wiKW1fY/87WCwE1o0+F6MFQ 2eR7PssOEYZFW9k6qO/eyci5zYm6kuwopkkBhsmeE2vFKIt944zlTcg7E3MYxFVb4acb U1BWAvaUJiZr+SDRQPha2qfqMbO0x1hFrPoF5eNqIg71+gJ7Xc8NjohRKV7RtK47GnPS j20w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158174; x=1728762974; 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=0crp/bMgJAdiK6d8c23KKPaC1XR/kHsld8YeBJQYGmI=; b=qmurPopa43eIhEoLZsibwAqKF6lrdLi0ilzUoth3de5QF3XmL1juplbIUIp+6tMN0E rVKVdAUOeEOla9K6GqJKxREOB8pOQOJg9n/N5ir9xXjlfJ/UaDd9PidAaCZp+ROuaDR9 54znLMKeaF1/E7iFCqeZiGhlhD/+NGg7FyzRekfv4nWD/dxTzjJkUmnXoJ1FVheM219q mp9fJa82OSI/RAOP2B3/MgyPuR4U67eWqtVjj0UXOFW9ctZoinQa06HRlG/Uv1R+B6I2 VH4SVEsBeK2mhFS6i82Cf4Ez8KK3b1/V8JVDRq7r/TQf6TbUM7jwi/CvmarXZmvA0O1u 4z/A== X-Forwarded-Encrypted: i=1; AJvYcCXb7ZWEYb1tm5YQRO3Y0clQLNdUkCJ5hXBuIRBj2nTYaKdNSwh+7qTC/voQPoDCAGRVqFnh95HaR+iDzPI=@vger.kernel.org X-Gm-Message-State: AOJu0YyFh7sTlwWH/J122KGJEsEcpKP2nE0KzWHCBLHSAryo6x+WYpZG +ds84DDrNy8hkw9sH8N3UBOpu33rMNsi13nyz2tlnN6x8piY1kuE1KFe6Z3y/3dk6MycL8mAlJM qPVAtog== X-Google-Smtp-Source: AGHT+IHI0ooHk2TiOSYrZi7ZdasFpBsMC3hc3dHVSPTy4zsPzZ/sjN8Kmzd2OcOEY5SwbjwD0AuHECWj/yIo X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:963:b0:6c1:298e:5a7 with SMTP id 00721157ae682-6e2c72a0f50mr1533337b3.5.1728158174040; Sat, 05 Oct 2024 12:56:14 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:17 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-8-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 07/31] perf build: Combine test-dwarf-getcfi into test-libdw 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" dwarf_getcfi support in libdw is 15 years old. Make libdw imply dwarf_getcfi support and simplify build logic. Signed-off-by: Ian Rogers --- tools/build/Makefile.feature | 1 - tools/build/feature/Makefile | 4 ---- tools/build/feature/test-dwarf_getcfi.c | 9 --------- tools/build/feature/test-libdw.c | 10 +++++++++- tools/perf/Makefile.config | 8 +------- 5 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 tools/build/feature/test-dwarf_getcfi.c diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index cf6a967575ea..ef72aae3dd49 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -31,7 +31,6 @@ endef FEATURE_TESTS_BASIC :=3D \ backtrace \ libdw \ - dwarf_getcfi \ eventfd \ fortify-source \ get_current_dir_name \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 7683d171f744..f94afd522ebb 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -6,7 +6,6 @@ FILES=3D \ test-backtrace.bin \ test-bionic.bin \ test-libdw.bin \ - test-dwarf_getcfi.bin \ test-eventfd.bin \ test-fortify-source.bin \ test-get_current_dir_name.bin \ @@ -184,9 +183,6 @@ endif $(OUTPUT)test-libdw.bin: $(BUILD) $(DWLIBS) =20 -$(OUTPUT)test-dwarf_getcfi.bin: - $(BUILD) $(DWLIBS) - $(OUTPUT)test-libelf-getphdrnum.bin: $(BUILD) -lelf =20 diff --git a/tools/build/feature/test-dwarf_getcfi.c b/tools/build/feature/= test-dwarf_getcfi.c deleted file mode 100644 index 50e7d7cb7bdf..000000000000 --- a/tools/build/feature/test-dwarf_getcfi.c +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include - -int main(void) -{ - Dwarf *dwarf =3D NULL; - return dwarf_getcfi(dwarf) =3D=3D NULL; -} diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-li= bdw.c index 83ea5d5f235d..71c6f8e3b0ee 100644 --- a/tools/build/feature/test-libdw.c +++ b/tools/build/feature/test-libdw.c @@ -34,7 +34,15 @@ int test_libdw_getlocations(void) return (int)dwarf_getlocations(&attr, offset, &base, &start, &end, &op, &= nops); } =20 +int test_libdw_getcfi(void) +{ + Dwarf *dwarf =3D NULL; + + return dwarf_getcfi(dwarf) =3D=3D NULL; +} + int main(void) { - return test_libdw() + test_libdw_unwind() + test_libdw_getlocations(); + return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() + + test_libdw_getcfi(); } diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 903de48c140d..9da0dc001d98 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -161,8 +161,6 @@ ifeq ($(findstring -static,${LDFLAGS}),-static) endif FEATURE_CHECK_CFLAGS-libdw :=3D $(LIBDW_CFLAGS) FEATURE_CHECK_LDFLAGS-libdw :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) -FEATURE_CHECK_CFLAGS-dwarf_getcfi :=3D $(LIBDW_CFLAGS) -FEATURE_CHECK_LDFLAGS-dwarf_getcfi :=3D $(LIBDW_LDFLAGS) $(DWARFLIBS) =20 # for linking with debug library, run like: # make DEBUG=3D1 LIBBABELTRACE_DIR=3D/opt/libbabeltrace/ @@ -467,11 +465,7 @@ else endif else CFLAGS +=3D -DHAVE_DWARF_GETLOCATIONS_SUPPORT - ifneq ($(feature-dwarf_getcfi), 1) - $(warning Old libdw.h, finding variables at given 'perf probe' poi= nt will not work, install elfutils-devel/libdw-dev >=3D 0.142) - else - CFLAGS +=3D -DHAVE_DWARF_CFI_SUPPORT - endif # dwarf_getcfi + CFLAGS +=3D -DHAVE_DWARF_CFI_SUPPORT endif # Dwarf support endif # libelf support endif # NO_LIBELF --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43D79176FA2 for ; Sat, 5 Oct 2024 19:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158178; cv=none; b=ixA4KOdR06FuvWqAaU9ASU1YeDsf49U4klgVqgOB/rGwgCfDtNh0SzgF5SM8M7NU1cRV1KQEvIc7B3ihr98SZUD11nz3vBB9YIzoYN6xz46Chzot1xSxUHIm4Aoz7hwyvpv+gpZmYacP5tAp8vMNp8zKIFt7znb/1ilN77XBShM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158178; c=relaxed/simple; bh=Xn0CrDm+Tw2JEX1Fd/tJd9qqM7XBvfBAuJD2KkaHeq4=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=iJ9+7EGJKDEExclOXECjYOJwHP3ebCnytzLJPFSO3dcdwcKz4JuTA+LdXl8+RwHRSyooeQ/xE9nzd1VjBeqFhTDDZMH+UT9W8yf7e92Fn3mWTL6LmPE3ddHiCmaigJjZauKwEQYTX1Huhc6Kfb11tohqbwJ985rOf20LKtR1PDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=KAjMUXh7; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KAjMUXh7" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e28b624bfcso46835527b3.2 for ; Sat, 05 Oct 2024 12:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158176; x=1728762976; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=fgt0lsBTAjEFCZBom0GI4KzA9aiVHAzByTiPs2bLNH0=; b=KAjMUXh7RUmrU8Ivq6pyXGAJjM16RkHxyJxX5K1nharLKPCg8JqZuxeLjaJlCapsAT FcMVZJNKfdZVjMdulY1gN4wSAxRdEOrr/KvA8VjKiE15lnfomZy0p8q/oTCv5YqnudeZ JHs3QjtbW3XXxIzHpKEgpkE+OmiLZFLamotN5JZWQEt1GWgmjDxh0QN9kF7HsEqy/JnT Wcxb/JhRgFKXR3fwtN2InTbX86fb77iMEtv+1Bgk+Ek3rDGitBbJ+GU61VRe+HZ0iOKT 3SSiVCvjL99yxFHfo+QSB97wwK92BIAIdE1SwIlvX/dusvL0XFFDmu9MhjgeqgCNKm6H /rqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158176; x=1728762976; 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=fgt0lsBTAjEFCZBom0GI4KzA9aiVHAzByTiPs2bLNH0=; b=eTSqa1xULm0GS6jR1U8zURgz+dreXIEbeoQg7vhZqv1/TOnfY3kSu8lIKQSoWxekln O6CnJj/C7Hi/70nA+k44aGrOG5wmOor8/EtT9gkoKt5ezEX7P2zFjyXruPQwssX7SNE/ Tz9Q+Vj2qj2G1/AWMVaNA6uRT3a6jpm8W78oOk6iNtry1QceZU8pMxvarQszZAVkUmXY qMtEj/8/liUyIXcfDMwK2HjMvx6vd8+StwsOTMbbeVhFG+JUlw9A1Xbn5+nt3SFacIjZ Lu94tcDsNxTGMtpra/6Lyocj8GINKaCeeKcfjbepZzVIZ3vQWeJ5GFn00vjdYeeKbuTt HRaQ== X-Forwarded-Encrypted: i=1; AJvYcCXdIKMASbY85Cyt0Y0tmTWIElSr4xXYtWVQnA0RNQ/iAnzDTfH0/N/15Wh/y8/DFj1uohE028z0n4e2dAo=@vger.kernel.org X-Gm-Message-State: AOJu0Yxyvmq8AVvru1d4kfFpuoaY4H5Jk448x6IsMPx0tn8p2uC+cJ/u GYMBu68cUhmVokn31CJBOcP/NxCFDgve8cSJAcD1n7pneH4iRqWywztGELMjJZwOv36eUJveqxZ 4DFta8w== X-Google-Smtp-Source: AGHT+IFA6H6s3G571F/veS3qfEggY+9ZaK9DeEUkrcK8nWDGOpnAk500UyqK+1gwSyAo/S2IwW08+pvNJZfj X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a81:ad1a:0:b0:62d:1142:83a5 with SMTP id 00721157ae682-6e2c72a6f27mr784467b3.8.1728158176294; Sat, 05 Oct 2024 12:56:16 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:18 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-9-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 08/31] perf probe: Move elfutils support check to libdw check 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The test _ELFUTILS_PREREQ(0, 142) is false for elfutils before 2009-06-13, but that is 15 years ago and very unlikely. Add a test to test-libdw.c and assume the libdw version is at least 0.142 to simplify the build logic. Signed-off-by: Ian Rogers --- tools/build/feature/test-libdw.c | 10 +++++++++- tools/perf/util/probe-finder.c | 2 -- tools/perf/util/probe-finder.h | 2 -- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/build/feature/test-libdw.c b/tools/build/feature/test-li= bdw.c index 71c6f8e3b0ee..2fb59479ab77 100644 --- a/tools/build/feature/test-libdw.c +++ b/tools/build/feature/test-libdw.c @@ -41,8 +41,16 @@ int test_libdw_getcfi(void) return dwarf_getcfi(dwarf) =3D=3D NULL; } =20 +int test_elfutils(void) +{ + Dwarf_CFI *cfi =3D NULL; + + dwarf_cfi_end(cfi); + return 0; +} + int main(void) { return test_libdw() + test_libdw_unwind() + test_libdw_getlocations() + - test_libdw_getcfi(); + test_libdw_getcfi() + test_elfutils(); } diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 78f34fa0c391..7434b38596b9 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1379,10 +1379,8 @@ int debuginfo__find_trace_events(struct debuginfo *d= bg, if (ret >=3D 0 && tf.pf.skip_empty_arg) ret =3D fill_empty_trace_arg(pev, tf.tevs, tf.ntevs); =20 -#if _ELFUTILS_PREREQ(0, 142) dwarf_cfi_end(tf.pf.cfi_eh); dwarf_cfi_end(tf.pf.cfi_dbg); -#endif =20 if (ret < 0 || tf.ntevs =3D=3D 0) { for (i =3D 0; i < tf.ntevs; i++) diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 3add5ff516e1..f0149d72310c 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -63,12 +63,10 @@ struct probe_finder { struct intlist *lcache; /* Line cache for lazy match */ =20 /* For variable searching */ -#if _ELFUTILS_PREREQ(0, 142) /* Call Frame Information from .eh_frame */ Dwarf_CFI *cfi_eh; /* Call Frame Information from .debug_frame */ Dwarf_CFI *cfi_dbg; -#endif Dwarf_Op *fb_ops; /* Frame base attribute */ unsigned int machine; /* Target machine arch */ struct perf_probe_arg *pvar; /* Current target variable */ --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5662E17A5AA for ; Sat, 5 Oct 2024 19:56:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158181; cv=none; b=dnDkGAAcqrSktwd3CpLhApOygPPFKgxQ38RcX34rGfzjEjCQe8JLnYIpIaBfCmcStxCBRC9LxHiiv5uHjonVL4KauulaFHOf/p9k+I2dxAIARaIWQZdFNA/eIoj0845jP/fP9WvlkuKeOTnhfcM24aHDqvJn9Fwi07N3OhV1im0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158181; c=relaxed/simple; bh=rd5OH3zo/sMQnJKPHEmT9+R4YKaQUgSkC2m+LM/rhFI=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=UPlNd889/jrPRxxbU9LBBWzx8FxDgRxWts3bC5DTs/FZDmpU+DEoY6vV09lghMbR3OUV11jZsBcWqt3M02Rj7Y8PwUMSfshO3+OgY4UZKihVS5JV6Bw2G6Gd4k182/HJ2KnLO5gaJg3J4aOFvZE5qDlGyLvcq5cra0VTdRouSjg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FjFKNXvy; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FjFKNXvy" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e251ba2243so39668337b3.1 for ; Sat, 05 Oct 2024 12:56:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158178; x=1728762978; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=YzgTBbpwVzkG0qTRW8O8JNshM/vLbNIleJGInfgSbFs=; b=FjFKNXvy1JElqnob8dBo+h5T6xm5jiB6kxBqisj9bL9O6gXoCWPWbOItxjj8Dy+gT/ /gwrtViYCD6IZMe6n055fNYjnmL8Z+aJk8J8R8TZKBxGFo/s2d9A/pBNi2eGPc4nqzp1 ujz3H2WwsV25wqIcTZxOw+0J/2+AJba3BSM1GhxdYKDmQMHaaArNHrU2vqMdAHbnQlc6 d2Zdezq3NXwdIW2phDgGeb6fdjymLumMcwsZuY7LPcIs43ea5F6yvKeKey1OwZESEpdj Vk9xDz1EFibF021GpwpuH5I07XNyKEs36dijMuLhT65+calimiTmxcHguxKkduRhna2r Wgpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158178; x=1728762978; 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=YzgTBbpwVzkG0qTRW8O8JNshM/vLbNIleJGInfgSbFs=; b=U1fDT7Sw0h96C08pg+csQc3LpkU3Aa1+P9W8LtRr+tBBCRH4IlVAl7288PO7d9sGLQ 5pFc2rJ1tZWo5lIAkv+xgRvsng02qnrILbso+Kt0eIr20CU3bna4SzTBF/8Ne/suxm25 VUqVertbUg5O5CIO7hg0dq1C/2bgXMjMiHR0ae7QpR0rR6UXpCfpYLc/tvk4a8Bw24u+ pUnwpAWrH5gkgGusisUvUtWhaig/HoHAW51nRLwaUVIrCBw5RNsZjzKW0Fm81IFGtEb0 baDSgqeDWqwErYvD3cjy7piBqYTBZcsAfiaR7GDxMmkh4Il+n4fYiLtA17Vt8fwlC3iF Sovg== X-Forwarded-Encrypted: i=1; AJvYcCUHeeXAOa1Zcfq5f4M9gbNt0qIcC5PXODaPffNWX7740mVEVYCmRTbMwgkuV8lZ+WJXfiQ/4Syf/mnE/0g=@vger.kernel.org X-Gm-Message-State: AOJu0YxoJ9DkfiaSIT0qb1+cn2uB0h/b7k4L3lXG5mtm7EHiNX9GVhI5 zewu8vyQpbR51HOgfl+LevSxnCjj3Q17UCGdWnJq2fTQIOA1KjCrQi1XmK3S1/ITNrHNYcuj/57 IIC9Pqg== X-Google-Smtp-Source: AGHT+IGiHdIsXBVB+WoPzuiIQsbR1+hzUkQk2RxCJMDxpuguCdw6JxvAyilmRvkhQaU4Z/U38KgUOt+3RklD X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:6683:b0:6be:523:af53 with SMTP id 00721157ae682-6e2b53d68cemr3650767b3.3.1728158178502; Sat, 05 Oct 2024 12:56:18 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:19 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-10-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 09/31] perf libdw: Remove unnecessary 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As HAVE_DWARF_GETLOCATIONS_SUPPORT and HAVE_DWARF_CFI_SUPPORT always match HAVE_DWARF_SUPPORT remove the macros and use HAVE_DWARF_SUPPORT. If building the file is guarded by CONFIG_DWARF then remove all ifs. Signed-off-by: Ian Rogers --- tools/perf/Documentation/perf-check.txt | 2 +- tools/perf/Makefile.config | 3 -- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-check.c | 2 +- tools/perf/builtin-report.c | 2 +- tools/perf/util/dwarf-aux.c | 6 --- tools/perf/util/dwarf-aux.h | 54 ------------------------- tools/perf/util/probe-finder.c | 4 -- 8 files changed, 4 insertions(+), 71 deletions(-) diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documenta= tion/perf-check.txt index 10f69fb6850b..45101a8e4154 100644 --- a/tools/perf/Documentation/perf-check.txt +++ b/tools/perf/Documentation/perf-check.txt @@ -48,7 +48,7 @@ feature:: bpf_skeletons / HAVE_BPF_SKEL debuginfod / HAVE_DEBUGINFOD_SUPPORT dwarf / HAVE_DWARF_SUPPORT - dwarf_getlocations / HAVE_DWARF_GETLOCATIONS_SUPPORT + dwarf_getlocations / HAVE_DWARF_SUPPORT dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT auxtrace / HAVE_AUXTRACE_SUPPORT libaudit / HAVE_LIBAUDIT_SUPPORT diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 9da0dc001d98..db79b25ada6f 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -463,9 +463,6 @@ else $(warning No libdw.h found or old libdw.h found or elfutils is old= er than 0.157, disables dwarf support. Please install new elfutils-devel/li= bdw-dev) NO_LIBDW :=3D 1 endif - else - CFLAGS +=3D -DHAVE_DWARF_GETLOCATIONS_SUPPORT - CFLAGS +=3D -DHAVE_DWARF_CFI_SUPPORT endif # Dwarf support endif # libelf support endif # NO_LIBELF diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 3dc6197ef3fa..04af13eb4a4c 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -840,7 +840,7 @@ int cmd_annotate(int argc, const char **argv) } #endif =20 -#ifndef HAVE_DWARF_GETLOCATIONS_SUPPORT +#ifndef HAVE_DWARF_SUPPORT if (annotate.data_type) { pr_err("Error: Data type profiling is disabled due to missing DWARF supp= ort\n"); return -ENOTSUP; diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c index 0b76b6e42b78..18c0a815243b 100644 --- a/tools/perf/builtin-check.c +++ b/tools/perf/builtin-check.c @@ -28,7 +28,7 @@ struct feature_status supported_features[] =3D { FEATURE_STATUS("bpf_skeletons", HAVE_BPF_SKEL), FEATURE_STATUS("debuginfod", HAVE_DEBUGINFOD_SUPPORT), FEATURE_STATUS("dwarf", HAVE_DWARF_SUPPORT), - FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_GETLOCATIONS_SUPPORT), + FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_SUPPORT), FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT), FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT), FEATURE_STATUS("libaudit", HAVE_LIBAUDIT_SUPPORT), diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 5dc17ffee27a..426cbc9110d1 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -1701,7 +1701,7 @@ int cmd_report(int argc, const char **argv) report.data_type =3D true; annotate_opts.annotate_src =3D false; =20 -#ifndef HAVE_DWARF_GETLOCATIONS_SUPPORT +#ifndef HAVE_DWARF_SUPPORT pr_err("Error: Data type profiling is disabled due to missing DWARF supp= ort\n"); goto error; #endif diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c index 92eb9c8dc3e5..559c953ca172 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c @@ -1182,7 +1182,6 @@ int die_get_varname(Dwarf_Die *vr_die, struct strbuf = *buf) return ret < 0 ? ret : strbuf_addf(buf, "\t%s", dwarf_diename(vr_die)); } =20 -#if defined(HAVE_DWARF_GETLOCATIONS_SUPPORT) || defined(HAVE_DWARF_CFI_SUP= PORT) static int reg_from_dwarf_op(Dwarf_Op *op) { switch (op->atom) { @@ -1245,9 +1244,7 @@ static bool check_allowed_ops(Dwarf_Op *ops, size_t n= ops) } return true; } -#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT || HAVE_DWARF_CFI_SUPPORT */ =20 -#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT /** * die_get_var_innermost_scope - Get innermost scope range of given variab= le DIE * @sp_die: a subprogram DIE @@ -1697,9 +1694,7 @@ void die_collect_global_vars(Dwarf_Die *cu_die, struc= t die_var_type **var_types) =20 die_find_child(cu_die, __die_collect_global_vars_cb, (void *)var_types, &= die_mem); } -#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */ =20 -#ifdef HAVE_DWARF_CFI_SUPPORT /** * die_get_cfa - Get frame base information * @dwarf: a Dwarf info @@ -1732,7 +1727,6 @@ int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int = *poffset) } return -1; } -#endif /* HAVE_DWARF_CFI_SUPPORT */ =20 /* * die_has_loclist - Check if DW_AT_location of @vr_die is a location list diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h index 925a9bb9fb15..892c8c5c23fc 100644 --- a/tools/perf/util/dwarf-aux.h +++ b/tools/perf/util/dwarf-aux.h @@ -156,8 +156,6 @@ Dwarf_Die *die_get_member_type(Dwarf_Die *type_die, int= offset, Dwarf_Die *die_m /* Return type info where the pointer and offset point to */ Dwarf_Die *die_deref_ptr_type(Dwarf_Die *ptr_die, int offset, Dwarf_Die *d= ie_mem); =20 -#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT - /* Get byte offset range of given variable DIE */ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf = *buf); =20 @@ -176,59 +174,7 @@ void die_collect_vars(Dwarf_Die *sc_die, struct die_va= r_type **var_types); /* Save all global variables in this CU */ void die_collect_global_vars(Dwarf_Die *cu_die, struct die_var_type **var_= types); =20 -#else /* HAVE_DWARF_GETLOCATIONS_SUPPORT */ -#include - -static inline int die_get_var_range(Dwarf_Die *sp_die __maybe_unused, - Dwarf_Die *vr_die __maybe_unused, - struct strbuf *buf __maybe_unused) -{ - return -ENOTSUP; -} - -static inline Dwarf_Die *die_find_variable_by_reg(Dwarf_Die *sc_die __mayb= e_unused, - Dwarf_Addr pc __maybe_unused, - int reg __maybe_unused, - int *poffset __maybe_unused, - bool is_fbreg __maybe_unused, - Dwarf_Die *die_mem __maybe_unused) -{ - return NULL; -} - -static inline Dwarf_Die *die_find_variable_by_addr(Dwarf_Die *sc_die __may= be_unused, - Dwarf_Addr addr __maybe_unused, - Dwarf_Die *die_mem __maybe_unused, - int *offset __maybe_unused) -{ - return NULL; -} - -static inline void die_collect_vars(Dwarf_Die *sc_die __maybe_unused, - struct die_var_type **var_types __maybe_unused) -{ -} - -static inline void die_collect_global_vars(Dwarf_Die *cu_die __maybe_unuse= d, - struct die_var_type **var_types __maybe_unused) -{ -} - -#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */ - -#ifdef HAVE_DWARF_CFI_SUPPORT - /* Get the frame base information from CFA */ int die_get_cfa(Dwarf *dwarf, u64 pc, int *preg, int *poffset); =20 -#else /* HAVE_DWARF_CFI_SUPPORT */ - -static inline int die_get_cfa(Dwarf *dwarf __maybe_unused, u64 pc __maybe_= unused, - int *preg __maybe_unused, int *poffset __maybe_unused) -{ - return -1; -} - -#endif /* HAVE_DWARF_CFI_SUPPORT */ - #endif /* _DWARF_AUX_H */ diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 7434b38596b9..8019d232f515 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -602,7 +602,6 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct = probe_finder *pf) ret =3D dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1); if (ret <=3D 0 || nops =3D=3D 0) { pf->fb_ops =3D NULL; -#ifdef HAVE_DWARF_CFI_SUPPORT } else if (nops =3D=3D 1 && pf->fb_ops[0].atom =3D=3D DW_OP_call_frame_cf= a && (pf->cfi_eh !=3D NULL || pf->cfi_dbg !=3D NULL)) { if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) !=3D 0 && @@ -613,7 +612,6 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct = probe_finder *pf) free(frame); return -ENOENT; } -#endif /* HAVE_DWARF_CFI_SUPPORT */ } =20 /* Call finder's callback handler */ @@ -1138,7 +1136,6 @@ static int debuginfo__find_probes(struct debuginfo *d= bg, =20 pf->machine =3D ehdr.e_machine; =20 -#ifdef HAVE_DWARF_CFI_SUPPORT do { GElf_Shdr shdr; =20 @@ -1148,7 +1145,6 @@ static int debuginfo__find_probes(struct debuginfo *d= bg, =20 pf->cfi_dbg =3D dwarf_getcfi(dbg->dbg); } while (0); -#endif /* HAVE_DWARF_CFI_SUPPORT */ =20 ret =3D debuginfo__find_probe_location(dbg, pf); return ret; --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0B9317A5B5 for ; Sat, 5 Oct 2024 19:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158183; cv=none; b=V3ZXoWBxiiwh0a0fLehCyFCd/ZoiMZ4KkeZUiVa/CuSY2wTRj74/QJUWb/0fC/Id0VbCMgRdiVLG5MQhvC9YpyRfYpL+hCuloxMRyp27MhX/0nkBNF8lVlwf+SQaz/erkWoi8Grl+lobBt6DQ/j93kHlog+bKHs5yNfwNE2xBa8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158183; c=relaxed/simple; bh=CRvvf13d3q83pWTqjfT6czVP0IY2S+zPjy6zwF2yPMs=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=a4EC5I93O0/f9W+DJftOZo0hSoEZb975GEDbqHhDf1P+EocyL2zb3Myj8QCxinnbovx7WzWDwJIK2KFyoYjVmGmxNN7rtMMWeucaCHU8hSQH+rJDHhm5UYFm6DIJrdQbI79j4Uk3PTdw0raRkNDsYQE7Hn45779qoyxxiu7TTuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=lMaZqdhl; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lMaZqdhl" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e0353b731b8so4310347276.2 for ; Sat, 05 Oct 2024 12:56:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158181; x=1728762981; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=2weo1u6eJab13hudlOmWRO+RLXcMfS57bPP8mqYQr4Q=; b=lMaZqdhltBX6pR8kLB75QRMUdqiYCTOX5qGgN1N0W6IIRAxflY/in2MTVoS84I5AfA rmSqJvl6A7IUucJLrgS+pheB5YA4ZABjUvvj906gyxiYj5W2hKS9+GvdIvAgNTeUaCeR hRKhi4UjzUGn/UzsBphTRxQbIUVfQxgjLLmkJ3VLdUks4k9cwrMBXIG29GqvGH/i2QKs kOUpkaxtJdjmzZaO72rgVduTtxHx1kvyrvD6nlRVj5Ad2/weabWY6pJFKwmGo9kUu+rx AC84PqocXZ8R3TcnLHZtjYLwSs6uWX8psICPabSgpRBFmCEUBWEhsDAXkWbaRuG40ryp ODkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158181; x=1728762981; 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=2weo1u6eJab13hudlOmWRO+RLXcMfS57bPP8mqYQr4Q=; b=j1wKe9wpJUbK0m7KSSQ8UyX0fI5f+oOHUlX0o8+Rd7qGOOwRV3/N1UixXB9Gn6tMVY d4yWpr1OPcUmuOHJLO9tstHBk90lRDczu9S21MEOrqSyAoRBfH2n3olew9xRA70GfiDx ddOrZp49uvEOHEzDxSW8yaBDF35HNdj7EorV7tHdl7lXfN3i8GoPz9FrhN5+oUqhnR5v zeNHR+O0FyehMqOsplTBCKe4GEf2GPRJ4szmU8UvS/8zmK4oxgvkXC32dVFkWzOofAkd b39Qi13GMd4Mhfg1X8pWPc2wR4rZrRlKPwKDUyNX2SqW81BKN8Kj5rNt8kAbOnmADPBC ir/A== X-Forwarded-Encrypted: i=1; AJvYcCUGQ5QLkzpcJIfku+2bd6UDcZAsiqYPSxjB0c772g14XQboehHUEz4WlbydQeA8anSRcwaRpCCtmBCBVWo=@vger.kernel.org X-Gm-Message-State: AOJu0YwECWfsEDi+eHHLA66oQNL9dF59cXWgZdiE79kZOYdBBoHdzD64 xHySnHu7zXM3YUI8fxlmGRNuCjoyEquuyv7AiiitwLYLzxlstT8VmYhBfU2p8Kqsq7Wykisbd4E Jl3yC8A== X-Google-Smtp-Source: AGHT+IGTVKp5glYfe2LcW/QBGKVgQh88dtHx+qbHTcL04F4exiXlFCRXn1VDeNIb6C1tqNw4F+4YBmNj+fNW X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:c54e:0:b0:e25:17cb:352e with SMTP id 3f1490d57ef6-e2893939e1cmr3895276.9.1728158180743; Sat, 05 Oct 2024 12:56:20 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:20 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-11-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 10/31] perf build: Rename HAVE_DWARF_SUPPORT to HAVE_LIBDW_SUPPORT 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In Makefile.config for unwinding the name dwarf implies either libunwind or libdw. Make it clearer that HAVE_DWARF_SUPPORT is really just defined when libdw is present by renaming to HAVE_LIBDW_SUPPORT. Signed-off-by: Ian Rogers --- tools/perf/Documentation/perf-check.txt | 6 +++--- tools/perf/Makefile.config | 2 +- tools/perf/arch/powerpc/annotate/instructions.c | 4 ++-- tools/perf/arch/x86/annotate/instructions.c | 2 +- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-check.c | 6 +++--- tools/perf/builtin-probe.c | 12 ++++++------ tools/perf/builtin-report.c | 4 ++-- tools/perf/util/annotate-data.h | 8 ++++---- tools/perf/util/debuginfo.h | 6 +++--- tools/perf/util/disasm.c | 4 ++-- tools/perf/util/disasm.h | 4 ++-- tools/perf/util/genelf.c | 4 ++-- tools/perf/util/genelf.h | 2 +- tools/perf/util/include/dwarf-regs.h | 6 +++--- tools/perf/util/probe-event.c | 4 ++-- tools/perf/util/probe-finder.h | 4 ++-- 17 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tools/perf/Documentation/perf-check.txt b/tools/perf/Documenta= tion/perf-check.txt index 45101a8e4154..31741499e786 100644 --- a/tools/perf/Documentation/perf-check.txt +++ b/tools/perf/Documentation/perf-check.txt @@ -47,15 +47,15 @@ feature:: bpf / HAVE_LIBBPF_SUPPORT bpf_skeletons / HAVE_BPF_SKEL debuginfod / HAVE_DEBUGINFOD_SUPPORT - dwarf / HAVE_DWARF_SUPPORT - dwarf_getlocations / HAVE_DWARF_SUPPORT + dwarf / HAVE_LIBDW_SUPPORT + dwarf_getlocations / HAVE_LIBDW_SUPPORT dwarf-unwind / HAVE_DWARF_UNWIND_SUPPORT auxtrace / HAVE_AUXTRACE_SUPPORT libaudit / HAVE_LIBAUDIT_SUPPORT libbfd / HAVE_LIBBFD_SUPPORT libcapstone / HAVE_LIBCAPSTONE_SUPPORT libcrypto / HAVE_LIBCRYPTO_SUPPORT - libdw-dwarf-unwind / HAVE_DWARF_SUPPORT + libdw-dwarf-unwind / HAVE_LIBDW_SUPPORT libelf / HAVE_LIBELF_SUPPORT libnuma / HAVE_LIBNUMA_SUPPORT libopencsd / HAVE_CSTRACE_SUPPORT diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index db79b25ada6f..9ed0909db170 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -556,7 +556,7 @@ ifndef NO_LIBELF $(warning DWARF register mappings have not been defined for architec= ture $(SRCARCH), DWARF support disabled) NO_LIBDW :=3D 1 else - CFLAGS +=3D -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) + CFLAGS +=3D -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) LDFLAGS +=3D $(LIBDW_LDFLAGS) EXTLIBS +=3D ${DWARFLIBS} $(call detected,CONFIG_DWARF) diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/a= rch/powerpc/annotate/instructions.c index ede9eeade0ab..54478cf5cccc 100644 --- a/tools/perf/arch/powerpc/annotate/instructions.c +++ b/tools/perf/arch/powerpc/annotate/instructions.c @@ -255,7 +255,7 @@ static struct ins_ops *check_ppc_insn(struct disasm_lin= e *dl) * is moved to r31. update_insn_state_powerpc tracks these state * changes */ -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT static void update_insn_state_powerpc(struct type_state *state, struct data_loc_info *dloc, Dwarf_Die * cu_die __maybe_unused, struct disasm_line *dl) @@ -300,7 +300,7 @@ static void update_insn_state_powerpc(struct type_state= *state, insn_offset, src->reg1, dst->reg1); pr_debug_type_name(&tsr->type, tsr->kind); } -#endif /* HAVE_DWARF_SUPPORT */ +#endif /* HAVE_LIBDW_SUPPORT */ =20 static int powerpc__annotate_init(struct arch *arch, char *cpuid __maybe_u= nused) { diff --git a/tools/perf/arch/x86/annotate/instructions.c b/tools/perf/arch/= x86/annotate/instructions.c index 5caf5a17f03d..c869abe3c31d 100644 --- a/tools/perf/arch/x86/annotate/instructions.c +++ b/tools/perf/arch/x86/annotate/instructions.c @@ -207,7 +207,7 @@ static int x86__annotate_init(struct arch *arch, char *= cpuid) return err; } =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT static void update_insn_state_x86(struct type_state *state, struct data_loc_info *dloc, Dwarf_Die *cu_die, struct disasm_line *dl) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 04af13eb4a4c..bb87e6e7687d 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -840,7 +840,7 @@ int cmd_annotate(int argc, const char **argv) } #endif =20 -#ifndef HAVE_DWARF_SUPPORT +#ifndef HAVE_LIBDW_SUPPORT if (annotate.data_type) { pr_err("Error: Data type profiling is disabled due to missing DWARF supp= ort\n"); return -ENOTSUP; diff --git a/tools/perf/builtin-check.c b/tools/perf/builtin-check.c index 18c0a815243b..2346536a5ee1 100644 --- a/tools/perf/builtin-check.c +++ b/tools/perf/builtin-check.c @@ -27,15 +27,15 @@ struct feature_status supported_features[] =3D { FEATURE_STATUS("bpf", HAVE_LIBBPF_SUPPORT), FEATURE_STATUS("bpf_skeletons", HAVE_BPF_SKEL), FEATURE_STATUS("debuginfod", HAVE_DEBUGINFOD_SUPPORT), - FEATURE_STATUS("dwarf", HAVE_DWARF_SUPPORT), - FEATURE_STATUS("dwarf_getlocations", HAVE_DWARF_SUPPORT), + FEATURE_STATUS("dwarf", HAVE_LIBDW_SUPPORT), + FEATURE_STATUS("dwarf_getlocations", HAVE_LIBDW_SUPPORT), FEATURE_STATUS("dwarf-unwind", HAVE_DWARF_UNWIND_SUPPORT), FEATURE_STATUS("auxtrace", HAVE_AUXTRACE_SUPPORT), FEATURE_STATUS("libaudit", HAVE_LIBAUDIT_SUPPORT), FEATURE_STATUS("libbfd", HAVE_LIBBFD_SUPPORT), FEATURE_STATUS("libcapstone", HAVE_LIBCAPSTONE_SUPPORT), FEATURE_STATUS("libcrypto", HAVE_LIBCRYPTO_SUPPORT), - FEATURE_STATUS("libdw-dwarf-unwind", HAVE_DWARF_SUPPORT), + FEATURE_STATUS("libdw-dwarf-unwind", HAVE_LIBDW_SUPPORT), FEATURE_STATUS("libelf", HAVE_LIBELF_SUPPORT), FEATURE_STATUS("libnuma", HAVE_LIBNUMA_SUPPORT), FEATURE_STATUS("libopencsd", HAVE_CSTRACE_SUPPORT), diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 91672bb3047c..69800e4d9530 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -229,7 +229,7 @@ static int opt_set_target_ns(const struct option *opt _= _maybe_unused, =20 /* Command option callbacks */ =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT static int opt_show_lines(const struct option *opt, const char *str, int unset __maybe_unused) { @@ -505,7 +505,7 @@ static int perf_del_probe_events(struct strfilter *filt= er) return ret; } =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT #define PROBEDEF_STR \ "[EVENT=3D]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT [[NAME=3D]ARG .= ..]" #else @@ -521,7 +521,7 @@ __cmd_probe(int argc, const char **argv) "perf probe [] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", "perf probe [] --del '[GROUP:]EVENT' ...", "perf probe --list [GROUP:]EVENT ...", -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT "perf probe [] --line 'LINEDESC'", "perf probe [] --vars 'PROBEPOINT'", #endif @@ -545,7 +545,7 @@ __cmd_probe(int argc, const char **argv) "\t\tFUNC:\tFunction name\n" "\t\tOFF:\tOffset from function entry (in byte)\n" "\t\t%return:\tPut the probe at function return\n" -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT "\t\tSRC:\tSource code path\n" "\t\tRL:\tRelative line number from function entry.\n" "\t\tAL:\tAbsolute line number in file.\n" @@ -612,7 +612,7 @@ __cmd_probe(int argc, const char **argv) set_option_flag(options, 'd', "del", PARSE_OPT_EXCLUSIVE); set_option_flag(options, 'D', "definition", PARSE_OPT_EXCLUSIVE); set_option_flag(options, 'l', "list", PARSE_OPT_EXCLUSIVE); -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT set_option_flag(options, 'L', "line", PARSE_OPT_EXCLUSIVE); set_option_flag(options, 'V', "vars", PARSE_OPT_EXCLUSIVE); #else @@ -694,7 +694,7 @@ __cmd_probe(int argc, const char **argv) if (ret < 0) pr_err_with_code(" Error: Failed to show functions.", ret); return ret; -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT case 'L': ret =3D show_line_range(¶ms->line_range, params->target, params->nsi, params->uprobes); diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 426cbc9110d1..13cc57e99d35 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -455,7 +455,7 @@ static int report__setup_sample_type(struct report *rep) if (!(evlist__combined_branch_type(session->evlist) & PERF_SAMPLE_BRANCH_= ANY)) rep->nonany_branch_mode =3D true; =20 -#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_DWARF_SUPPORT) +#if !defined(HAVE_LIBUNWIND_SUPPORT) && !defined(HAVE_LIBDW_SUPPORT) if (dwarf_callchain_users) { ui__warning("Please install libunwind or libdw " "development packages during the perf build.\n"); @@ -1701,7 +1701,7 @@ int cmd_report(int argc, const char **argv) report.data_type =3D true; annotate_opts.annotate_src =3D false; =20 -#ifndef HAVE_DWARF_SUPPORT +#ifndef HAVE_LIBDW_SUPPORT pr_err("Error: Data type profiling is disabled due to missing DWARF supp= ort\n"); goto error; #endif diff --git a/tools/perf/util/annotate-data.h b/tools/perf/util/annotate-dat= a.h index 8ac0fd94a0ba..98c80b2268dd 100644 --- a/tools/perf/util/annotate-data.h +++ b/tools/perf/util/annotate-data.h @@ -9,7 +9,7 @@ #include "dwarf-regs.h" #include "annotate.h" =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT #include "debuginfo.h" #endif =20 @@ -165,7 +165,7 @@ struct annotated_data_stat { }; extern struct annotated_data_stat ann_data_stat; =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT /* * Type information in a register, valid when @ok is true. * The @caller_saved registers are invalidated after a function call. @@ -244,7 +244,7 @@ bool get_global_var_info(struct data_loc_info *dloc, u6= 4 addr, const char **var_name, int *var_offset); void pr_debug_type_name(Dwarf_Die *die, enum type_state_kind kind); =20 -#else /* HAVE_DWARF_SUPPORT */ +#else /* HAVE_LIBDW_SUPPORT */ =20 static inline struct annotated_data_type * find_data_type(struct data_loc_info *dloc __maybe_unused) @@ -276,7 +276,7 @@ static inline int hist_entry__annotate_data_tty(struct = hist_entry *he __maybe_un return -1; } =20 -#endif /* HAVE_DWARF_SUPPORT */ +#endif /* HAVE_LIBDW_SUPPORT */ =20 #ifdef HAVE_SLANG_SUPPORT int hist_entry__annotate_data_tui(struct hist_entry *he, struct evsel *evs= el, diff --git a/tools/perf/util/debuginfo.h b/tools/perf/util/debuginfo.h index ad6422c3f8ca..a52d69932815 100644 --- a/tools/perf/util/debuginfo.h +++ b/tools/perf/util/debuginfo.h @@ -5,7 +5,7 @@ #include #include =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT =20 #include "dwarf-aux.h" =20 @@ -25,7 +25,7 @@ void debuginfo__delete(struct debuginfo *dbg); int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs, bool adjust_offset); =20 -#else /* HAVE_DWARF_SUPPORT */ +#else /* HAVE_LIBDW_SUPPORT */ =20 /* dummy debug information structure */ struct debuginfo { @@ -49,7 +49,7 @@ static inline int debuginfo__get_text_offset(struct debug= info *dbg __maybe_unuse return -EINVAL; } =20 -#endif /* HAVE_DWARF_SUPPORT */ +#endif /* HAVE_LIBDW_SUPPORT */ =20 #ifdef HAVE_DEBUGINFOD_SUPPORT int get_source_from_debuginfod(const char *raw_path, const char *sbuild_id, diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c index 2c8063660f2e..aef06a36bf40 100644 --- a/tools/perf/util/disasm.c +++ b/tools/perf/util/disasm.c @@ -151,14 +151,14 @@ static struct arch architectures[] =3D { .memory_ref_char =3D '(', .imm_char =3D '$', }, -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT .update_insn_state =3D update_insn_state_x86, #endif }, { .name =3D "powerpc", .init =3D powerpc__annotate_init, -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT .update_insn_state =3D update_insn_state_powerpc, #endif }, diff --git a/tools/perf/util/disasm.h b/tools/perf/util/disasm.h index f56beedeb9da..486c269b29ba 100644 --- a/tools/perf/util/disasm.h +++ b/tools/perf/util/disasm.h @@ -4,7 +4,7 @@ =20 #include "map_symbol.h" =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT #include "dwarf-aux.h" #endif =20 @@ -39,7 +39,7 @@ struct arch { char memory_ref_char; char imm_char; } objdump; -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT void (*update_insn_state)(struct type_state *state, struct data_loc_info *dloc, Dwarf_Die *cu_die, struct disasm_line *dl); diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index c8f6bee1fa61..cdce7f173d00 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c @@ -16,7 +16,7 @@ #include #include #include -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT #include #endif =20 @@ -499,7 +499,7 @@ jit_write_elf(int fd, uint64_t load_addr, const char *s= ym, shdr->sh_size =3D sizeof(bnote); shdr->sh_entsize =3D 0; =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT if (debug && nr_debug_entries) { retval =3D jit_add_debug_info(e, load_addr, debug, nr_debug_entries); if (retval) diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h index 4e2e4f40e134..9f0b875d6548 100644 --- a/tools/perf/util/genelf.h +++ b/tools/perf/util/genelf.h @@ -8,7 +8,7 @@ int jit_write_elf(int fd, uint64_t code_addr, const char *sym, const void *code, int csize, void *debug, int nr_debug_entries, void *unwinding, uint64_t unwinding_header_size, uint64_t unwinding_si= ze); -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT /* genelf_debug.c */ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_deb= ug_entries); #endif diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include= /dwarf-regs.h index 75b28dcc8317..29a7d0546b82 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -6,7 +6,7 @@ #define DWARF_REG_PC 0xd3af9c /* random number */ #define DWARF_REG_FB 0xd3affb /* random number */ =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT const char *get_arch_regstr(unsigned int n); /* * get_dwarf_regstr - Returns ftrace register string from DWARF regnum @@ -23,7 +23,7 @@ int get_arch_regnum(const char *name); */ int get_dwarf_regnum(const char *name, unsigned int machine); =20 -#else /* HAVE_DWARF_SUPPORT */ +#else /* HAVE_LIBDW_SUPPORT */ =20 static inline int get_dwarf_regnum(const char *name __maybe_unused, unsigned int machine __maybe_unused) @@ -32,7 +32,7 @@ static inline int get_dwarf_regnum(const char *name __may= be_unused, } #endif =20 -#if !defined(__powerpc__) || !defined(HAVE_DWARF_SUPPORT) +#if !defined(__powerpc__) || !defined(HAVE_LIBDW_SUPPORT) static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_so= urce __maybe_unused, struct annotated_op_loc *op_loc __maybe_unused) { diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index a17c9b8a7a79..fd94614a4022 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -342,7 +342,7 @@ static char *find_module_name(const char *module) return mod_name; } =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT =20 static int kernel_get_module_dso(const char *module, struct dso **pdso) { @@ -1250,7 +1250,7 @@ int show_available_vars(struct perf_probe_event *pevs= , int npevs, return ret; } =20 -#else /* !HAVE_DWARF_SUPPORT */ +#else /* !HAVE_LIBDW_SUPPORT */ =20 static void debuginfo_cache__exit(void) { diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index f0149d72310c..b9a5afca4cc1 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h @@ -21,7 +21,7 @@ static inline int is_c_varname(const char *name) return isalpha(name[0]) || name[0] =3D=3D '_'; } =20 -#ifdef HAVE_DWARF_SUPPORT +#ifdef HAVE_LIBDW_SUPPORT =20 #include "dwarf-aux.h" #include "debuginfo.h" @@ -102,6 +102,6 @@ struct line_finder { int found; }; =20 -#endif /* HAVE_DWARF_SUPPORT */ +#endif /* HAVE_LIBDW_SUPPORT */ =20 #endif /*_PROBE_FINDER_H */ --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2AC517BECD for ; Sat, 5 Oct 2024 19:56:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158185; cv=none; b=TJeMpyx1wI8ysl/ZHjl9hpVDdLGN8P4KUlKxrRYbtrMk0hFVUoDzUS8wDvkXdwQAixm69lBOj1O8T5Efp6LjuVU+x63YsMUudg40YY96vKFGuLlGSQ+9OPtPzy86MIc8KDH3l4c4d0PUJmUHdj7gMmuw8RDDD8gMEqQWAaVN/m4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158185; c=relaxed/simple; bh=5+jgPOxz0eF8PvRGjL0yqPb9KHea2YGzhwp7FWjocGo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=mfZXY5yohun5vlsJLiTb0ZwLlfQ/rbmlaczs72tXxzlShk+etFIJ9ec2MPx3hzc3Jo/1plzdyAh2I30+ZdUgiwS+uKeNs6Iu5n+clDr4Lk6mEtCH0I4Vr8BUqr6qK8oxNq3wXEd3lcosnK0OBaG5bfNqws/P9YfiEeNYzDMiKaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=IeTqjCZb; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IeTqjCZb" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e284982a31so55682847b3.3 for ; Sat, 05 Oct 2024 12:56:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158183; x=1728762983; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=eN4YqIaHUMZV32L2QJLPoP9jsFkxRa+mNTAtqb8Hsas=; b=IeTqjCZbinrtJX64Gf58/kvo9EmWeecJ+rFvtEA/nLHS+mSu2anKSpHK/zA5kVlA9W ceNj9wm9P4Gq1Sv/pVQWokxgLfgXYwxE9NpABhKhfIRpMgiUTBjZvWMTRzXAd88PBy17 bthKN5VVtRzlfFBagMMWOzAkzeCC2NEpoZIOYE9Oqj2/jiQqigpryjCyVPGPMwWqDyPp RhXWn+hV/ZlBrLb9T/mYmA+apmf01XSHfdilqzAfx/6nlSY3qJnGvOEg+9AsFpZf2jUi uuPg/6/95fsK+N0UzABJlV04U5p1A5Pb6j9Rn5vR9lsZAFGU7GUZsJQtIBEmNICtz7Oq V8NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158183; x=1728762983; 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=eN4YqIaHUMZV32L2QJLPoP9jsFkxRa+mNTAtqb8Hsas=; b=qR52Q5pNMabH52UOUvAUjZjaooVtX+wndLhWHGMuLehQiEsbnzHUbe7+2r9khpX0um RBiPgGfeIga8VG+2rHr34Gsn/Wz6HmgR6EvYi7BhQgGXqTpuhVGaBToKFmC8WUuYqIn1 lghE5pGYr/BqtiZDInx5HZ7HblfiHAG0nQfuiXARJ5DA/pcarf5jDECQ9Y46MrP0CSWs FmeR6O3xTLDFpHSDsNVYG2fV9uFqVlDwTBEsG/73eegpyTrNMdL1HFwu6xf64E85Eers HeY4OAoKO/cSFezo4HrGtho62YcJDUONv4o0lrmLUh98J5C3qQAGLAatHnJlYx6Nmf1Z ya9w== X-Forwarded-Encrypted: i=1; AJvYcCVtQvPZyWQAWUzDx/Eu/D/cfJYyp+zWTIA7btWREtCYer+/BKRBgVHfHmK+KCj6bf6qeU8WO/zxcCHc7nI=@vger.kernel.org X-Gm-Message-State: AOJu0YwsrsUnCfibwkPNZmUBZkdEQ6U1sgnKeWcZadhfS+0iuYmleqim eySgvkPS5h5M5ZaWcoFOgxVG9Xo7DMYO5PqmCo+9H0O35/DKC6ggJlGQoLBqPA7gT7o3JbyT3SD pZrk7Hw== X-Google-Smtp-Source: AGHT+IE37lPO5ROCWh/CimkZxetVnVk7klOqRJ1yUjeH0eyV1XGJ+pwkxL/0BElgh1N3dpXWOd2oLe3lR4T2 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:4502:b0:68d:52a1:bf4 with SMTP id 00721157ae682-6e2c6fdd0afmr975947b3.2.1728158183073; Sat, 05 Oct 2024 12:56:23 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:21 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-12-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 11/31] perf build: Rename CONFIG_DWARF to CONFIG_LIBDW 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In Makefile.config for unwinding the name dwarf implies either libunwind or libdw. Make it clearer that CONFIG_DWARF is really just defined when libdw is present by renaming to CONFIG_LIBDW. Signed-off-by: Ian Rogers --- tools/perf/Makefile.config | 2 +- tools/perf/arch/arm/util/Build | 2 +- tools/perf/arch/arm64/util/Build | 2 +- tools/perf/arch/csky/util/Build | 2 +- tools/perf/arch/loongarch/util/Build | 2 +- tools/perf/arch/mips/util/Build | 2 +- tools/perf/arch/powerpc/util/Build | 4 ++-- tools/perf/arch/riscv/util/Build | 2 +- tools/perf/arch/s390/util/Build | 2 +- tools/perf/arch/sh/util/Build | 2 +- tools/perf/arch/sparc/util/Build | 2 +- tools/perf/arch/x86/util/Build | 2 +- tools/perf/arch/xtensa/util/Build | 2 +- tools/perf/util/Build | 12 ++++++------ 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 9ed0909db170..b14430ab2898 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -559,7 +559,7 @@ ifndef NO_LIBELF CFLAGS +=3D -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) LDFLAGS +=3D $(LIBDW_LDFLAGS) EXTLIBS +=3D ${DWARFLIBS} - $(call detected,CONFIG_DWARF) + $(call detected,CONFIG_LIBDW) endif # PERF_HAVE_DWARF_REGS endif # NO_LIBDW =20 diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build index e6dd7cd79ebd..e06fea1ea8ff 100644 --- a/tools/perf/arch/arm/util/Build +++ b/tools/perf/arch/arm/util/Build @@ -1,6 +1,6 @@ perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o =20 perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/= Build index 343ef7589a77..4387a6d6a6c3 100644 --- a/tools/perf/arch/arm64/util/Build +++ b/tools/perf/arch/arm64/util/Build @@ -4,7 +4,7 @@ perf-util-y +=3D perf_regs.o perf-util-y +=3D tsc.o perf-util-y +=3D pmu.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/arch/csky/util/Build b/tools/perf/arch/csky/util/Bu= ild index 99d83f41bf43..1325310cab6a 100644 --- a/tools/perf/arch/csky/util/Build +++ b/tools/perf/arch/csky/util/Build @@ -1,4 +1,4 @@ perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o diff --git a/tools/perf/arch/loongarch/util/Build b/tools/perf/arch/loongar= ch/util/Build index b6b97de48233..06ff95394921 100644 --- a/tools/perf/arch/loongarch/util/Build +++ b/tools/perf/arch/loongarch/util/Build @@ -1,7 +1,7 @@ perf-util-y +=3D header.o perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o diff --git a/tools/perf/arch/mips/util/Build b/tools/perf/arch/mips/util/Bu= ild index e4644f1e68a0..b328109fc16c 100644 --- a/tools/perf/arch/mips/util/Build +++ b/tools/perf/arch/mips/util/Build @@ -1,3 +1,3 @@ perf-util-y +=3D perf_regs.o -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/u= til/Build index 6c588ecdf3bd..3d979480a188 100644 --- a/tools/perf/arch/powerpc/util/Build +++ b/tools/perf/arch/powerpc/util/Build @@ -7,8 +7,8 @@ perf-util-y +=3D sym-handling.o perf-util-y +=3D evsel.o perf-util-y +=3D event.o =20 -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o -perf-util-$(CONFIG_DWARF) +=3D skip-callchain-idx.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D skip-callchain-idx.o =20 perf-util-$(CONFIG_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o diff --git a/tools/perf/arch/riscv/util/Build b/tools/perf/arch/riscv/util/= Build index f865cb0489ec..8f93091b8345 100644 --- a/tools/perf/arch/riscv/util/Build +++ b/tools/perf/arch/riscv/util/Build @@ -2,5 +2,5 @@ perf-util-y +=3D perf_regs.o perf-util-y +=3D header.o =20 perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Bu= ild index 1ac830030ff3..787410f99bb3 100644 --- a/tools/perf/arch/s390/util/Build +++ b/tools/perf/arch/s390/util/Build @@ -2,7 +2,7 @@ perf-util-y +=3D header.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 perf-util-y +=3D machine.o diff --git a/tools/perf/arch/sh/util/Build b/tools/perf/arch/sh/util/Build index 32f44fc4ab98..2337a0b710a2 100644 --- a/tools/perf/arch/sh/util/Build +++ b/tools/perf/arch/sh/util/Build @@ -1 +1 @@ -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o diff --git a/tools/perf/arch/sparc/util/Build b/tools/perf/arch/sparc/util/= Build index 32f44fc4ab98..2337a0b710a2 100644 --- a/tools/perf/arch/sparc/util/Build +++ b/tools/perf/arch/sparc/util/Build @@ -1 +1 @@ -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build index 2607ed5c4296..9705cda4f240 100644 --- a/tools/perf/arch/x86/util/Build +++ b/tools/perf/arch/x86/util/Build @@ -12,7 +12,7 @@ perf-util-y +=3D evsel.o perf-util-y +=3D iostat.o perf-util-y +=3D env.o =20 -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_BPF_PROLOGUE) +=3D dwarf-regs.o =20 perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o diff --git a/tools/perf/arch/xtensa/util/Build b/tools/perf/arch/xtensa/uti= l/Build index e813e618954b..2d1a48696ad9 100644 --- a/tools/perf/arch/xtensa/util/Build +++ b/tools/perf/arch/xtensa/util/Build @@ -1 +1 @@ -perf-$(CONFIG_DWARF) +=3D dwarf-regs.o +perf-$(CONFIG_LIBDW) +=3D dwarf-regs.o diff --git a/tools/perf/util/Build b/tools/perf/util/Build index dc616292b2dd..1d08608b7e1b 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -199,11 +199,11 @@ ifndef CONFIG_SETNS perf-util-y +=3D setns.o endif =20 -perf-util-$(CONFIG_DWARF) +=3D probe-finder.o -perf-util-$(CONFIG_DWARF) +=3D dwarf-aux.o -perf-util-$(CONFIG_DWARF) +=3D dwarf-regs.o -perf-util-$(CONFIG_DWARF) +=3D debuginfo.o -perf-util-$(CONFIG_DWARF) +=3D annotate-data.o +perf-util-$(CONFIG_LIBDW) +=3D probe-finder.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-aux.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D debuginfo.o +perf-util-$(CONFIG_LIBDW) +=3D annotate-data.o =20 perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind-local.o @@ -234,7 +234,7 @@ perf-util-$(CONFIG_LIBLLVM) +=3D llvm-c-helpers.o ifdef CONFIG_JITDUMP perf-util-$(CONFIG_LIBELF) +=3D jitdump.o perf-util-$(CONFIG_LIBELF) +=3D genelf.o -perf-util-$(CONFIG_DWARF) +=3D genelf_debug.o +perf-util-$(CONFIG_LIBDW) +=3D genelf_debug.o endif =20 perf-util-y +=3D perf-hooks.o --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A97217C9B0 for ; Sat, 5 Oct 2024 19:56:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158187; cv=none; b=A3/HNgaH25A55kJsvqAK7aoWZqNPihsFQU4QQnHhiJseQS43m9jlyL80JkF/ce51Vgwf53y7IRxsaMzbFLV7xFZpfkNHAmrcjU3KGeErVYJ5olYqB2H6U3Y+vTqmbWJW/+LTjx0/phMYEIrJ+BNhThCv1tQf1I0kI5shZzb02A0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158187; c=relaxed/simple; bh=5PAi6ooydC2034Tlqdv0mieuQRt/MPe6ihmi35Ubwc4=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=c6rdbs5lTQYMThYjRMSxEYhXjJv5t97lwDrovQbkri3A9MKBhzWKCDMU6+PG0q0JjmjSMsanMXspPg1dB/oRtQFGhZt6/uUtaR8bDPGI+KRAsfjNnMq962l525v70cGuxr1RtyvinNDo1sVM8PrQvv+e9nfqluCo5TG9Ut9SeDk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=h2DPOUdT; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="h2DPOUdT" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e0082c1dd0so71675537b3.3 for ; Sat, 05 Oct 2024 12:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158185; x=1728762985; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=h/3DcHqmbVdZp4yWyNeZgt8hRC6twmBuki9IOXFR1Fk=; b=h2DPOUdTj9+Nh4C5e8DMq4W7/0lJtuevRupKExllqSegkN5xFqBnmoiGkJxWVy75AS r67cIoD2ZoZAo6lVXw7qK81GfiAE48Z1YqHnJUcEtOFklbwOFNjswvLVXcZobR9wE/S/ vWJcZKd6/qNEl0jxoQiHwBTIPj5ftw1mV1Upt2y8wHLN4ZvGo8Kvzd75g/q87e6RGUF6 0qIk/QZUqBMbWGt0B+43Q2AbMJHeP0PBBzsEYAuE/3UbdPmtHs4MCHYYMxxdKOolTc/x 0fPrM8yCKD89w+eNhja2ih9lInGu7ny0rS/uwlH4qd7gtaabvei6XSuIfFNOuJAc2Yji qSeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158185; x=1728762985; 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=h/3DcHqmbVdZp4yWyNeZgt8hRC6twmBuki9IOXFR1Fk=; b=f8gKkiaNKoDXZ2/Y7p5I8ivP+Y/L1wMtwyz0VjayxNZ4K9B++45f4sOzmbHnf3Mb2a mGVZrNwCIT1zXO1tTtmvCKaS1yRWAe68tZkJmHIGOV5zEo76faMCjvQKIIdcbSdE15pi bKaJTx6LLCtQJ19kp9HAjJ1jqqc/taEVMCE/1HJkEL0hMvabd0H7XAp4AiuIXU7IYsJo KnALT9PAokbMwtoRbqYjSQ65mQ3eYww2F9nKnWh0Ha5Uj7ASoSUdMYOSIcWpG/u00wVe L59wiQh1vdyuKbY8yIUUX6wGGf5plCPxcA/g6cnuqVSNLl6i9HcSyVnbNCEgXtbkDtQL u4Kg== X-Forwarded-Encrypted: i=1; AJvYcCUGzgzA+OTbIrKMW5kdg1Qyjd2SLHc6i4Y67F5FRZF7R347F/TYwmE7r102oliGP63bYDTZuBwNW8V7QZM=@vger.kernel.org X-Gm-Message-State: AOJu0YwYY1kMkpUAqPMEJIL4mZtAFJmtzHfjhAwNLfef02aQ40ZOWS5n DYdNHDjsOGt4sZJtbk6SlzkSHGrKIWlXLlaXF5vExJowMKgFPEsurjC9KF147oCGyZrHDLxvqZo Qm1cEIA== X-Google-Smtp-Source: AGHT+IFisEJrumnwhsHUHkUR8QAhAmeXxmT2VH1277V55Dcfln2xbxOQ1sJmjrLj9pgNFaHmZqxuL/PfQjiy X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:f8b:b0:6e2:ef1:2551 with SMTP id 00721157ae682-6e2c72af775mr523117b3.8.1728158185409; Sat, 05 Oct 2024 12:56:25 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:22 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-13-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 12/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D 0; - return -ENOTSUP; -} -#endif -#endif /* __BPF_PROLOGUE_H */ --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA48F17E00C for ; Sat, 5 Oct 2024 19:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158190; cv=none; b=Dd3fdqsg5f+j9a9zyx3yzcZ38HRMZ73YYg41R6NRegI3Xo9fVjrcZ9JoFh/U/ELEPsncCd8Lpb5FDDTuueYgPibxn7ZHvNF74b9ItsbjCFoxN9NAPQfEmihfFWXDQPeqRoepIXbPdbWQmHNCuBTK8aMy5GqjwC+MQ+egeNUsv80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158190; c=relaxed/simple; bh=pmRl3aeD3eCZIgWPQZlcRgku5ZmloiIN10kU5bJPQu4=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Xf47r3TYdui1kyiP0+ZGipUC47vaqjnziElb2F8YEmeXPicGmlZk+TqDgr41BqBTCP3s8/f0M1ohChDJr1dwdX7lzWIykyFoS+aDoNyOL/s60v10rM+qnrmeZQd4j8cv+0ylINuZGfZYRp5br5blXqfmtzhXYa2VXySel95UXP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=AFBqnUzc; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AFBqnUzc" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2e4874925so5149197b3.1 for ; Sat, 05 Oct 2024 12:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158188; x=1728762988; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=jZZa/aV5YYBVrQKudC94gshETixiksMke/2tnp/oWsk=; b=AFBqnUzc172QPnSOOu1KD/QxwAylhisVuKjxYP5kOcejVqN6+0DqQFXOew3kF3OaYK 6rBcdYKHbfuRPh3o9gwW90m/pB31MhyGm/o37dfFC1xTBL4qNuaAgS0Bdn1PqMTjLPZg hRVFhGNEHRqJp9L81eVYzhCocSYMi7CBehXyCpJXUYxrItToTk2vav8d0XaK4ccY98pl ZAKJAvECo5Wo87Vfx7OfA1sMaEQjUIVFFUDWi5Z0vHhPVvX0LHkvA/IOuNmgYgPTAu3u pBJ8Kzh1ukADYpdPFHFS7OkHtolFXgZVQwHBQgJWQmjEsr1hCanjo6YwHSKYl28INHH8 RPZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158188; x=1728762988; 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=jZZa/aV5YYBVrQKudC94gshETixiksMke/2tnp/oWsk=; b=IUXHJVkQCzWqxPg7jXvScys9sSLxgKL0xpauar+nYOpdgAfimp12ciLwNgb2fCbNdL 6xr9xyhEvgKWNb8cxq4a5S27wskFz5CMN40PmKl+SGAegpIvbiAz20BSaEldnPOFzTtV 3O40QqAg9D4htqZD21REGlo9sRQcyLSZhZbePVFuMyB2753RyK2JpDPmIQmVyptNdSNs mP4NMoR6+IPydxAYtg+SFRvAFmjC/RK+0j3A4FRS+fCOT7Ees+viCEQ0HjelNZm+Bai6 RDt1KhHoLQd3S+gKJawdO1cJI54UegaswGAuL1M/AJLBd4/h4wjGFgCYRly7DpyQubfk LdpA== X-Forwarded-Encrypted: i=1; AJvYcCWdZUsl5TXCz4pmgiT96OppQSsKQzOci8GSvx4B9HF/PheraQ0DCzhCP6BhbINQcyezh0Szc43RXPnh1Qs=@vger.kernel.org X-Gm-Message-State: AOJu0YyYr3ShJJqinX8jLihyGZYqKoaYtadDPx2zGF8AjscCu/3HJpmv C1/qmsz1AmYI8d3jz+Ju7XapHBhcOxgI/AUxvT55UVDirrL7oqOT8HubqqtB1mdIy1l7n2WJJro BvigjFg== X-Google-Smtp-Source: AGHT+IF/k+QTDokkY1K6UtxUUDOjzsW/I4NFq1B+B7blvtXSloVdvbplHl/sSMVN7FmErueZ8sN2R4KkkBKV X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:ec09:0:b0:e25:cf7f:a065 with SMTP id 3f1490d57ef6-e289392aee3mr16302276.8.1728158187672; Sat, 05 Oct 2024 12:56:27 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:23 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-14-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 13/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 b14430ab2898..00340c6ce3a9 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -200,10 +200,6 @@ FEATURE_CHECK_CFLAGS-bpf =3D -I. -I$(srctree)/tools/in= clude -I$(srctree)/tools/arc # include ARCH specific config -include $(src-perf)/arch/$(SRCARCH)/Makefile =20 -ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET - CFLAGS +=3D -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET -endif - include $(srctree)/tools/scripts/utilities.mak =20 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 :=3D 1 endif PERF_HAVE_JITDUMP :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 # diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm6= 4/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 =20 -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 =3D __stringify(%x##num), .dwarfnum =3D num} #define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} -#define DWARFNUM2OFFSET(index) \ - (index * sizeof((struct user_pt_regs *)0)->regs[0]) =20 /* * Reference: * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadw= arf64.pdf */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] =3D { +static const struct regs_dwarfnum regdwarfnum_table[] =3D { GPR_DWARFNUM_NAME(0), GPR_DWARFNUM_NAME(1), GPR_DWARFNUM_NAME(2), @@ -74,19 +71,10 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[= ] =3D { */ const char *get_arch_regstr(unsigned int n) { - const struct pt_regs_dwarfnum *roff; + const struct regs_dwarfnum *roff; + for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) if (roff->dwarfnum =3D=3D n) return roff->name; return NULL; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff =3D regdwarfnum_table; roff->name !=3D 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 :=3D 1 endif -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 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 %=3D 32; return loongarch_gpr_table[n].name; } - -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - - for (roff =3D loongarch_gpr_table; roff->name !=3D 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/Mak= efile index 7672d555f6cd..ae05727835d8 100644 --- a/tools/perf/arch/powerpc/Makefile +++ b/tools/perf/arch/powerpc/Makefile @@ -4,7 +4,6 @@ PERF_HAVE_DWARF_REGS :=3D 1 endif =20 HAVE_KVM_STAT_SUPPORT :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 # diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/po= werpc/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 =20 -struct pt_regs_dwarfnum { +struct regs_dwarfnum { const char *name; unsigned int dwarfnum; - unsigned int ptregs_offset; }; =20 #define REG_DWARFNUM_NAME(r, num) \ - {.name =3D __stringify(%)__stringify(r), .dwarfnum =3D num, \ - .ptregs_offset =3D offsetof(struct pt_regs, r)} + {.name =3D __stringify(%)__stringify(r), .dwarfnum =3D num} #define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%gpr##num), .dwarfnum =3D num, \ - .ptregs_offset =3D offsetof(struct pt_regs, gpr[num])} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0, .ptregs_offset = =3D 0} + {.name =3D __stringify(%gpr##num), .dwarfnum =3D num} +#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} =20 /* * Reference: * http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] =3D { +static const struct regs_dwarfnum regdwarfnum_table[] =3D { GPR_DWARFNUM_NAME(0), GPR_DWARFNUM_NAME(1), GPR_DWARFNUM_NAME(2), @@ -83,22 +79,14 @@ static const struct pt_regs_dwarfnum regdwarfnum_table[= ] =3D { */ const char *get_arch_regstr(unsigned int n) { - const struct pt_regs_dwarfnum *roff; + const struct regs_dwarfnum *roff; + for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) if (roff->dwarfnum =3D=3D n) return roff->name; return NULL; } =20 -int regs_query_register_offset(const char *name) -{ - const struct pt_regs_dwarfnum *roff; - for (roff =3D regdwarfnum_table; roff->name !=3D 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 :=3D 1 endif -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 diff --git a/tools/perf/arch/riscv/util/dwarf-regs.c b/tools/perf/arch/risc= v/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 =20 -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 =3D r, .dwarfnum =3D num} #define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} =20 -struct pt_regs_dwarfnum riscv_dwarf_regs_table[] =3D { +struct regs_dwarfnum riscv_dwarf_regs_table[] =3D { 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 =3D 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 :=3D 1 endif HAVE_KVM_STAT_SUPPORT :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 # 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 @@ * */ =20 -#include -#include -#include #include -#include -#include -#include #include "dwarf-regs-table.h" =20 const char *get_arch_regstr(unsigned int n) { return (n >=3D 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 =3D 0; - gpr =3D strtoul(name + 2, NULL, 10); - if (errno || gpr >=3D 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 :=3D 1 endif HAVE_KVM_STAT_SUPPORT :=3D 1 -PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 ### diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/ut= il/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 */ =20 -#include #include /* for EINVAL */ #include /* for strcmp */ -#include /* for struct pt_regs */ -#include /* for offsetof */ +#include /* for ARRAY_SIZE */ #include =20 -/* - * 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" =20 -struct pt_regs_offset { - const char *name; - int offset; -}; - -#define REG_OFFSET_END {.name =3D NULL, .offset =3D 0} - -#ifdef __x86_64__ -# define REG_OFFSET_NAME_64(n, r) {.name =3D n, .offset =3D offsetof(struc= t pt_regs, r)} -# define REG_OFFSET_NAME_32(n, r) {.name =3D n, .offset =3D -1} +/* Return architecture dependent register string (for kprobe-tracer) */ +const char *get_arch_regstr(unsigned int n) +{ +#if defined(__i386__) + size_t len =3D ARRAY_SIZE(x86_32_regstr_tbl); #else -# define REG_OFFSET_NAME_64(n, r) {.name =3D n, .offset =3D -1} -# define REG_OFFSET_NAME_32(n, r) {.name =3D n, .offset =3D offsetof(struc= t pt_regs, r)} + size_t len =3D ARRAY_SIZE(x86_64_regstr_tbl); #endif =20 -/* TODO: switching by dwarf address size */ -#ifndef __x86_64__ -static const struct pt_regs_offset x86_32_regoffset_table[] =3D { - 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 >=3D len) + return NULL; =20 -#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[] =3D { - 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 =3D regoffset_table; roff->name !=3D NULL; roff++) - if (!strcmp(roff->name, name)) - return roff->offset; - return -EINVAL; } =20 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 =20 -#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 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAA0C183CBC for ; Sat, 5 Oct 2024 19:56:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158192; cv=none; b=hmsOWDWWIjEMXYb4OGUTKlbt9AdVkm0G+wPe3go8F/Vx2/mK15cP6Pn9xd7uQ+v0mLZ032lt1ZNkR+IxICKcXsdUc1kFbspPTBlmIqTtYY9laUYTfOdxD1OBbVRV05yaTh3uP5LBHeLcdmqFORBHBYMfhMsCdz2qWuNFlhz7CYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158192; c=relaxed/simple; bh=vKC6wvleEdmOYy/UFkVbvo/Aszxf0yDcXtV1RWbZSGU=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=r4T9HizhTlX78/4D1DmMLxNheeUAEkh41jtXIFblyrVDfF5sowoqc8kvd69IvIO3e7Sg3QV5Kfxd9qOqioX4b5M+6za305xu7sszSSlPLJ0xhhkxEy8aCjpdcylIMTMX2Y6+b81uEw1O22SL+QIR8fTv/z5VwfvkgbgCx4XPHkU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ScxMiB73; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ScxMiB73" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e25b39871fso57100397b3.0 for ; Sat, 05 Oct 2024 12:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158190; x=1728762990; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=mWkTi+vsghXUwthwHY0WZVikiFTqOtXMvpUNhV0UTzM=; b=ScxMiB73MLdmBkDmKZJLgEXTgCCt/iF9LpERf0VdAL178pjngPnqDMjxvN2peqRSuj pCGKPr1HE+85dX9LG0+syIIsmkg9pFgmwBWXTxv/49qQcWgtIlotLszm09V1joYDdttn LRL26i+UQqj7GKWWypffFD+oJUFOE32D3yrjD6QbeRskyGcymsYIVm8Lszf4L1Oig+qt 7DFyMDN8lOOnXSu+mL4X/Zrj7Y0N8Uf+ZAkCAWSiEpSR9HR9gEfbQHkalsKUGR3arQqf FIc6YXCoXm9ZVEMtskz/U6NrfWY3jAvntT4byGS/y1GuS5BCLSLQhnMgqUulL8aFv5/e EuxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158190; x=1728762990; 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=mWkTi+vsghXUwthwHY0WZVikiFTqOtXMvpUNhV0UTzM=; b=JwQBVMCFmJEXdfPYvA6OUbOQ9QNgy9BMBMRKklBngfVm40BPugBEzTxQk3Dxwt+G0f WgbGPQR1dzEEEFsLFGr6G/+KwRssJDIvu5jnwVU/KUBGmKdIq8kPwJCg+JAqBzfhsmZB Mcr1eky7XGA8glKLN0SBu8M9sr+pJui8/2gXW8PAvyxQINY1wTZSKhk8jVi/QNh32JEf HDqueJp10bB/wBKKz1hwJpR4koFas8N7cgTtkzkAsletzIFMMIzo7hTnDD1VjwzS1rxZ 20GKQxxuq6kbDYoJGsU1BP4oPfTSK7zp9bld07aAWesGMq/Z9DsR5VBjVXAtwzGDatGe rF7A== X-Forwarded-Encrypted: i=1; AJvYcCXR4+nfzNMuEzrlIp683e2DO8a1iU9AHlJVYaV35pk7c1UThyJptVFKgtsJuZDDGhbHnbRXDlN1B0prWTc=@vger.kernel.org X-Gm-Message-State: AOJu0YywRRFhXUTEzy8vJR5cxNcH7BldnlzIL5pjTrQuCRtjOfS6anwy 8ZOzIlWDD0IOgjruk8z1RLYjbnpxZL6/a24slzKv1leDscYQd+lYEAo3he1LbG+zehvexexHK8y QsFlL9Q== X-Google-Smtp-Source: AGHT+IFa/DEWlqyexb9NXBm2CUUiJMwHO0NQypXq4kNJjdEZhDoVi6dbJfe11i8jnstusJCUTq1JNIQBgCj5 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:c512:0:b0:e28:8f62:e735 with SMTP id 3f1490d57ef6-e28936c055bmr5224276.1.1728158189715; Sat, 05 Oct 2024 12:56:29 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:24 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-15-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 14/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =20 -#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 =20 #define DWARF_REG_PC 0xd3af9c /* random number */ #define DWARF_REG_FB 0xd3affb /* random number */ --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9979C185943 for ; Sat, 5 Oct 2024 19:56:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158199; cv=none; b=kf/NqVLqu9wfHiQPDsnm5VA2vTc2OgNbMHdF/Uh5JBfnV4qcOXUKcZGrPSAVPcDDONqC5wYpYF0aN0vwQmMN3G5xQ4faulb68wf0A5LiR9mJoRTQWmzzouhhi/TJY3twpb56ItME1HZEfvr6yEsqwqbu0OdPlU2yvEFdDFysHzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158199; c=relaxed/simple; bh=sqjYeUBtOtCRSdlNzXYxYIxgSm4fv2DQ8Uitzp9jNUg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=ZfYZuXZf3eXRWCMqYIaZv2KSN5+0rRw7OupihKsskGkop0LuPQriAdpAVp/sDJRXzkOSUoHfiH5w7Bdt42e8qmAfDravNotVf0t6Jm9DeHKqwKLyw/03mktxfT2gn/L4ePUalonobE/spxtvLEQF3NNfm55lm98vtQ1e20F34gA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RlvizJup; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RlvizJup" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e165fc5d94fso5051140276.2 for ; Sat, 05 Oct 2024 12:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158197; x=1728762997; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=R3VGAHxB6IOEew1cgpVav9xummXJdWF/G2mjihEztk4=; b=RlvizJupJ85QsXQ4VJmZ/at5ypWuPrd2DUo/BiOuk+7beHdcMdgCj/gEJqQjFJ8S1y BIsFa3gdLm/qNsO9zo/FIbkWA1qYleEZAxtI6l33Slb6J59PYJ3PInKR/dJWbWjYCYZr NDQks9pUfdJoQtna40O12QiC2a954fz5Z4feFBL9psbE01+dxvC07zy8yVn41slgqmaW oE+RfvUfCAa/wGXAZpOS7qDNaPwrmfW12zKSil1sCOlbIZ7KWgedrz4D+ZnpuXgzm4Wx OoNUbD4cpyp++/d7M1ay/QWdlUXZjWOShzlNZ8Sl/IdSaWo0F0KZUj5cBm1GFKRhRePk e54A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158197; x=1728762997; 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=R3VGAHxB6IOEew1cgpVav9xummXJdWF/G2mjihEztk4=; b=vgDNMXavJAXT+09B47Rb4h98M55LnXDJ02HV+1DnLXroBsE8yypXlH4pGUJhrlsch+ RKs/OC0pRPNAfVYM48Qau9wnnFzDdPVNdiBofTNgtqv7usgZRwsOPphf4zcRPjaSz7jP TKUAV8NxPxoe3nXO3I0hWDd99Eg7SpLwnpd33zu/fPGBkp3NUnNyhb0/NFPkfSlO2WRF OIfBzkEEyw9b97wxkOtWILAu1zQIUS0a1VRit9g3QmCi3b/R3drpgKaAKy9nSTUT+t0A WMEEu4ov3xZyF2hl95/4ddQCjBnUfoRC+u+VuiO8AR4fFYlEtl32ZGMBujCkVFoovW+g yORw== X-Forwarded-Encrypted: i=1; AJvYcCWOeJZ3OQyeU7yW0qnfwTMjxNZl1EcGW0ulMfL/bf+QGylxbujonf9JVz9/vbDl3FL5sbUVPgf36oZVx9c=@vger.kernel.org X-Gm-Message-State: AOJu0YxZHL4NDd9kc/Ouyimx4W0CqisiJ8KK7y5KsYWfZ56ycAu9yvoc CCGiwqVghgV0ISikjwzbWDpR/WzvADp9zTDZNT5Qm6kTq0J40BZtgx4PQvaNDNtKLkvpJ0Kco06 Uef2N1g== X-Google-Smtp-Source: AGHT+IG2eBp7Cu4lY01+7ZMESWgL5KUK/mw9BioburAuOGjyC47kH+1lSGq6Y6HvKQiIl3R4nAeP9k3OlHFV X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:6902:1817:b0:e24:9f58:dd17 with SMTP id 3f1490d57ef6-e28936bf5d1mr12928276.1.1728158191755; Sat, 05 Oct 2024 12:56:31 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:25 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-16-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 15/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 *cpui= d __maybe_unused) { arch->initialized =3D true; arch->objdump.comment_char =3D ';'; + arch->e_machine =3D EM_ARC; + arch->e_flags =3D 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 *cp= uid __maybe_unused) arch->associate_instruction_ops =3D arm__associate_instruction_ops; arch->objdump.comment_char =3D ';'; arch->objdump.skip_functions_char =3D '+'; + arch->e_machine =3D EM_ARM; + arch->e_flags =3D 0; return 0; =20 out_free_call: diff --git a/tools/perf/arch/arm64/annotate/instructions.c b/tools/perf/arc= h/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 =3D arm64__associate_instruction_ops; arch->objdump.comment_char =3D '/'; arch->objdump.skip_functions_char =3D '+'; + arch->e_machine =3D EM_AARCH64; + arch->e_flags =3D 0; return 0; =20 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 =3D true; arch->objdump.comment_char =3D '/'; arch->associate_instruction_ops =3D csky__associate_ins_ops; - + arch->e_machine =3D EM_CSKY; +#if defined(__CSKYABIV2__) + arch->e_flags =3D EF_CSKY_ABIV2; +#else + arch->e_flags =3D 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 *c= puid __maybe_unused) arch->associate_instruction_ops =3D loongarch__associate_ins_ops; arch->initialized =3D true; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_LOONGARCH; + arch->e_flags =3D 0; } =20 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 =3D mips__associate_ins_ops; arch->initialized =3D true; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_MIPS; + arch->e_flags =3D 0; } =20 return 0; diff --git a/tools/perf/arch/powerpc/annotate/instructions.c b/tools/perf/a= rch/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, ch= ar *cpuid __maybe_unused) arch->associate_instruction_ops =3D powerpc__associate_instruction_ops; arch->objdump.comment_char =3D '#'; annotate_opts.show_asm_raw =3D true; + arch->e_machine =3D EM_PPC; + arch->e_flags =3D 0; } =20 return 0; diff --git a/tools/perf/arch/riscv64/annotate/instructions.c b/tools/perf/a= rch/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 =3D riscv64__associate_ins_ops; arch->initialized =3D true; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_RISCV; + arch->e_flags =3D 0; } =20 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 =3D SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; } + arch->e_machine =3D EM_S390; + arch->e_flags =3D 0; } =20 return err; diff --git a/tools/perf/arch/sparc/annotate/instructions.c b/tools/perf/arc= h/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 =3D true; arch->associate_instruction_ops =3D sparc__associate_instruction_ops; arch->objdump.comment_char =3D '#'; + arch->e_machine =3D EM_SPARC; + arch->e_flags =3D 0; } =20 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 =3D SYMBOL_ANNOTATE_ERRNO__ARCH_INIT_CPUID_PARSING; } - + arch->e_machine =3D EM_X86_64; + arch->e_flags =3D 0; arch->initialized =3D 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; }; =20 struct ins { --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4514E17A5B5 for ; Sat, 5 Oct 2024 19:56:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158196; cv=none; b=W1bdrGcuUBbgRIcQaggHk1EFRICZClXSzwdCFSsR1bJszWjCVpcyc63ZQ1qGZaSl221my6XjKY9Ae5LStktyryz1H8SlnXRwtCT+F63bpFTJNOcDEpV2KJLP+/XeEtzV1QAaHTuF7tKdEP2uFrRR02feYxe1Avq0kxrE8YMblbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158196; c=relaxed/simple; bh=ZXckq9/5rBlLdDdPjIGQW8xHKpySzPV+gMGHrENNoZg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=D8s0rQuVOK3p9JwQk1x7NX93SU1tPemLj4kvuC6+JFljvRVXkWMdtLGiofOqLUgGHm3tapulR4qmz/dpxzrFLssWGLi5PE2+7agsTJZAqNgW19tFtgHobV2RlE5R1TqQBbtqKsUA1NP2I4zeDb4Y+qdWvJNjEW8CPNHoyAVTZmg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=T1+uWp65; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="T1+uWp65" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2364f45a4so42688097b3.2 for ; Sat, 05 Oct 2024 12:56:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158194; x=1728762994; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=i2ESjB2YIGNr0kAF0x/rOVXxJN2WJ7SSqyQKEEmQuJA=; b=T1+uWp65CMTQrH+EuM2H41rh+/iKOFuJeCeLU3NaoD00220fTqUUyCUL8IYVOD9b8q QthROhhcP1fIBljIHpgDIEyFbF+B+u/C+ofIOnCJUWmfPs/gGIxtVPtqST2/EwkhaLiN YygXZEuSVNbCGbHC1Ye9ZCNUYZrNcHEo0peuaUTNPGrTdw03tezGnyj3zPvuCKQ1JDaZ SobyzjLs9lk0ppE7j2s+nRn2uxX/HA5AANpX0a4KxntG30K+c2lAdxJcSnUOpwRf3xCe 6RWs3RY6hkEsUng/k3NWKSBRrXgr49vMoDpYI+QI1U32FIwGgCVaMMqNTUipM4DuERvZ 3OBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158194; x=1728762994; 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=i2ESjB2YIGNr0kAF0x/rOVXxJN2WJ7SSqyQKEEmQuJA=; b=Iga0ptwF1Urs82UG98cij3MtZxl6R2holvKAhf+H0jQBCEooyxDMQJB5snpdbHvbTX YvAM5exAzzpSsMO94C6JWlt1/9HdMeG0uF/N9Vt/Mez5CzCDAr8pBTXlTwHvQ+BteKVz 0rlCYxl9FQSLzDCECEOLr7BzHn5GuzckNFucIh7s0IFv6xB79SB92PewLHhd2nCgT24H t+qiuEFHFoZbs0snzKajiQiJTjR7ltozzaW2pnQlvwGOcgW68FI4++0T2i9BjER4GoX0 V1hsdKekVbp9fI2pFJMHo6asu/OHpkNP0UxUnnEFKAd2+c2whicoEyHaa2d7LRxSH5x8 vMLA== X-Forwarded-Encrypted: i=1; AJvYcCVxFlFA4llzIdBLhVn4rE1uabAgN4jF1wNvz+eXUhEOUPk15D2/x5pgoEYoV60oL+6IitDnb6wpJAYUFQ8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3BSvSHzx1UI9JlqRmBylYKzCjsDmZ3XvWFNNOSAEnU5bk4W73 6Xuv/JapLkx40UXIKTFoYrm753wwNk3zQihXIrksu+bmZ+HajRROL2FpLzANUq8mzbJrVWao07i OF5yCRA== X-Google-Smtp-Source: AGHT+IHEbD4MRwZ2PKCjAUCVKxtlz40qrMSN6DbbdIeVTb8C/0Bd+XGDjYe2Dr3Ix5YBR4/AVrrPnEznaGld X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:c512:0:b0:e28:8f62:e735 with SMTP id 3f1490d57ef6-e28936c055bmr5227276.1.1728158193972; Sat, 05 Oct 2024 12:56:33 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:26 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-17-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 16/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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, cons= t char *str, if (regname =3D=3D NULL) return -1; =20 - op_loc->reg1 =3D get_dwarf_regnum(regname, 0); + op_loc->reg1 =3D get_dwarf_regnum(regname, arch->e_machine, arch->e_flags= ); free(regname); =20 /* Get the second register */ @@ -2305,7 +2305,7 @@ static int extract_reg_offset(struct arch *arch, cons= t char *str, if (regname =3D=3D NULL) return -1; =20 - op_loc->reg2 =3D get_dwarf_regnum(regname, 0); + op_loc->reg2 =3D get_dwarf_regnum(regname, arch->e_machine, arch->e_flag= s); free(regname); } return 0; @@ -2405,7 +2405,7 @@ int annotate_get_insn_location(struct arch *arch, str= uct disasm_line *dl, return -1; =20 if (*s =3D=3D arch->objdump.register_char) - op_loc->reg1 =3D get_dwarf_regnum(s, 0); + op_loc->reg1 =3D get_dwarf_regnum(s, arch->e_machine, arch->e_flags); else if (*s =3D=3D arch->objdump.imm_char) { op_loc->offset =3D strtol(s + 1, &p, 0); if (p && p !=3D 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_unuse= d) } =20 /* 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 =3D strdup(name); int reg =3D -1; @@ -84,8 +84,12 @@ int get_dwarf_regnum(const char *name, unsigned int mach= ine) if (p) *p =3D '\0'; =20 + if (machine =3D=3D EM_NONE) { + /* Generic arch - use host arch */ + machine =3D EM_HOST; + } switch (machine) { - case EM_NONE: /* Generic arch - use host arch */ + case EM_HOST: reg =3D 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); =20 #else /* HAVE_LIBDW_SUPPORT */ =20 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; } --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 606D818593D for ; Sat, 5 Oct 2024 19:56:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158199; cv=none; b=So8CNeRdpRlqEqH/RHqcAg8XC6prD/aG1vKNKvhFbJPX4Vv68yJSELS4WNbLyy07j2A2J1M71HMkpYz2LSF6VE5MCPgM1vjaMYVF2QmiEpijIxOVPPl8IQAsWoTL6HWniwAS+leAISPL8mrfBPV8iHZ0BAK/EfOu8i8dI+5ZCcE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158199; c=relaxed/simple; bh=TfSSpaClTWkztEMDJOpaYOhgo1TBAP7LFL/J9eyzwJo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=C8G/ffua67uZNwD07vCyYKCgES9qOU0bXv3Et/n4F2el9zQtrJxF7hmuUXK+bm0FLbBp6xlc99olEpLjFjmkuxs1l2Bv6m1vNuYQb9Uqcsybnx2RIApup5W1J9i4K69uf11uAJiKbntAaNJQGMurtheS4yUFp7bI+Z6zyDu2LgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mavSd/Fe; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mavSd/Fe" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e0b8fa94718so4781793276.0 for ; Sat, 05 Oct 2024 12:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158196; x=1728762996; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=0piuJuEbl3cyfBd1ycTRiflZHzTELs7cJF9ZD6VJNSY=; b=mavSd/FeWQeQzdHDi9FU8uGhk2DtapUfabUj/NjpIv1afrGbcGvgdZJ973LWrtoHcR mmw8d1MDD3zWOQHnnBXn5X+YpLW0QVlwq+0nR4bo0FZvUBJWPMY8JtUfoeKTaxVAhmYr nrSKNONA0mAVNeDIX6CuFsimybeestnvX2leBXAUeokccEkVaD5gqQXZinuwtpza8wBA qS5kXkij7vOcy2NQZrMXybx7ZwSBp0U9pilhA/3hCsmebGfZQ45gWKQEs7hyrhg8gzP+ H9ENe/xQUkf8LUyNxycM1gLoMMfEJXLTRscKW1V7klnwlT2OAF9TqUPK0ruUmLwORDqU 3Dwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158196; x=1728762996; 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=0piuJuEbl3cyfBd1ycTRiflZHzTELs7cJF9ZD6VJNSY=; b=Vvl3NGtot1NHuxz6Ii4E2EATIk0iZzrzkYCE+tkltgIuE0wxEymG4qZTrjQ9Zufbjw C3INQSBndP7xKk7iGEXpzjreq7H7KpmFC4PyWXHUMbA56StQM5CaR/hhXV8/wR6vxQs0 uTz+0OqJ0f1p+FNpcpQq1B6oNPJHOoXRqjBpK3cQOrQZLWihmDk0MZeT9AjSbzvROLRT tDk8pX0yYEVf+ADxwrQF48kfNdlZS4Q61fTr1A8N6L2xzVyfrz5rfpBOfHDqOk3wtVfl YoGfKBm9Ud5yLfjoeBrHixqyflk9Htnc25f3fA6GHYln6MHjiTJ7ftlAT+kEfV6dRz4x kQ4g== X-Forwarded-Encrypted: i=1; AJvYcCVM9bYxdkgLie/3xyVQciOj6VyCmhwulsVdpEnwk6+2gk5liR4X3QInjeNxTnllX98fhO0Lsy6BOSsznHo=@vger.kernel.org X-Gm-Message-State: AOJu0YwG56dRutsyRaay81P05dAhppq8tkBatmjeCy8rutktb+QTqfAM Hpm3czT6M0W+AsmOcE3Q8obN0rHou4FKVzCZ5u4IeP2eB6a8WOQwfRG/0KWtieBR6M6yYEv3Pj5 +5LDZPQ== X-Google-Smtp-Source: AGHT+IFw5CxBdphrH0oO2pIqnbwppYx+xeDmInG4DbSWMHLYMTF4BCdDpwkczfpwGniJ6rB2By3vVlUyf6uu X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:d852:0:b0:e0b:fe07:1e22 with SMTP id 3f1490d57ef6-e28936be881mr14121276.1.1728158196428; Sat, 05 Oct 2024 12:56:36 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:27 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-18-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 17/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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) =20 /* 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 @@ =20 #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, unsigne= d int flags); =20 int get_arch_regnum(const char *name); /* diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 8019d232f515..29eaa9beca86 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(lo= ng 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; =20 - regs =3D get_dwarf_regstr(regn, machine); + regs =3D 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 p= robe_finder *pf) dwarf_diename(vr_die)); =20 ret =3D 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 =3D=3D -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 *d= bg, if (gelf_getehdr(elf, &ehdr) =3D=3D NULL) return -EINVAL; =20 - pf->machine =3D ehdr.e_machine; + pf->e_machine =3D ehdr.e_machine; + pf->e_flags =3D ehdr.e_flags; =20 do { GElf_Shdr shdr; @@ -1171,7 +1172,7 @@ static int copy_variables_cb(Dwarf_Die *die_mem, void= *data) (tag =3D=3D DW_TAG_variable && vf->vars)) { if (convert_variable_location(die_mem, vf->pf->addr, vf->pf->fb_ops, &pf->sp_die, - pf->machine, NULL) =3D=3D 0) { + pf, /*tvar=3D*/NULL) =3D=3D 0) { vf->args[vf->nargs].var =3D (char *)dwarf_diename(die_mem); if (vf->args[vf->nargs].var =3D=3D NULL) { vf->ret =3D -ENOMEM; @@ -1403,7 +1404,7 @@ static int collect_variables_cb(Dwarf_Die *die_mem, v= oid *data) tag =3D=3D DW_TAG_variable) { ret =3D convert_variable_location(die_mem, af->pf.addr, af->pf.fb_ops, &af->pf.sp_die, - af->pf.machine, NULL); + &af->pf, /*tvar=3D*/NULL); if (ret =3D=3D 0 || ret =3D=3D -ERANGE) { int ret2; bool externs =3D !af->child; diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index b9a5afca4cc1..71e21cb4492a 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 */ 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 */ --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66257185B57 for ; Sat, 5 Oct 2024 19:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158201; cv=none; b=QgsyjhWCfnqEOB8516JTBuVCDgmTpxknygjbehAG6jCCAueFlQlI/33fZccDGZ6yE1MXQeUxGxChXiAZueSHRhB4jP1k6EWFLKeQvtE3kZwaGFaR+iuhpsve6FXGkZaF4ztty7xcDTLnQmmWINYjCGJF9nBGq2Rxv9sNejrGksc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158201; c=relaxed/simple; bh=49KaBYkgiQCH/sxX0+BhoWOtHOvGgEnOu9KKe+ceHgg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=lIIYy9xvxpqFztoo9zO4DCJH/vtWyVEN4wIOcKLFVaycZYScpUS13t1b0jWErwJXCtZteo16a96MIk2u3354bewXaLJmb/jHhqtUPaeUsP2qVH0+NokcPgeiq76YJ799gIUUWuVFmNGTkRjbUuatBLDTlFy2D3jymHDIrB9M5do= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ORLCPsL6; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ORLCPsL6" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e28694ff555so4916775276.2 for ; Sat, 05 Oct 2024 12:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158198; x=1728762998; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=CNGVUzOXKwKEko/OAaLmYeM8n2VtlYeblr7R3DSaWhY=; b=ORLCPsL6p0veqUhFpPZTFKJHjs6NeUfpWfnXfw0kRnL32WZYv998UQXrm2YKOO70Tm SanYNZm9wg+CJOUoSbSNIYj5iqnDk9JoofL96VE+c0FJ4o27KBNzXFl/fagJRbR3qecB A6m7J5xoRLzd28ifbWsrYiXc3SaZK7vF8XQEAVsbEkWZAFvdadRYdu9TYMk9zlziJSiP L4SsKrcps34T90ZHYRxlXc4DagwZXYpUQftfOT56E2bs/eEFbXPr4ZjXEAeuCGxMNEF2 CzscSHHSNWeXAzY6gkCybxRl7pp6ntmGVxXil1042jXSJr9ZixzaN8fBmFpl/9PJz4Jd m/WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158198; x=1728762998; 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=CNGVUzOXKwKEko/OAaLmYeM8n2VtlYeblr7R3DSaWhY=; b=OAOA8ho8QyMKUsBKNLwwD4XulOJCY0nI1OKT6fS24UFPV/9OgkF83K7tvLTwCsdHf0 FIaiXIZ7rp55n5vokwhcmNOSL86kPPGGcj32qYiC2wld+CNUnE/fpiH4TIzhG1RA1K2x B4pXJ3v+aDzKZvJOMbnfX2k6xGKtRr8r8RAobSWaI8ZHUEXsk9QrYcBBKfmh7wK+lVyO uI1FQ00Tk6y3MKYR071HmW4Kqc6XHVobJYkYFrhu0Wp3kwNi7n6a+g8gL6wDrwua8JK1 yNdJNSB5ppeeCr2/+ug2m+g2qVQl0c8Sc/HiA2/q2vSpaOpMPVjr3ygEFSK5dBx+brMA epcA== X-Forwarded-Encrypted: i=1; AJvYcCVMZut0QqNWkFj9Vfe4ue6lBVtCDUfQmYAKHrLCJucDKLLrXQhPoAfYbbGHi82IkIa8IpdONiavGFYuQb0=@vger.kernel.org X-Gm-Message-State: AOJu0YyMX8KMBvgwxBBUX+v1SrrCsqLaa3L8NXBBgqsTPiRvLiND2BYM u5IlYm1UTxpMmj1CMMwISKBtkymDGk7oX8P7nwCzVrwLReY3WrktlHl4t21haPfixIx1QwneATk ItN3yqw== X-Google-Smtp-Source: AGHT+IFzfrKFHBTJFAcCSdwh/qg6jN5gpz4SXfcgyMqV1tiB3/k6fNsR9y4uPMkIlIzDZudO3VL2v9PECHkd X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:d003:0:b0:e24:a28e:9399 with SMTP id 3f1490d57ef6-e28936d2d3bmr4324276.4.1728158198436; Sat, 05 Oct 2024 12:56:38 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:28 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-19-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 18/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D> 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 =3D> 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 +=3D evsel.o perf-util-y +=3D iostat.o perf-util-y +=3D env.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o -perf-util-$(CONFIG_BPF_PROLOGUE) +=3D dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 1d08608b7e1b..c2221ef431f3 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -202,6 +202,7 @@ endif perf-util-$(CONFIG_LIBDW) +=3D probe-finder.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-aux.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) +=3D debuginfo.o perf-util-$(CONFIG_LIBDW) +=3D annotate-data.o =20 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 =20 -#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 =3D ARRAY_SIZE(x86_32_regstr_tbl); -#else - size_t len =3D ARRAY_SIZE(x86_64_regstr_tbl); -#endif - - if (n >=3D 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[] =3D= { { "rip", DWARF_REG_PC }, }; =20 -int get_arch_regnum(const char *name) +int get_x86_regnum(const char *name) { unsigned int i; =20 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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 + if (machine =3D=3D EM_NONE) { + /* Generic arch - use host arch */ + machine =3D EM_HOST; + } +#endif switch (machine) { +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D 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 i= nt machine, return NULL; } =20 +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 __weak int get_arch_regnum(const char *name __maybe_unused) { return -ENOTSUP; } +#endif =20 /* 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 mac= hine, unsigned int flags machine =3D EM_HOST; } switch (machine) { +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 case EM_HOST: reg =3D get_arch_regnum(regname); break; +#endif + case EM_X86_64: + fallthrough; + case EM_386: + reg =3D 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 */ =20 #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, unsigne= d int flags); =20 +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 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0B77186E57 for ; Sat, 5 Oct 2024 19:56:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158204; cv=none; b=dKJyTkwlkBWWVp1GuAX7+PzMOrlfQmNooTgMi1K+6a/yAueQ7CzP1+Y04uvGgED3qlA3gzNtQrKLIMHgNqIM7kpXGa+0JhGv8Htt989whhTpWx8r7ZHgpVS0COyG0BdDNkUSdMgHtD9owRt6pVPR+s384/a7BFPY6ntOkaPECe8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158204; c=relaxed/simple; bh=SDugC5Fmr5Dawb8X5uOg5CAOpIZm6mwbqr5u9pTXYHg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=XlLDiAw3L+X2hM3YBnTkepG/jKqBO+tdZ0gPAkYv+rfS4DJb8sGFqtm5I0mvf6BlCKCDinyZImaCJizVHux5BlX7YW1kguMYHEC6J9QmF+3szfFJizQXde6Syil1PF1tREptziE3UAEd7nq7thgZgN4KBIXHkpzPqe5AQOdBzP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dWJDljmi; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dWJDljmi" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e165fc5d94fso5051169276.2 for ; Sat, 05 Oct 2024 12:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158201; x=1728763001; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=6EN4TKuEmqwMJ3OScRLpO+TAx81nKWqvaFc41rGg8u8=; b=dWJDljmioHgYRyxHJglbv7vi6Fl1uoDN5b5uMhos49Ji5tpsxKIuiPEPlAW2e0V75z h4ILDsfGf75QoLOlL8zEmDOdQwX2OPqJ0tA3PbpUG3RASN/drMvKhOnySMXsHr59VgXA t+l7O7K87ht7qZEGPhdbcOHoiXjKDOPqB3c3rt18Cdm74PMuelqXQ48X1I/qr114U9h+ iPQKPzju7ZqrPafkkBnFYcSrP9hlMj/la0Hcpqp8otE/2NjdT5SMVa9gpA6EBofOibUR zAKRe2zrw7lWytkpe2O/Mwxl7kVQsKjgrAYp6mXqKr/XXs6z4HNbBfrDd66xPvv8+gON NNzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158201; x=1728763001; 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=6EN4TKuEmqwMJ3OScRLpO+TAx81nKWqvaFc41rGg8u8=; b=f83OKkq+3niTUDe93T/yA1wXy9ZmGERPio8Ppcmxnt/7CuL9NVcqqECzusQYOgsNt7 0Vl2YTS+/vs8wFlPhdgbztcq4mQTE7TD6Hnw7xGNRObkYoAuqE91d68FvQQwSsQYdUMy PPB5fANugpaQNYtOzUiaj5lPWKQsIv96Op5q8ArvgkzLBWkgP87sBde0ZWFBjY+7P0v1 8UC8bjKwwI0fQkNxAzicyZz9ADLwTKnVY0wpJJAEVZDKXMtuP9U36EidNbzLjXitM4ta yB8V6iZNWmBzwyeRtYqAesgupAnJFDOvJEzK4k01gO89GzfCvQgX9P180Xw/aPUPN7po FvVw== X-Forwarded-Encrypted: i=1; AJvYcCVZ8mjXQp3UrAKlpTTnHtD+ozStTYcqGoo65BhcS4mHMObZLgmh0YPZ6rRz0BESUVtnMnSn8MwMLoh035c=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9wmlCYnj7m8PBd/tUr47lVLZ2s0bxwkh02bP7pTMC/HIl7g39 UHK9ImH/vtLJzlW0xMvNeNsl4SebK5LVBfJsrNZuZlUlOOfyePy7bm+0IlcrYOOy0/+ZsyvDXkB zvxEbjg== X-Google-Smtp-Source: AGHT+IGCNRxOO6T98fTFcdhPzhDVLhkuLPkxWJvPTvDz/vHXCXgsisg4y9asEuXLcvL8azfDw3NHB+5jV4SZ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:2d14:0:b0:e24:9ec4:7297 with SMTP id 3f1490d57ef6-e2893950a0bmr12214276.11.1728158200702; Sat, 05 Oct 2024 12:56:40 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:29 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-20-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 19/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Acked-by: Masami Hiramatsu (Google) --- 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 +=3D perf_regs.o perf-util-y +=3D tsc.o perf-util-y +=3D pmu.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/arch/arm64/util/dwarf-regs.c b/tools/perf/arch/arm6= 4/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 =3D r, .dwarfnum =3D num} -#define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%x##num), .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadw= arf64.pdf - */ -static const struct regs_dwarfnum regdwarfnum_table[] =3D { - 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 n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct regs_dwarfnum *roff; - - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (roff->dwarfnum =3D=3D 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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } #endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 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 */ =20 #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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9F2F187FF5 for ; Sat, 5 Oct 2024 19:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158205; cv=none; b=At5d1128J9ne0ZOwAm2pWtCWC3yGehMfbj5IlmWYP8uSSa4bnIdqWOh9XhuBmSMB35LipckUWqBJcmvHCfC+aEQXygjStUs10xaCfTjoojZdyuEOw6fAY24JkseD2vWR4fB538dgr3JgXMR7Ej7ffoXV03s5GA5IsPfpnVTUiKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158205; c=relaxed/simple; bh=kXNwRqhYw2oyTtE92Hlo7PIb68o0Ad18nbAfRGxWq8w=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=cs7fdPR9URFzpr1C8omFIFQZSCBDA5wuxDy11A2egarmbAwl26Zhn4X420kco1T1f5laJbFKQQeRvBlYpNiBMxfBBUXJxPQXBe+BVeXDXKEOe+vJ7I9O2cYEB4Ov5Swr9Z5Y8zm7EVd6OunsQdOKXptQ5jk2+y9ynKh7oPdHfsM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=c8mZptUz; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="c8mZptUz" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e230808455so40287307b3.0 for ; Sat, 05 Oct 2024 12:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158203; x=1728763003; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=VHudwD3HxqIE2xCZ8D7KanMs36PPvPHIODUgdbqENmk=; b=c8mZptUz8k/TX5vlvI9UcF5EEhGcbwnABL7Y44WzFu+EDMJUpfhzmm0xySu9y/DEx3 lcMZnpJdQqj4qwGiQwPrcJ5cnHmxQoWb0r99gnv7xvC91h+sqPN+XMT39L57YF0/dHY/ cD6HqH4eGBZG1+uQ48VP32nG2Zibu4amAnzWcRhQINP1OA6vEd1AdF3YsIbzotFG29GM JblywqiJEIzsemHr0VBbgUYb87l7tbc1z2AlGC2sHMzGxjZUCdICY97I8/nM2Gnl0f5j ej8/lPcDKvSRtH4oLqyz2sHQhuivu7wDnEZ2BtBcOwPOgY5SOuUApgYCRK1aJu1fQVN5 jbvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158203; x=1728763003; 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=VHudwD3HxqIE2xCZ8D7KanMs36PPvPHIODUgdbqENmk=; b=W4wwcphyRSjvnF/cQPuIxGw/uZA13k9mNU2qaN1hpOG1XJh7wthWCGauuqGJkywoYj S7524xDnyXm3LMAn2KO3w8G5TtVkfRcG1K5+naMilm/cd50mAIqys0bAA0FJC3yxOYuJ sCVg0V7Jk/I/3D2vgPffvrtWAcgfU5nae83Me111cTzM4UPsasfjfV8u6naOjcxKzESM ZLFR5TZ8D/zknqrGxkyUmolQQK1lKGzKijrTKJMVkr79L/tsnkxC2PXNznuONIml919t CpGfzb+WmiNz27jvoqnUwureEueZGLlYRBzRY0clBgCLV66j/obD4VR+hvODNUcIdbPU OUpA== X-Forwarded-Encrypted: i=1; AJvYcCVz5ustL4Y+fIRQWLHj2eW0LyjWPUPVTXR+w4GDnF5E9MKbEXrVHVwUd17gtDLxMx3e8TUqvZabVcoTkXI=@vger.kernel.org X-Gm-Message-State: AOJu0YyTE093L5aHscZWmk6xGK7u2YJiPigsNjJXQKvJyEuvt2BsRaaU qDzT6xcLNGfdAdwVcxg6VLbDqXX37Mn6SNA2JVqMesPWA8deaaGH7dh4r2Jd97oVwTMQplpOyzZ +KiCAmA== X-Google-Smtp-Source: AGHT+IGeOfTmumngcabHRBihmvSKyViFpRQ89UdAfehUtwMJwCeL6FioC5a/4B+7LmCwWalq3BF9Zy/Nx0rQ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:61c8:b0:6e2:e462:e191 with SMTP id 00721157ae682-6e2e462e214mr604667b3.6.1728158203030; Sat, 05 Oct 2024 12:56:43 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:30 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-21-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 20/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o - perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 diff --git a/tools/perf/arch/arm/util/dwarf-regs.c b/tools/perf/arch/arm/ut= il/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 =3D r, .dwarfnum =3D num} -#define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%r##num), .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -/* - * Reference: - * http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040a/IHI0040A_aadw= arf.pdf - */ -static const struct pt_regs_dwarfnum regdwarfnum_table[] =3D { - 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 n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct pt_regs_dwarfnum *roff; - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (roff->dwarfnum =3D=3D 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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } #endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D 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 */ =20 #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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11A6018870C for ; Sat, 5 Oct 2024 19:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158207; cv=none; b=sulY6KmMpKsaGYragj9RWYFxzgm/xFziY5Lqd6F8NLxfeGlfxByGyKCkXE4mRiCFMbXqf5kUZbL5G8l0gL1osRtFiF18ZRv+smlLwhbqf2S4OWq5t5CajVU/D/nDLanyGYC/GYzsytSkr5HUqkauNe52QYW2GvkMQmbwNhpocTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158207; c=relaxed/simple; bh=C/R1IGxCC68hJSV8yW4I2Iy08ehcQxHQMz4i3spVrl0=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=MjVGalqovAsIjHYAKl+CwZJfzl3k0NE9ct+p6HjPyqH7ZtTqAkh18yaM4fuyVKOJ67ubyrOZvMpIRJdaSZjzDqnBT0AkA4aY0Cvu2/mjnRZZDS1dR0s1f0bENBosHQJ/pKsa4NZQbv2Z/lisd5Zk55j/0Zu+yfZv0nhI2esuNIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UsIwtW7j; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UsIwtW7j" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e287fe738f2so3783469276.1 for ; Sat, 05 Oct 2024 12:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158205; x=1728763005; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=GhqqVaGZmOo9qC4oo0q/uwTQj9+Y9nVOVKHgeiFJY7I=; b=UsIwtW7j/o7b+Y7+B3HEaqX27LVsEbzKBOukCiIWOVN4RncmTzFHbjJUvbkTAtpekd i/Ri3xb4zk3Rb3tAkKzqyPR1JZhQJJHZxyEIqwFqfAvPj7ixE4MLMOVl/JFDzs6wZ+3l QglwqiQ9uzvfcFo+JZAaST5l1J90EuY9yQGG+mB3/H/Ey8RlPowFrZawfn0x1wp/lqNZ SfGbyPJ7FeTZHLo0ydUR/imunygOYBTXBmvkln9bMBUuacwVEA9H3S2Lhoine8s9YzoP tYGvnM75B8m2wcH4H+2g9lePGkLQvXqs+0L8iXw/x8RhMzATIidEqg8dqcuTvwtLtoc7 Uthw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158205; x=1728763005; 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=GhqqVaGZmOo9qC4oo0q/uwTQj9+Y9nVOVKHgeiFJY7I=; b=JAL+z2r+/OV+kBGHU1TocllOEdfGDge/I231Sya5H3DaHnJTUTC69EvZLoIliukgjX Hcd52S3Q4lIdFaduQfxTIX//ddjgroYl6zuUtfVZrO/CR8HgIGYJ/j5Z/84LtFHtt5au ZeItBJMT/WvnsY6WC5qiws2ct0o6VF+lLISxeB0wZyx78RIerPhXWzd83waMAsfwd4Qy AE1Nlh1D0sGFx4rjSoXBCkDEdjLklf3wlgzHBcQX7dcgmlZEGu5u3h74p31E6LNZbFM7 UIYZrgf9jBhz4tuXSOFu6UflrBJHRekqky4C63fyKu80KmoeVhLAl/l1IEtFnqDpSdKL yF/Q== X-Forwarded-Encrypted: i=1; AJvYcCXShHjqUuqzzLAPSppKimH6ogMH+HggI4jPwR+IXBCHo3HiC3PaxIccuuBO0NP2qnJylDiMNp4uHCgIGGo=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0+DCXH8pxMSWktm3Dla2ivNAuKcYLcWXAaL9HX/azx+CyCzy4 xXIX7Ls/IovOP9pVXNR7egNdP9mFb+DOQMPaVuLzEADCGR62wdo+OWBmzJISyl1AWpz5FIIsQie ALguoMw== X-Google-Smtp-Source: AGHT+IEYRFo/fWSM7s0rsO5HBzMUs/VjHez83bNv/Y68jCxqYjWk7CUUEsc2Ty9/UzFK7TfFboZq2Mftucjl X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:6f05:0:b0:e20:cfc2:a326 with SMTP id 3f1490d57ef6-e28932a484bmr64007276.6.1728158204973; Sat, 05 Oct 2024 12:56:44 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:31 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-22-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 21/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D> 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 =3D> util/dwarf-regs-csky.c= } (74%) diff --git a/tools/perf/arch/csky/util/Build b/tools/perf/arch/csky/util/Bu= ild 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 +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o diff --git a/tools/perf/util/Build b/tools/perf/util/Build index c2221ef431f3..c75366b60b88 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -202,6 +202,7 @@ endif perf-util-$(CONFIG_LIBDW) +=3D probe-finder.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-aux.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-csky.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) +=3D debuginfo.o perf-util-$(CONFIG_LIBDW) +=3D 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 =20 -#if defined(__CSKYABIV2__) -#define CSKY_MAX_REGS 73 -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] =3D { +#define CSKY_ABIV2_MAX_REGS 73 +const char *csky_dwarf_regs_table_abiv2[CSKY_ABIV2_MAX_REGS] =3D { /* 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] =3D { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "%epc", }; -#else -#define CSKY_MAX_REGS 57 -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] =3D { + +#define CSKY_ABIV1_MAX_REGS 57 +const char *csky_dwarf_regs_table_abiv1[CSKY_ABIV1_MAX_REGS] =3D { /* 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] =3D { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "%epc", }; -#endif =20 -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) =20 /* 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, unsigne= d int flags) { -#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM +#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ + || EM_HOST =3D=3D EM_CSKY if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } #endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM +#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ + && EM_HOST !=3D 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 =20 +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. --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D3BE188937 for ; Sat, 5 Oct 2024 19:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158210; cv=none; b=Tobfeo5dMfYIrCyKSgt2nw4KUL5wNqjwQbFsBMuG64m+OVSRj5B2kl8Ei/MscXUK+qlcHGmcF5cgYKIKbub3tHYzLhwALv31y+r9ShzQLBkoBC8n0PLIFgl9k1/BPZYPAt+kFvJ0Lk4MpE/HdwRDtvX30RqgpWeAC64aW0dil9s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158210; c=relaxed/simple; bh=KPXFlEwWt/UGl7qiXtTbrMb7WVi1MkyXBOPi+pW+OQY=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=btAQs8N8EUkbI+iz6Ayx47Y8QE7zPYHKisRABKiCohyXCB7OL0hUYknYZG/pShxC68orXemxBjtUK89HzueihGHRHasvrxiOVxTviPrzbTn2HdDGM8JDMEU7QFg1rWb1WAXf6EEME1gzRydANJE155mgNhceqow9ovYQa5DUXW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=sn9te8xZ; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="sn9te8xZ" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e230808455so40287537b3.0 for ; Sat, 05 Oct 2024 12:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158207; x=1728763007; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=q4nfym4aHRABgeK2o4kYgh7MQauDKY/5wnwGVKCXL/U=; b=sn9te8xZlw/6cDKLa+pSkj8uevcvGoeIgSFMNJWIJZ6O9ehrnHlCyCf9s1msd+ZTKu 8WlrLji7Kb8iic+5luj58swwTRHWYXkZhEqocZNrW9rtNhM7Hp9KSsrhZSuxY7r0MXqE Y4BnxDlu5U86QgVis/3EWrZf4QEVa++8CZLPtw99Mz41KA7WcsSy5hLx1XN0D+APNIVi fGzqom7k8bDId2NGMWHxOP4uvqSvgjAL008FFGvJyL79JPXET8FY/lueBWPbJ0XBv3QT TFIJuhJZUuayDWcS91adRd5PTWySUYZiHir0f9x4AG7186/66U3+czEjkfA74Y561MNb 1bWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158207; x=1728763007; 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=q4nfym4aHRABgeK2o4kYgh7MQauDKY/5wnwGVKCXL/U=; b=TAyFX6rpJhWSqSiq9TDIOTo921rQ9b20YcqrtZqYOVSXL6BtlHOcmLZbpEqOSDc7TT bXPFSR7vQhaHauJeEtJ+ZMCOdm+N2F/55tt+nUlH3kQ/PhYHh1Z1/0RrCW5xQbiPskZ9 olsXkF4qUCDfRG8/Gbop+zEEZDBld8/V0JknqPlDwMa6zofLkTffZlok3Bz6Ifr3SOt2 kigXlzxx24IdXE6aLwKx7gjHOWHOTn0Wj4/BMTYj3tTLJKHeK1+c1M9ZVrJ9kLo8IAbb eC65xREkOILqhqX1/9Rs/TcO0QkCyVs2bz4iPFo3DhQZnKHTIH6ZkAomguWMdS5o5//F 2fUw== X-Forwarded-Encrypted: i=1; AJvYcCWmhj03x7MFgKHvRCpbCLN99G0da/xDC2xQb++Fe6WMaTzdxLnKgv68tGadakH6Pg6jRzsc1QDIhReaPXw=@vger.kernel.org X-Gm-Message-State: AOJu0YxfQVBLLHa6avtu/GRI9Qct6leu+QJY1G+Y6M3lLF+hFrJ8pIoc 8kisqpumP9NUq9PAk/MQ/EmI9wWHF9FT4ygN/WotGumZLShGeiEBsflB+otGnOaWFCF8YezTn9F z5KvTyg== X-Google-Smtp-Source: AGHT+IGwFa7Hd++IIPfhdwWa5aoWpwfc5FH4Qfd2Wi5L5CDLWvwjg7FsZhYuik7PKcUvMabRjFi+c5q2jqfZ X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a81:93c7:0:b0:6b1:8b74:978a with SMTP id 00721157ae682-6e2c728f13bmr1856917b3.4.1728158207463; Sat, 05 Oct 2024 12:56:47 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:32 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-23-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 22/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/loongar= ch/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 +=3D header.o perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D unwind-libunwind.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D 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 na= mes. - * - * 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[] =3D { - {"%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 %=3D 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, unsigne= d int flags) { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY + || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D 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 !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY + && EM_HOST !=3D EM_CSKY && EM_HOST !=3D 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 */ =20 #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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D989187FF5 for ; Sat, 5 Oct 2024 19:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158213; cv=none; b=iPo5tYo/K1fx4r97qIa6sgu1mLGcNCnkm4LMCaEvE9ZMtXXX+c1P/0csi1o2muKZAvO2nm1OkUoIoqwO5630oAyQH3QT7tY8iA+fX0J1r/TeWhjTJ0bOsVANN66GB4TUctLljUqCSJu8Q/JjkAz/gtumbs+vGLH0L4TLILKjKtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158213; c=relaxed/simple; bh=LW71KAwfTi6eG9vq9n5agNT7JJAELLoTx+H3DXkGY6c=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=gzLkpBWLsmtMTp0KL06ofEualnZCUTr8VeMzXtnA1IxS2Wd2Jm35+YQfyCHCuK4LFx5YBuwMt8eBR7xL9r8dUtajCDv/FA9FiotNYlTCD7dcXFEe2/tDNXWz8BP9O1m27FzAmdwPjcI3h3VwZZfDYA2cZTKi+mW4STdFoCmQ6nA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OMzn+J0q; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OMzn+J0q" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e2acec0109so55183657b3.3 for ; Sat, 05 Oct 2024 12:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158209; x=1728763009; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=3UNBBKLriPYWF4cbzt+fW/Yb0JAtoFXD8tWOi1OErdE=; b=OMzn+J0qTZi8dE2s3Ulg4JUM+T9JBVX43Mmp7+6bCQ+uI8KBJ88jajZObioY6p8NNf vs2wFp0abGvOg3HVzLywlWOoVt4dOxSp4c7fQzft8p6bb5122imTeA1wGqg68Vg7+pJA KzXxECTKmT1d0Nlz8xTfPYLNyqd2mpPNCgtv944k7bEfmow4PFgqFMiL2iqS5cCqj0tu Wmz4peHW48ryCa+2tPFAxCTAUsVwZF15iWeVETzDtAahqjs/Dc5e9JdExq2xgYHK2t4g 2hwYUh9slcvdNDKfM9ySnP7Vu02ZpN5e/PkkB0/yRYl1nfleKN8Mf59SvuLIrBC2AkUx Nb/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158209; x=1728763009; 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=3UNBBKLriPYWF4cbzt+fW/Yb0JAtoFXD8tWOi1OErdE=; b=cXJxuN1Oqhfhs4tSeixod76VWjsNCNhJp8LDJ6fO/TdW4h5iyb0VQkIjmIMT1wi2YZ F+1YeAdubWkPr+DFNx5nhKACgvK/MTSjzr+mMA2HtRgIpCj3pAVaVx2jEkWijs+XsKwQ 8zMFAT0l1RlX95mUrsOJ+kdQJeroeCMnbEwiyCqfMKOElaYjTMer3XPCMQL6LvBz8vsF o4oWziYYCIOPLpnx/LVnRII+tCdLv0FFLls8YFrVJmuURSjxMOdUDMdUv8Hld0OBWFA2 QGZgBYKJEUVEejOqPhojQ7XFksWWqKGaZMv0m9l13CWOB3fAWqZRo6qtxeWxbdnGsBO/ aF9A== X-Forwarded-Encrypted: i=1; AJvYcCUWfO3q18uxBpAIy7ROSJbwyTS7GO/RgD1LFRmZ8MRzgZzbYxdeqdypHlF1K6Gnd2xSWMePgRuRI0QZ44c=@vger.kernel.org X-Gm-Message-State: AOJu0Yzt0OLTAZzuzOuQFAbmMVxL32EloMUI+jffLZQFvKOb4enh2k2J 9H7/k49NyA2/82YJvo7SZOlPtbx1d8EVqD4D2gDbvAAJU5COy+lrLzNRBSYNzYEZ6Pw7+YeBgD0 VQcqJuQ== X-Google-Smtp-Source: AGHT+IGd8n4duwoirMvSpqfOv40zKZGdVHyzgM8WiLhDFeOCNQk3EZ65qgcXqmWv7lPgqHaXqfVgKLepfmDX X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:2b8e:b0:6dd:d138:d823 with SMTP id 00721157ae682-6e2c72adbdamr920857b3.8.1728158209657; Sat, 05 Oct 2024 12:56:49 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:33 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-24-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 23/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/Bu= ild 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 +=3D perf_regs.o -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LOCAL_LIBUNWIND) +=3D 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 na= mes. - * - * 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] =3D { - "$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 =3D=3D 64) - return "hi"; - if (n =3D=3D 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, unsigne= d int flags) { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH + || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D 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 !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH + && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_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 @@ =20 #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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9A611898F0 for ; Sat, 5 Oct 2024 19:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158214; cv=none; b=dfEeduIYgMTrTrN3UahbrewBnB/cqCYjCBxfLbZ8eJarR2+HmQXtrssL4f00bqWiho8LcUHQFqj3ageRLlUIieX0MeCRr6fBk4358c0muiYvFt+ROOx04xq4pGvaVx/3zsmN4e/3RmxNSQd0D8zpe5IFZn+iwEuDEIHNFF9vSJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158214; c=relaxed/simple; bh=5DYAHlf0rLCZhalxEUMWXUlz/yKVDzKf2OIt6zLEsVc=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=H9BQpy7jfJSlcao4WeJGdfRV1xKRDJw8t1CyZMtCtdfdorBfb6GuhhC5CFg8YYi58w71Cptehc7K5EDxKGViSuAAPKu1TiwljrQKs5sClRFTyWlLdEINdXF/4FeqycCkdBO5Zn7BC8nfb9D3W7H7bdakA87vGiRKzAGye2KMkps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=U5zBYHl+; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="U5zBYHl+" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e17bb508bb9so5105613276.2 for ; Sat, 05 Oct 2024 12:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158212; x=1728763012; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=aRi+lcVENZbrJUzC0eaednn+ntbJd5KWrvhCkItpN2U=; b=U5zBYHl+eGBU786p+Z3wxennc/7YmZCI8vYiVG1rax2jSgOAHNRNTFwB9ZwWO+U7tB Ndop22zgco8ixcdIYNEEW6xaTw76rLBuWhup2lEodqq4lrRCp14r2E+rKHwzFpXztUFz jXQLV8ItMC7FhMmezejlyNA5ohSB6zUjIlPWUdJ8cZFq7fQRmZlzLwy4ya4iS7bOz34h 2yeELUIRG97C8vaZrzAh/DFpp7sSpI1Mf/uQ1YJt116F8hsHwRXIXSph+ch1HscCyycN HGEcrS97amiiFDinz78Ta7tjB8HvgoyjtQJrOVlMPG4Bt1Ok6ansFBalBzAPdDx3ygX2 uJQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158212; x=1728763012; 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=aRi+lcVENZbrJUzC0eaednn+ntbJd5KWrvhCkItpN2U=; b=nPu+++XRXo2H1KmNgv66LygS0ymARQlL/DyJnON/e3wqVcR+azscw3tTEtcVG2uT3O Sk+JOir85Kd/ZPvcS6/fzKLjWM6gpfEhfpQWOZQCgtSaL1sH2K4JCyLYs/tMimDYSCNe HmltJN3pDsAp/OEs8mKJyAD0X6yXKBbU6Nl/hCGYW001VjrMApqgc4JizzMEiSIDxsas V+3xBlMIPKeeOFsyFHlDAY5mi3gFshwY6mZCOhCGI9khyjY2lojEVOP9VqP6f47h9eV4 MSiUTeYffLiNnItBGHiDDwxav+r4pIZwYh3VcgDWpVF6dzuwkLVqmymIqwdVd86cJQP5 +8Rw== X-Forwarded-Encrypted: i=1; AJvYcCXJ8FIMEibLj7gbrfL+sPmD6co4Ye3iiLH1RqMeZ26Q2pZ6A+ovvrf3yQZRT+Xlw93wseU9SkdBHwAu1Mg=@vger.kernel.org X-Gm-Message-State: AOJu0YyL5Pm4vjc9MF6JWB2FIrm2xjsB41/BBMPygAQltofbHGiFbDcc CgvrE+qJ5WLmqYCO/UXGRnZ+8Mbhk8+yKck42zJAa7rh7n2ofhWKUivJytd+ZiHFSEzHT9vjjg1 j2ZO1qg== X-Google-Smtp-Source: AGHT+IEkw/ELMrNSUzQsU1EBuZLjOXx5F0yUVy1lo5qjHP8zU12LCcvxJgDs/z9MoJn7aIa5VOHfX6VO2QWE X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:b21f:0:b0:e22:3aea:6eb5 with SMTP id 3f1490d57ef6-e289393a625mr13730276.7.1728158211820; Sat, 05 Oct 2024 12:56:51 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:34 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-25-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 24/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/u= til/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 +=3D sym-handling.o perf-util-y +=3D evsel.o perf-util-y +=3D event.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW) +=3D skip-callchain-idx.o =20 perf-util-$(CONFIG_LIBUNWIND) +=3D unwind-libunwind.o diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c b/tools/perf/arch/po= werpc/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 =3D __stringify(%)__stringify(r), .dwarfnum =3D num} -#define GPR_DWARFNUM_NAME(num) \ - {.name =3D __stringify(%gpr##num), .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -/* - * Reference: - * http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html - */ -static const struct regs_dwarfnum regdwarfnum_table[] =3D { - 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 n= ot - * found in the table, this returns NULL; - */ -const char *get_arch_regstr(unsigned int n) -{ - const struct regs_dwarfnum *roff; - - for (roff =3D regdwarfnum_table; roff->name !=3D NULL; roff++) - if (roff->dwarfnum =3D=3D 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 =3D PPC_OP(raw_insn); - - /* DS- form */ - if ((opcode =3D=3D OP_LD) || (opcode =3D=3D 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 =3D RA, offset =3D D, dst_reg1 =3D RT - * DS form: ins RT,DS(RA) -> src_reg1 =3D RA, offset =3D DS, dst_reg1 =3D = RT - * X form: ins RT,RA,RB -> src_reg1 =3D RA, src_reg2 =3D RB, dst_reg1 =3D = RT - */ -void get_powerpc_regs(u32 raw_insn, int is_source, - struct annotated_op_loc *op_loc) -{ - if (is_source) - op_loc->reg1 =3D get_source_reg(raw_insn); - else - op_loc->reg1 =3D get_target_reg(raw_insn); - - if (op_loc->multi_regs) - op_loc->reg2 =3D PPC_RB(raw_insn); - - /* TODO: Implement offset handling for X Form */ - if ((op_loc->mem_ref) && (PPC_OP(raw_insn) !=3D 31)) - op_loc->offset =3D get_offset_opcode(raw_insn); -} diff --git a/tools/perf/util/Build b/tools/perf/util/Build index c75366b60b88..c1204c05e9af 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -203,6 +203,7 @@ perf-util-$(CONFIG_LIBDW) +=3D probe-finder.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-aux.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-csky.o +perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-powerpc.o perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs-x86.o perf-util-$(CONFIG_LIBDW) +=3D debuginfo.o perf-util-$(CONFIG_LIBDW) +=3D annotate-data.o diff --git a/tools/perf/util/dwarf-regs-powerpc.c b/tools/perf/util/dwarf-r= egs-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 =3D PPC_OP(raw_insn); + + /* DS- form */ + if ((opcode =3D=3D OP_LD) || (opcode =3D=3D 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 =3D RA, offset =3D D, dst_reg1 =3D RT + * DS form: ins RT,DS(RA) -> src_reg1 =3D RA, offset =3D DS, dst_reg1 =3D = RT + * X form: ins RT,RA,RB -> src_reg1 =3D RA, src_reg2 =3D RB, dst_reg1 =3D = RT + */ +void get_powerpc_regs(u32 raw_insn, int is_source, + struct annotated_op_loc *op_loc) +{ + if (is_source) + op_loc->reg1 =3D get_source_reg(raw_insn); + else + op_loc->reg1 =3D get_target_reg(raw_insn); + + if (op_loc->multi_regs) + op_loc->reg2 =3D PPC_RB(raw_insn); + + /* TODO: Implement offset handling for X Form */ + if ((op_loc->mem_ref) && (PPC_OP(raw_insn) !=3D 31)) + op_loc->offset =3D 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, unsigne= d int flags) { #if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS + || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ + || EM_HOST =3D=3D EM_PPC64 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D 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 !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS + && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ + && EM_HOST !=3D 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 @@ =20 #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 =20 @@ -107,6 +108,8 @@ int get_arch_regnum(const char *name); */ int get_dwarf_regnum(const char *name, unsigned int machine, unsigned int = flags); =20 +void get_powerpc_regs(u32 raw_insn, int is_source, struct annotated_op_loc= *op_loc); + #else /* HAVE_LIBDW_SUPPORT */ =20 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 =20 -#if !defined(__powerpc__) || !defined(HAVE_LIBDW_SUPPORT) static inline void get_powerpc_regs(u32 raw_insn __maybe_unused, int is_so= urce __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 =20 #endif --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59A5918A6A1 for ; Sat, 5 Oct 2024 19:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158218; cv=none; b=M7XBOp5xSNwKh1Yfi7xsEX+3V698NRlIoxm9SMsNYf50Os/kCLmNUL3fDdtNU9VSZJyFv9c6Q+fh/LUxwaZR6HBeQnGWjqDGzGVh6+R2HOSIUSH6Wh4rMnHvdPR0uCW5OBkYFHdVKp9WQTrywA/eDKdjZRlvshu3cG+qIYgYohs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158218; c=relaxed/simple; bh=udd5WlhhnmwqnkiIWTPOqQEmfxASluatpyr3EoOTRkk=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Y45dzGWEO6Isy1UIHrUTrDpbBFIxTOy+wR8IYkda8arIPgSbph06ZQHG2NxG79IGnaXT+daS64Ffff9LhqAJgeRWKQFeJJ9RRsVT1msvwb7b0X+P6S3YSdlQz+WBZ+MtRDQ9IykYCXPbfnrtZ+snu2roIUoqn2eLWWEkohlTdK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FvJzSbIO; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FvJzSbIO" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e25cc76cae1so4921330276.0 for ; Sat, 05 Oct 2024 12:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158214; x=1728763014; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=LSL2ccbL1zMKXwe4tQXqPGcWrUHTWmz3veARUKGe9SA=; b=FvJzSbIOP869ukyWohO0qjsu07iV9QuxNvT3futPM3vorPG+CD9kNzaWy9+k96roAw XAKim42YdGAtLJSnkg41ubrpoVBRjW1MR/AXHkpnsafaX1kr3mT17BiFIF4qYEatsMOQ Q2lcyjgRvao1vLs/9H1Q17VOp9oF1sUjpllhFZHeM5GdG4BwqeIZRADqM0Ms2LNJPx8w IXqnovbbQ7rwDKja6V+jZYtf+JikDA4pQR+lgrEop2Yfal0BLwOB7doDi5cFPWByt8Hy F8IS1X8yNSdyzSh0r7sFCnKNtGjGVOzNJ/KaUi95LjrwfduseMfIoAvDuEdhzZRvHMpH FOHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158214; x=1728763014; 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=LSL2ccbL1zMKXwe4tQXqPGcWrUHTWmz3veARUKGe9SA=; b=HTl780PjCwnJl13Ops6jtbBxKT2rdHhURkJh1R/lYdcYMoUUNAAtM6krJcl7MHP3hk eNhwSu7C2NBUcX13HJHeRDKr6/lXm5S5H9AXXPg1J1agpLonBceCmSOXYWyixEgy8VbU fzamte/WvssgHoo3/GD/q4BBgfZMlnGPuMOyurKPqrdZA2QpgKZKYDED93i96KWyt5gE +ZjFXMV/NPQ8rid2ST03c4ZqU1/6zNxIVTXgjZC8wCxKcAgK4pxtu2jNS/ODJ3ihJ7OR Tuf5B8xhjSGjsgr97yNcmBwSQjqkfnWL6wXV6B3hXBtmmXuS6QutLsass8NZ2nLh4jL0 yaUw== X-Forwarded-Encrypted: i=1; AJvYcCVV7yYWul/g1+g0rZ7z6q1Lx9RP7tkkDCuAwMCfnhGhMmrP8WSkd/UOJinl8tIT2oybGdm8U1sZ9TukjE0=@vger.kernel.org X-Gm-Message-State: AOJu0YxOgszbh6ahS9vZVdF264cZd2z4kF/RaSGSzT3UFSwiqreoDyNs fwK5ZN4XC8vKIVAdJ+wJzCd1dXF/l5RwyHUdfYIqH8+9B57PdN5Lez56oja6i7dFAYvwGXGzy+W 1xSjCnQ== X-Google-Smtp-Source: AGHT+IFqH49xvkBQa7keg1rzZuWU/08D0ii8FTpSBX6sVpAkmGWs4m8R5YhQwlrDd8JE/onJIqb9MBMS1dlP X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:6f05:0:b0:e20:cfc2:a326 with SMTP id 3f1490d57ef6-e28932a484bmr64009276.6.1728158214036; Sat, 05 Oct 2024 12:56:54 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:35 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-26-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 25/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- .../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 =3D> include/dwarf-regs-ta= ble.h} (56%) diff --git a/tools/perf/arch/riscv/util/dwarf-regs.c b/tools/perf/arch/risc= v/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 */ =20 -#include -#include /* for EINVAL */ -#include /* for strcmp */ -#include +#define REG_DWARFNUM_NAME(reg, idx) [idx] =3D "%" #reg =20 -struct regs_dwarfnum { - const char *name; - unsigned int dwarfnum; -}; - -#define REG_DWARFNUM_NAME(r, num) {.name =3D r, .dwarfnum =3D num} -#define REG_DWARFNUM_END {.name =3D NULL, .dwarfnum =3D 0} - -struct regs_dwarfnum riscv_dwarf_regs_table[] =3D { +static const char * const riscv_regstr_tbl[] =3D { 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[] =3D { REG_DWARFNUM_NAME("%t4", 29), REG_DWARFNUM_NAME("%t5", 30), REG_DWARFNUM_NAME("%t6", 31), - REG_DWARFNUM_END, }; =20 -#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 +=3D perf_regs.o perf-util-y +=3D header.o =20 perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D 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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -42,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D 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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 951AB18B467 for ; Sat, 5 Oct 2024 19:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158219; cv=none; b=DtitVilH5RUYneHSvE3xc5nQBsXJrRvkoGDplbJ1pGpsqDfEfxUxw5jttyg22NWFm9K5oWg5LTQb4t4sSPfYw+5CpUBYMepVd95tXlfFouPL4ZqsYXvT9w87E7B5fK18k+hU6Eq/4zjArNbIMzDIu832dFANUaTuP4BM5zKkd1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158219; c=relaxed/simple; bh=r9NbAC8gxz8l4gFDeMBDREY0VhNgL6sfqWYNqXH4PTo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=Xj6GtipT1x8y/U+SZQyj/5P1NQZjrDIswZJJe1yV1a+Bep/oy21710i1YIM2e+eLHdKa4hh/7qmJ5F8STOcMig8CAFnZjXRNzDbXWxPg+xbEaKrWntJ4o+SzgI3VcwuobQmfXw1oZsQ3amwJPDctIN1A3P6JWqAksLWJiOsG7Ko= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hOA6tcNb; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hOA6tcNb" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e260b122770so4965128276.2 for ; Sat, 05 Oct 2024 12:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158217; x=1728763017; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=l/F9b72Zkf2GsIFu+2DXDg5IeMJO1DkrHhzQ8sRYn1M=; b=hOA6tcNbLVtKVy5Q0nJh/WgtxSlRWzraNrEnr6I7bFUM/1vMdZLqTV1ec+oGXtXCzn E3XSetYl/apcQXgCn5OWe4K48uyeT/k/YYWiBti7W8azZJOX9FY8B6cmQ9/jH6t4+aT1 EVuslUEN7lRQyMiyRr1CLWDRAxGB2DNnx5atEUqxG0+p3K3EINTTQoKrSjUVQT17HuoU Yswlz3pFgZE1uHNaHcVZmEuLCJ1xcci6gQueYbEHzdVhLLer42ApmhJ8zlp6S2MNmCVa 23txZbNNIaeZ3UGWRvmkflzvvB5QbSG4KBK9+lBSIO7+lLbTKPmZdnLUDQPR42gY2nVn QO6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158217; x=1728763017; 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=l/F9b72Zkf2GsIFu+2DXDg5IeMJO1DkrHhzQ8sRYn1M=; b=SAePlQzoKoddBXOU4PQffazknTjoRWAgsvcLjm1bqaF1cOuzxLOzcOlMgrGbXMNKDD 4c0+8pogGj9jbdOabDcyMDbvtIYaxJ+9zc28/wAp/b06uHvHnzxlyQNhe90kSq5cmKar E4rUtuhKLGzFzSMswY6+fk9Nsktvo/BtaR0tO9Sp8Z8qUU+X0qcBBh8zmojf3OVw2QuJ gEceLcNOu7ORA/4CoHA0QbG29IuDpnzzlh3QUdwltdV+DtAVEcGIQrSmzx2GgaxXNAqU fsVR+lhfQkHsHEton6WebMIJdPzDjCY4TVadsj65qQ2zp4miGbafA6Llgl2sfBd0EFWI fxqQ== X-Forwarded-Encrypted: i=1; AJvYcCWQ09upV1LhUkaMBrclKwuAJy0kssaL6zbmLjvpAfn2D1yqV6bEM58Eb4fL1nqeejwLXqRgU+CDSICL3d4=@vger.kernel.org X-Gm-Message-State: AOJu0YwwAWtaXOCPNPx3tCOmE/L3e+CpZ1b/KDH6NTidQ/5tir83PO9S 3yY6GCtmctTSdElaIa3P/f2QeqvfU3LcPqOGlqI9ib7ENJ+TeYIJM4f6fhrwGU81OFD1eUFQPsT 4Xvj+AQ== X-Google-Smtp-Source: AGHT+IEj5O0gwc8Gc93w9xy2xazDNAARz52y6kjE2x/HhCkqgnOqkwvm6mvHCmrWAxypq0YrA/EuiMHDARCd X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:7488:0:b0:e16:51f9:59da with SMTP id 3f1490d57ef6-e289391f800mr15573276.6.1728158216595; Sat, 05 Oct 2024 12:56:56 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:36 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-27-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 26/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/Bu= ild 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 +=3D header.o perf-util-$(CONFIG_LIBTRACEEVENT) +=3D kvm-stat.o perf-util-y +=3D perf_regs.o =20 -perf-util-$(CONFIG_LIBDW) +=3D dwarf-regs.o perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) +=3D unwind-libdw.o =20 perf-util-y +=3D 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 >=3D 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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -43,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98E6718BB89 for ; Sat, 5 Oct 2024 19:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158222; cv=none; b=Bae0/I5t3DFsLeF4bpkehMoHhFpsaTsTRljKJDEhLoUXFmnMzZ9SUKDRj9XU8GWB7Xup6BWBqh2oYQ1TC6QoFQoAby7PQXjeNeAcfPkgsnQjp7QkikGJmjO6kVbZ4lwPkSAD0iUYbR3L/7dW1rH5VhegdXOrfrlPCAYV/H7AksQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158222; c=relaxed/simple; bh=8qjRlEcZv7MlmzingnT/N+Gd/hYl6tzGS2IvVKEovyY=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=JFpkKwio5VEh/U+Zj3cvWU30Fa+P0jDE28qKtIuGm+7dB7DQFdq6nfqkt8hL4VmGF+vcl6rwTyVs/ETwl/RjyioauZPj8D0OEjHm/bSibuviGXyCXbO/6lM/sCUHI0BjFY0PLazbcw3cCqAApENrEUgyLjpK3BKafGh0TloICk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=SMli5bb6; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SMli5bb6" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e262e764f46so5589731276.1 for ; Sat, 05 Oct 2024 12:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158219; x=1728763019; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=ma4kgoFy2RIK7A+71lTzE6CEm9/tJ6zbTbn85DXB8RQ=; b=SMli5bb64C8AVHAjnE1qXfwQb5miAIj0T6FBKpDjzokxSwL/uClhnEz3229laFF4sy 4/e77FMOjbSzPYR4SOR0QOq1aW4YF+eblvTh/U531y67V3mXOcR+iV3WjtgKOg8qfAGl uBTE13zGAzF5E6ECWywOSK20eMel7GwfKTYH5pl4npPgeiIU1LsF+H/QhaIPYzHvvNJl /SWtzXWMMrne3IgktmFWmtIZH+8LuyFVfQWKnWaAstJ/RhvoRhR5Byzt1Jnm0iDQYm/P CHi5Tx/XfMK2tDsrcj8nMB/paQr7fgB0DV7WCNY+rtPPzw/goykew8akXNvUH+w3+rii 2CdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158219; x=1728763019; 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=ma4kgoFy2RIK7A+71lTzE6CEm9/tJ6zbTbn85DXB8RQ=; b=qDGFk818A9//Gr94gXneDMB/S2iS7rRz6JiEaYf+7yPnJ9v36pHSTtE/bWMdC1tbQ1 9rK8wQicsQspgyHbYTerr0sOHa8eNU1NDpNimxqS+/7iEnk6Sahp2jTZGz/RTE4ISztU akY6/DaZYaQ8pi4tRqGp8EVhhoG1yC/mT4W7SujYh3y1W17N6z+GH6yKjfFJuA/xQfRr V9uN+GCkp8w5kq45xicRp0q3nCQLW318xun+UNyBIiuK4gYYc8IRuNviq+0mKNPg4u6e A5soUYpdAYWu9I1yrUlb1syx3vBWowr0AR/qRXBjxdR6w2pl4mJERDdfC+6dbTDoKGPI wCog== X-Forwarded-Encrypted: i=1; AJvYcCWr+pHoGLT+HJ9ALaShY+PcZe4vC2vDi9f17YXV/0zroAIIR+J8XRAsa3Hly95Gud3jUzljSgnFnDDZHVQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzoqFOdNhn6JkUr31bQppwmp0ky3vR107hqDpNptuzR0ijRMAWw S8ThzqX3uMlWawWDYJNXXaPPueqLj7SeXCT5N+4h/KaUGN+yqDe7g8uKU4YR3z8hyWG1IkIjO9D yexp1fw== X-Google-Smtp-Source: AGHT+IEl51HegVcv/pl0KKiaLpVIfkXCyaK+ttN6DaWvP25wIl/YaqJ6jogCCBBTO/D119SZYDZzeC85Makg X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:aa21:0:b0:e22:5bdf:39b4 with SMTP id 3f1490d57ef6-e28936baae8mr4651276.2.1728158218682; Sat, 05 Oct 2024 12:56:58 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:37 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-28-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 27/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 +=3D 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) +=3D 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] =3D { - "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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -43,7 +43,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D 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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20F8318BB98 for ; Sat, 5 Oct 2024 19:57:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158224; cv=none; b=oRvT+Z5qu4vs9H6D7kJLG3RLopGNxB93dqfPnGA4IBEtBoPX3IbM7TQx9y7npgIjalXZvBuLU2rKnWrtyVc1ztSlyRkVm+4XiA73oHLaR/eLrs1NVSrxU/qWt92ZRPjyD2tiY9E5Xk0Ko6rLUsVVbflyhLfYmXivvTCT2VdCwP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158224; c=relaxed/simple; bh=ud+u/eatxR8lSjxU4/sjJPTzPGztQgHZhWOyJn7RnHg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=amuMcFxiJhqY182MNp2H13j7xu4JqMtsocJET6lvlop3swA8cGn9geffQ7zU05/jSFP/tvKd4rQ62u+EXVUXvFUOO2iswmNWs+NJJ2b800leegC1s1Mv3a0YLVCn0fivKCNqs+tzUdHuKF0R49XVK4IrMg7jAq906uLtc02NzQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cpU4xR+5; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cpU4xR+5" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e28694ff555so4916900276.2 for ; Sat, 05 Oct 2024 12:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158221; x=1728763021; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=EmoeEuCrVGDr9+YoKquNF8Xi70GOR2fm/afSJcJ29Mk=; b=cpU4xR+5RGRCKWcyG7dpWikiSn75SsdEQDcXzXNqjxDj4GG2Ai4+urzp67a+o/JgFd rbyv4B9SSktvoH6pOB0SpBjY7ZPILS9j8U1xFLcaMWcz/URrH8JKdj4g/Z+Fda8BzUD6 KSubolnfULj3JaE6aNrd1X0Cz2H7KdcbRp9o39g2sfJ382BQ9CharLbBlgle0hL89tFV IZAyEVp7TBvFU7//bCG3ZEHDH13QB5bNXvt7x+jmkSn3si23uma53/7O3fDFGEgLf5do Sy1xIOHs0FTmYBoN7HmCPVj56lZ+I1cxPzqEjGYEV+fW5OjBKFnWO6+K8ZMk2pls4P+l xaFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158221; x=1728763021; 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=EmoeEuCrVGDr9+YoKquNF8Xi70GOR2fm/afSJcJ29Mk=; b=IGvO/njO1XlcxVVp8l+gDHoxGjuE+2WEDC8iNOpz5CoZ7ae9jkCak7mCA/U6iqiRUo U4/3o8JGVUtTEWIhw14HbnUbsx/fMpLcSCR0JzFP4cYTEGKNEn9oDsu6ZVdWdR0F+ch7 5KnOsJr91IOZ1N3G322qCdg+XmLv7vvGOnFvTPvUW118cUpG6eX+CrtiQSJ+pFo+tguA StaXwJiA/rRkZpPWUDotFNWBqSecNCGLX96retY+dXsP0uqqXehDnkyjrtdcNEDYHxq1 3KtmB7UUYD23/VjSYjBSUiV9KxX9bz24XK0IfRa4yG+ziH6Dbd9G/4SjclzdCl99ukDf Vzwg== X-Forwarded-Encrypted: i=1; AJvYcCX1sm07NcuxC1lZS7V1UbuqTg2odUJKJ/ts4I1Nom4CDyKKVJw7BPhmIC3Re1L0Eluo4L4A152RjdvIuZg=@vger.kernel.org X-Gm-Message-State: AOJu0YynukozHvpF0mmM5feHgPgGFXOff6ROdI0a+sSWppVQJiz6UFm/ JK17SRlgSddFV/+77L/rkslYyv2q0WGccd1nGiQ2FcDUTQwR7VpC4gz5YsCuOStoGzVRg+STuMC zbnIhQA== X-Google-Smtp-Source: AGHT+IFm23ZIOzXg/tKwngJH/dLPKtNLjC7D9wEED6EI/kRFIrzWkVHnKrlI68/GiP6LjaWVtUm7B1Gocmo8 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:fb0a:0:b0:e1c:ed3d:7bb7 with SMTP id 3f1490d57ef6-e28936be3d2mr4614276.1.1728158220962; Sat, 05 Oct 2024 12:57:00 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:38 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-29-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 28/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 +=3D 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) +=3D dwarf-regs.o diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c b/tools/perf/arch/spar= c/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] =3D { - "%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 n= ot - * 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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH + || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH \ + || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -43,7 +44,8 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int switch (machine) { #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH + && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH \ + && EM_HOST !=3D EM_SPARC && EM_HOST !=3D 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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71FA018C34F for ; Sat, 5 Oct 2024 19:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158226; cv=none; b=e6hMsJcg0CRw+L7AnUMJHNDDWJ8zCIaaloVmbJLVF4CzUluCgW6TB60BQG1hHujFoNHUg1Sap1L3Lskllvp+TgSoCZg3BLE3X5YFzgP3GjvEy/Q+T0+8o/owNCUVSmudX+/t/Pj12QIWsZSbxvDWN8zQ4mue02+Vj1FxLuIHe1c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158226; c=relaxed/simple; bh=+GtmCKTOnorsBBNnJyPOkLl+5stCTqHcJSBIHoG4bgQ=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=jSWy+vhbJZDqt5maHk4vhEsLY7zCwXoKYU3HJhiEyY65aS5uTqsep6kdilezSAtufQ3eQ0nCYSephQoO2XJls/CvBgZtC29zM1+D1Z+ODGHTjWANoSOKUUVo1Q8XJZMEBacdkeMxHY1rBCIBH92VkPKFu2WUDNHyg1G0DsshmyI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=LPQISKi0; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="LPQISKi0" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e2605ce4276so5650771276.3 for ; Sat, 05 Oct 2024 12:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158223; x=1728763023; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=V9r02I9/reaWwVY1P5PCE7HG7NRQUH/biYWG5AAi0nY=; b=LPQISKi0FveNgtzssWfEfoHzxi3U6VsH3JP6MoOmqapgPsVGvgUn1vSBTqXAcz/+8R ix/K6fZ6vBTglJP39V1D2szNYCHtlaNbQ0Jp04x/V2ZKMcbSJehp43brqkf6I4/R6ER9 9qDZxehAc919DZFiWjdwRFZdj+bSUMejM15DV2EDZ0A+Z5nDiue8PGi92u7qemUkrRdV J1cMZPwpdtftRhgp2z/V+xWfirPv+v0gmkaXagfxJflJ3EvUtWBYR9muM1/RIlXO4Fz/ WY5ILmHbgyCwiQhPELrq9vSJowaX6rnMweeZX6pnWbatK99eOYJ2RgmF3Ee4/sRDxAuh NnlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158223; x=1728763023; 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=V9r02I9/reaWwVY1P5PCE7HG7NRQUH/biYWG5AAi0nY=; b=u4VRi31KcwpSvS1SqsS6vPEQ4emva01k34hHLaJtEgjDereuACFFpmHD9q+gbnXjk1 Dd/JP4lzjM2V6XuLySTva8vovBCidN3AXdBz044MJq6UQcHtIYCuaVGUKSFmqYJ+rTfM Fwen4D+19XX90WKaJ9kV5l8/wbPOVVC0cfHVLVVRwbzPZ6kAPRgVx+6Tah8TLhN6S/UD FyTximsSpxfAI3ib4t8X6fo0Dyzw4Jh2PCgxSKKUKKxDaXdd1DSv1NHmSSWWZqvpyMBt l4gsRHaBLntv8nu7PJuO2KSMceIjlGF1ku3vLUo5+nxQo4lR+dW3+tl33xNdW6w0IR8d Uj/g== X-Forwarded-Encrypted: i=1; AJvYcCVdc//O+9GLgje3pVQ1nikSjE19D8e26x4cgp390A32agybAZ9HzQ2XgXQ2pfxXFxL+bQXbV9h7NIvzkuw=@vger.kernel.org X-Gm-Message-State: AOJu0YwozJ5+jUTCOl4XGZ5i5N8lzvfsYGpEiS4LBTW/jfWeN1jGfuB0 9K/DeS2W1PT5DyxUcrLbPhMiiGZeILzvMOBlIe+xCeJxyUtcMzPJLwLFQZl7vR8+a+BlYZxbWyL NBjn/Lg== X-Google-Smtp-Source: AGHT+IEG5cyh98/NV6Z3s0KsXI6aIqDOuzALXm1Fg1UBkWYHg5crgQgGWUEdyntPKI0TigP58C1hZgymXz95 X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:b191:0:b0:e26:177c:86ed with SMTP id 3f1490d57ef6-e28936bb059mr4706276.1.1728158223465; Sat, 05 Oct 2024 12:57:03 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:39 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-30-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 29/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 +=3D util/ diff --git a/tools/perf/arch/xtensa/util/Build b/tools/perf/arch/xtensa/uti= l/Build deleted file mode 100644 index 2d1a48696ad9..000000000000 --- a/tools/perf/arch/xtensa/util/Build +++ /dev/null @@ -1 +0,0 @@ -perf-$(CONFIG_LIBDW) +=3D dwarf-regs.o diff --git a/tools/perf/arch/xtensa/util/dwarf-regs.c b/tools/perf/arch/xte= nsa/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] =3D { - "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 =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH \ - || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 + || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 || EM_HOST =3D= =3D EM_XTENSA if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; @@ -45,7 +45,7 @@ const char *get_dwarf_regstr(unsigned int n, unsigned int= machine, unsigned int #if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH \ - && EM_HOST !=3D EM_SPARC && EM_HOST !=3D EM_SPARCV9 + && EM_HOST !=3D EM_SPARC && EM_HOST !=3D EM_SPARCV9 && EM_HOST !=3D 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 =20 --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8973B18C93D for ; Sat, 5 Oct 2024 19:57:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158228; cv=none; b=aav7kDOrLnm0mlLIQQN35BK7OW3AssCZk03EiSyZ1asgZ5kRRuIPcpplegZ4YD1NuMCuLuhhdgCOR8Sy1V1glV4r0QhDI8MXKL98xvqOk+9e6nJj3rOwRrmagpFI/au8ryPHuqhBa01CB1ABgG+TIjjWu0SPogx+dswLH4vSE9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158228; c=relaxed/simple; bh=1/eilS3aKIVw4rN484yjxzHSBP1TB/2GhMWJ1EUyEi4=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=oQw+xRQXnHMXZ/VI6D7b3jQLeJpjWg+P/V0+GWTr97z+eNh5H+kGG+A5RUNNQCQPFHBj087oHFXdtebVf1P9qT3BHC8q8bW8Xzdbdib/4JMpQJ3OafRChStE4zvYZqcFDFwXsud394qm3GfzTcBk+MGpJKf4rNXbLyrCVRF/IWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=TbQqB8Hk; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TbQqB8Hk" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e2e5e376fcso4443097b3.2 for ; Sat, 05 Oct 2024 12:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158226; x=1728763026; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=LSNh7O2trPUtVrtwxznrhYE09HyCzuCy8rukfDtx/KY=; b=TbQqB8Hk7SUNrHD3kla2nJh/36C8hN+xsB36nd+CY/RYznXT4XgCK44qovrRmLtP00 +1KIh7wYwbD82Ty6fE0mK5G86DOoEW+saiyVr8KketUAflMaeJo/99TbcAs68zL3g6/F oxB2n5T/e+E3TrGmtkxfYq4A7UZ16cLcEocgjSpvXpQTFPc0NsVQW7meQJ3zIGpoAqqr D8LAxQGAW1Ja7wOuIXVnxHWkvLaJy9gb4rlSc0WclhBURWXSMXao5hnwn8pD6TnkGWeV K1DZahNHZB2nMIjB3tPRC6sEnzvihSPUpTq9VrTCTsFFW9Hi92Db/0xtmqksf1MJZHYQ 9fhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158226; x=1728763026; 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=LSNh7O2trPUtVrtwxznrhYE09HyCzuCy8rukfDtx/KY=; b=lEhKeELodc7Fo0DzdOr7ziTQqPt0rbm8beomDZBUWyEX7DLzUxlqiXaAxbrUDdCXcl KkjkFOD/TAukRCLcwW81IU8AEYjFiB4ZtgIum+pwJpOGfHi+mUmBdbuaS9kdSehLdtTx 7ZjWWHFm6gYVYsyoz5VBkYKv69I1KX1N2HIpkollMXQLwgYOH1WWzRskIMBhVeOYQaFw uQIm2UgQnZ8YVstcjPkgPvskEfO9PHCYf2iFlJ8X/ZguQn/xhNKqP8TtuNv0IQaiYosi +Gp3cdOc30Ggl7f97JPJgSW8LrnYieuNJL+90dG5GlWegFidt58r51rKkE5TLMsDPPM6 VPmg== X-Forwarded-Encrypted: i=1; AJvYcCVnAu24FMBd3tkJjs1xxHn9pnnS1XS9cxlFaXpaLSEqlWzWcwHpKZUJ1WhZ2UHSHwchEoHa++cks1gQoyw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5IU9jM3yrr2O1P07/H7qMR7+0b2yd8EQrPdg9fgypmYhAyPAE kRubqVPwpajiXsQZQw/WgW6XVjoCbwTJZ4VtAIun/uDZsDJUz6YDYpLwznd84E6/fBoleXXcT+d krAd3mA== X-Google-Smtp-Source: AGHT+IHa7tzQlt8ZfJU9HM6CpUwYm+2RPIugXPlK83fzJL4/DRA+kOB4v30bsPjrBffyPaLJb/8aQ0jYC2TM X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a05:690c:2b8e:b0:6dd:d138:d823 with SMTP id 00721157ae682-6e2c72adbdamr920947b3.8.1728158225532; Sat, 05 Oct 2024 12:57:05 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:40 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-31-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 30/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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, unsigne= d int flags) { -#if EM_HOST =3D=3D EM_X86_64 || EM_HOST =3D=3D EM_386 || EM_HOST =3D=3D EM= _AARCH64 || EM_HOST =3D=3D EM_ARM \ - || EM_HOST =3D=3D EM_CSKY || EM_HOST =3D=3D EM_LOONGARCH || EM_HOST = =3D=3D EM_MIPS || EM_HOST =3D=3D EM_PPC \ - || EM_HOST =3D=3D EM_PPC64 || EM_HOST =3D=3D EM_RISCV || EM_HOST =3D= =3D EM_S390 || EM_HOST =3D=3D EM_SH \ - || EM_HOST =3D=3D EM_SPARC || EM_HOST =3D=3D EM_SPARCV9 || EM_HOST =3D= =3D EM_XTENSA if (machine =3D=3D EM_NONE) { /* Generic arch - use host arch */ machine =3D EM_HOST; } -#endif switch (machine) { -#if EM_HOST !=3D EM_X86_64 && EM_HOST !=3D EM_386 && EM_HOST !=3D EM_AARCH= 64 && EM_HOST !=3D EM_ARM \ - && EM_HOST !=3D EM_CSKY && EM_HOST !=3D EM_LOONGARCH && EM_HOST !=3D E= M_MIPS && EM_HOST !=3D EM_PPC \ - && EM_HOST !=3D EM_PPC64 && EM_HOST !=3D EM_RISCV && EM_HOST !=3D EM_S= 390 && EM_HOST !=3D EM_SH \ - && EM_HOST !=3D EM_SPARC && EM_HOST !=3D EM_SPARCV9 && EM_HOST !=3D 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 */ =20 #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); =20 /** --=20 2.47.0.rc0.187.ge670bccf7e-goog From nobody Thu Nov 28 01:46:22 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB70C18DF7F for ; Sat, 5 Oct 2024 19:57:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158230; cv=none; b=NncFZPqZV58Z/GpX2KJHxHJxogc4lAWkBD8dgSedjbXzsIAz77i9ZrZJ7Pzw/ywA1LAAZcjl1ha0HONy4bmF4LETK6FCkxDfSOop95w2rXRXEuk9zdbGmlaBWB4sOGyrSW5LJGaXLlTlYGPjGsv9D9Mhhc9bFn2X1N30sGWQ5Tw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728158230; c=relaxed/simple; bh=b9mVgJ5//pRN+nonTTq/3RFTKjlofM16tMVTv2b7oy4=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=eEDfzyx2aEvTUbns2h0By3NLzKCDzMxQ7a4XV6xkXKq3z9G2ux4awydGwdB39RZChL00UiREkOuaSlQceHhXK28eULargbG1SDL10vH44OOyMuLvgxhSLkiB/K7u/+lUKShK8KZXJ0VocFvnNGKkSSll4QTpW8uoafcLigcxzlM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=vS+FxHI+; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vS+FxHI+" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e2605a8c7e0so5095075276.0 for ; Sat, 05 Oct 2024 12:57:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728158228; x=1728763028; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=nCot8RtXgODmKw1CZDuIEw0rJqcYXwewbxiKwbR/4js=; b=vS+FxHI+cjzwuiXV/hkFDb4WdSsJCK2mh/cB6PttWmbSV4m9mmZ9LmKKhkyH1fiGMR /WnqQDIGsjSQKnuMkn9b5BM5YFuglLaMutMRfyX8xfQQ5tr6YZp2fm6rkWPm3f2cABAi G3vX0ZW8y/9X6rxY0WlyFxchJ1IaNUmvXBaGKpVuNeD82sW2ZjTeHVxstjG48v/o0t84 qvRAdNWQcsH3H+K/SGPO8k6JPp+91KV4JBF8+a+j5qKiI4CUEPrg9MFJcSVvSJ6MSFQ0 2zYrK3E3wLfRhWwNrfWak1r0+r/OBgQQ8TlB8WVHnnN9F2Mqh0Wad564t4R719HXkfPT Ua1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728158228; x=1728763028; 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=nCot8RtXgODmKw1CZDuIEw0rJqcYXwewbxiKwbR/4js=; b=u8q936wwTxMR3GQSreRRGHQ9QRpTUEmNs7qyKNwZmbdze6AHd1DmqNxlotnWnsxkFM Sh9acYh7oPMlAJevp/bG+EVaX0Z9KxWmkpdg/tcFhOVaerYc9fOGpeo+UPdMbfJbZ6l5 vqiDd0f96XAn4EXwrqaY95YqK271n1XtMrGL2Qm/dufxKBC068nD7uOg7XoQwRnDWTor sjdwYwaFZMq99Hea+gvDr1flrWaDV6+8tJbNcHcQpteikESyzR2S8maV+5rDcpicRXvw 3WORO9Oivom8LaSI8oEWU0Kv0seWvroaUfg816lBN3J2W0OshD8Nmt8OqcP+vjidKXwH yR0A== X-Forwarded-Encrypted: i=1; AJvYcCWOp+sFcHNKjivaaDZFTHURu6Uhv7FflwSPa5y9tTmir+jk4kSoHl1mgRjFPRRVen9NVSMAeb4jyL1YmGo=@vger.kernel.org X-Gm-Message-State: AOJu0YxW7pFXMEXLPpVFqSbP4ifzPx0WHO+JF9sxw9OtfnTBDSWMHtPd SGiva4iialZVUCrYT5ZPPsH6/SAR+M0m3dTR4WoKLnFljH2gFrayg/uXfpU1PqGiThzEjNcf8DF r1uMQ5Q== X-Google-Smtp-Source: AGHT+IG4VTvKqB1IWifVabjZBEQn/lThARIXb4Kk+k0+M4seYXfuOdgdzRDz+Pov1wdznx/1s442fbvFWx2c X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:4c2:5b4d:8797:7249]) (user=irogers job=sendgmr) by 2002:a25:c7d2:0:b0:e20:298c:541 with SMTP id 3f1490d57ef6-e2893945553mr4851276.9.1728158227843; Sat, 05 Oct 2024 12:57:07 -0700 (PDT) Date: Sat, 5 Oct 2024 12:55:41 -0700 In-Reply-To: <20241005195541.380070-1-irogers@google.com> Message-Id: <20241005195541.380070-32-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241005195541.380070-1-irogers@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Subject: [PATCH v2 31/31] 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 , "Steven Rostedt (Google)" , "Masami Hiramatsu (Google)" , Guilherme Amadio , Changbin Du , Daniel Bristot de Oliveira , Daniel Wagner , Aditya Gupta , Athira Rajeev , Masahiro Yamada , Kajol Jain , Huacai Chen , Bibo Mao , Anup Patel , Atish Patra , Shenlin Liang , Oliver Upton , "Steinar H. Gunderson" , "Dr. David Alan Gilbert" , Chen Pei , Dima Kogan , Yury Norov , 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 00340c6ce3a9..b5a7e952ad0a 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -548,15 +548,10 @@ ifndef NO_LIBELF endif =20 ifndef NO_LIBDW - ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) - $(warning DWARF register mappings have not been defined for architec= ture $(SRCARCH), DWARF support disabled) - NO_LIBDW :=3D 1 - else - CFLAGS +=3D -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) - LDFLAGS +=3D $(LIBDW_LDFLAGS) - EXTLIBS +=3D ${DWARFLIBS} - $(call detected,CONFIG_LIBDW) - endif # PERF_HAVE_DWARF_REGS + CFLAGS +=3D -DHAVE_LIBDW_SUPPORT $(LIBDW_CFLAGS) + LDFLAGS +=3D $(LIBDW_LDFLAGS) + EXTLIBS +=3D ${DWARFLIBS} + $(call detected,CONFIG_LIBDW) endif # NO_LIBDW =20 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 :=3D 1 -endif PERF_HAVE_JITDUMP :=3D 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 :=3D 1 -endif PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 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 :=3D 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 :=3D 1 -endif PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 1 =20 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 :=3D 1 -endif - # Syscall table generation for perf out :=3D $(OUTPUT)arch/mips/include/generated/asm header :=3D $(out)/syscalls_n64.c diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Mak= efile 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 :=3D 1 -endif - HAVE_KVM_STAT_SUPPORT :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 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 :=3D 1 -endif +# SPDX-License-Identifier: GPL-2.0 PERF_HAVE_JITDUMP :=3D 1 HAVE_KVM_STAT_SUPPORT :=3D 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 :=3D 1 -endif HAVE_KVM_STAT_SUPPORT :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 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 :=3D 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 :=3D 1 -endif - PERF_HAVE_JITDUMP :=3D 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 :=3D 1 -endif HAVE_KVM_STAT_SUPPORT :=3D 1 PERF_HAVE_JITDUMP :=3D 1 =20 diff --git a/tools/perf/arch/xtensa/Makefile b/tools/perf/arch/xtensa/Makef= ile 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 :=3D 1 -endif --=20 2.47.0.rc0.187.ge670bccf7e-goog