From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09C14F357B3 for ; Tue, 24 Feb 2026 14:30:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :Message-ID:Mime-Version:Date:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=s3scIhHvsH0vZ718UKHcz+QOCtlI3GCwPe35U/BRBaA=; b=CIr9+dlDgVX3xSB2F+fQId3frY cCW/wTD8FePRhM1vs7+AnMTrVEkvcd7FSxOnRp8HbBkJ1lx/shpQOJNFhBSJoQkz36Mc++73PA4Wc xUSpGFsBPSxMEKu9w0URSH9YJaIjsDTY8kGZ6p/qJ3Xl7AufqZOau7seU4BWIpjEjnx4VMuZeKejS JxE+0RVM5WFYWlEeN6XPh6Ar//XjPABnJBqIyUmYRzeWW8kqjsZYf41Iu1x7zBfWCUZk/LQhI5x9y mNpqDNhWvjq7/tqAig0W32KBx5eHqTGSA6PtvNfzXg91NiIu9wCC5gK7nsqreWxrasf/r1qnmAejv 8sIorYkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vutQA-00000002CnN-3c3T; Tue, 24 Feb 2026 14:29:54 +0000 Received: from mail-dl1-x1249.google.com ([2607:f8b0:4864:20::1249]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vutQ8-00000002Cm5-0uBC for linux-arm-kernel@lists.infradead.org; Tue, 24 Feb 2026 14:29:53 +0000 Received: by mail-dl1-x1249.google.com with SMTP id a92af1059eb24-12737f276a2so9228378c88.1 for ; Tue, 24 Feb 2026 06:29:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1771943390; x=1772548190; darn=lists.infradead.org; h=to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=s3scIhHvsH0vZ718UKHcz+QOCtlI3GCwPe35U/BRBaA=; b=3ZKi4Oy6qIuI3vujbCWWO5ygtwzvYrjmTUw8hBrEddAw4Yhjlq52mVOBm63bh1hYBn ECuW+TXsJ5bQXgy/JBDrVuxyptAPnvkCFMFohbABiMQ1w/49jn1ihMFnpsaLxFSTYicM 87aHFowk38YdbYhIgALtAD/3Wzs9BYQEta+tAP5iby5CntUZcovnEuhpzXNzDqEjg3F2 Lgeb0OS1IMfUqOF4FPfUs9gsgAT1D0RhTfZksMiH6E9GDs+1McCvu5RucKGpv5RgcVi6 VK5h3FmR7vhKvgVwa5BXUwiKog7Eifn6HMmvs7ZJqBlNKjRsPIybwPphpYaPmA64lDIM Z6Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771943390; x=1772548190; h=to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=s3scIhHvsH0vZ718UKHcz+QOCtlI3GCwPe35U/BRBaA=; b=O6gsxUZOfEH7yHEB52kbs5amUVraG0kJREl+sniNA2zNMu599TQhV2z6YtdopRp9ZW czpZJnNZXSN56fOlpoUwjBP1qbXebN/sbT7FKTl3MxVHLiDAZOJaJsHfosMVKgbXOBAF wjU45BrZBpaETiU4J2taJqpmon4sMl9bdlIJqNdOBmAkpEGABt7WORaImgwlOay5FRF8 rSDXZ4MZC6ynWCXV/3/SkKvLsOpAoPWE9wPdz74gI/9NMHYD233/dXW4CGYu3DKG+Dvo HEvZwWwlSnaDWe4WP8e3EyqkTv93LBy0P6mwQ62pRRfdc+jK6ajDcL69j4saLrT/55LU q/rw== X-Forwarded-Encrypted: i=1; AJvYcCVbWolRZv7nW+itl9mEUkEUnRaH1qEekLXKtsR2B+dFbNi7sRIWM66Z4mB/tcOiaLnAjmTTwg+8p+lOD4XG0xEj@lists.infradead.org X-Gm-Message-State: AOJu0YyM/5CL9hNt2bsUgfXftr0T0HVM1JRs+zxj8HxrTlaz1vEjcphU xii2NKKc7po4X+tMap6RoEFhwTdgAUTK0MC1NIDV0HgBYUb5jSgafvZEPvQtWEv7OnjkkntEbRU qu+UsOUwX+A== X-Received: from dlzz34.prod.google.com ([2002:a05:7022:4a2:b0:123:35cc:b60f]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:92a:b0:122:3a5:fc42 with SMTP id a92af1059eb24-1276ad16d7fmr5344712c88.20.1771943390102; Tue, 24 Feb 2026 06:29:50 -0800 (PST) Date: Tue, 24 Feb 2026 06:29:30 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.53.0.371.g1d285c8824-goog Message-ID: <20260224142938.26088-1-irogers@google.com> Subject: [RFC PATCH v1 0/7] perf libunwind multiple remote support From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , John Garry , Will Deacon , Leo Yan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dmitrii Dolgov <9erthalion6@gmail.com>, Blake Jones , Tomas Glozar , Yuzhuo Jing , Dapeng Mi , Shimin Guo , Athira Rajeev , Chun-Tse Shao , Howard Chu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, Thomas Richter , libunwind-devel@nongnu.org Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260224_062952_249969_680E3461 X-CRM114-Status: GOOD ( 18.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor the libunwind support so that whenever a remote target is available, perf functions using the ELF machine can use that remote target regardless of what the host/local machine is. Migrate existing libunwind supported architectures like powerpc, arm64 and loongarch so that they can work in a cross-architecture way. Add support for RISC-V. Make the code more regular in function names, etc. and avoid including a C-file. This increases the lines of code. It is similar in style to the unwind-libdw implementation. It is hoped that the more uniform nature of the code with help with refactoring the perf registers for SIMD/APX support. Aside from local host testing these patches are under tested, in part as I'm failing to see how to build libunwind with support for multiple remote targets. Please could I get help in testing, hence this being an RFC. Ian Rogers (7): tools build: Deduplicate test-libunwind for different architectures perf build: Be more programmatic when setting up libunwind variables perf build loongarch: Remove reference to missing file perf unwind-libunwind: Make libunwind register reading cross platform perf unwind-libunwind: Move flush/finish access out of local perf unwind-libunwind: Remove libunwind-local perf unwind-libunwind: Add RISC-V libunwind support tools/build/feature/Makefile | 38 +- tools/build/feature/test-libunwind-aarch64.c | 27 - tools/build/feature/test-libunwind-arm.c | 28 - .../test-libunwind-debug-frame-aarch64.c | 17 - .../feature/test-libunwind-debug-frame-arm.c | 17 - .../feature/test-libunwind-debug-frame.c | 1 - tools/build/feature/test-libunwind-x86.c | 28 - tools/build/feature/test-libunwind-x86_64.c | 28 - tools/build/feature/test-libunwind.c | 1 - tools/perf/Makefile.config | 215 ++--- tools/perf/arch/arm/util/Build | 2 - tools/perf/arch/arm/util/unwind-libunwind.c | 50 -- tools/perf/arch/arm64/util/Build | 1 - tools/perf/arch/arm64/util/unwind-libunwind.c | 17 - tools/perf/arch/loongarch/util/Build | 3 - .../arch/loongarch/util/unwind-libunwind.c | 82 -- tools/perf/arch/mips/Build | 1 - tools/perf/arch/mips/util/Build | 1 - tools/perf/arch/mips/util/unwind-libunwind.c | 22 - tools/perf/arch/powerpc/util/Build | 1 - .../perf/arch/powerpc/util/unwind-libunwind.c | 92 -- tools/perf/arch/x86/util/Build | 3 - tools/perf/arch/x86/util/unwind-libunwind.c | 115 --- tools/perf/util/Build | 4 +- tools/perf/util/libunwind-arch/Build | 11 + .../perf/util/libunwind-arch/libunwind-arch.c | 319 +++++++ .../perf/util/libunwind-arch/libunwind-arch.h | 296 +++++++ .../perf/util/libunwind-arch/libunwind-arm.c | 290 ++++++ .../util/libunwind-arch/libunwind-arm64.c | 289 ++++++ .../perf/util/libunwind-arch/libunwind-i386.c | 312 +++++++ .../util/libunwind-arch/libunwind-loongarch.c | 297 +++++++ .../perf/util/libunwind-arch/libunwind-mips.c | 299 +++++++ .../util/libunwind-arch/libunwind-ppc32.c | 301 +++++++ .../util/libunwind-arch/libunwind-ppc64.c | 303 +++++++ .../util/libunwind-arch/libunwind-riscv.c | 297 +++++++ .../perf/util/libunwind-arch/libunwind-s390.c | 299 +++++++ .../util/libunwind-arch/libunwind-x86_64.c | 320 +++++++ tools/perf/util/libunwind/arm64.c | 40 - tools/perf/util/libunwind/x86_32.c | 41 - tools/perf/util/maps.c | 29 +- tools/perf/util/maps.h | 4 +- tools/perf/util/thread.c | 29 +- tools/perf/util/unwind-libunwind-local.c | 832 ------------------ tools/perf/util/unwind-libunwind.c | 677 ++++++++++++-- tools/perf/util/unwind.h | 13 +- 45 files changed, 4389 insertions(+), 1703 deletions(-) delete mode 100644 tools/build/feature/test-libunwind-aarch64.c delete mode 100644 tools/build/feature/test-libunwind-arm.c delete mode 100644 tools/build/feature/test-libunwind-debug-frame-aarch64.c delete mode 100644 tools/build/feature/test-libunwind-debug-frame-arm.c delete mode 100644 tools/build/feature/test-libunwind-x86.c delete mode 100644 tools/build/feature/test-libunwind-x86_64.c delete mode 100644 tools/perf/arch/arm/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/arm64/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/loongarch/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/mips/Build delete mode 100644 tools/perf/arch/mips/util/Build delete mode 100644 tools/perf/arch/mips/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/powerpc/util/unwind-libunwind.c delete mode 100644 tools/perf/arch/x86/util/unwind-libunwind.c create mode 100644 tools/perf/util/libunwind-arch/Build create mode 100644 tools/perf/util/libunwind-arch/libunwind-arch.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-arch.h create mode 100644 tools/perf/util/libunwind-arch/libunwind-arm.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-arm64.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-i386.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-loongarch.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-mips.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-ppc32.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-ppc64.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-riscv.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-s390.c create mode 100644 tools/perf/util/libunwind-arch/libunwind-x86_64.c delete mode 100644 tools/perf/util/libunwind/arm64.c delete mode 100644 tools/perf/util/libunwind/x86_32.c delete mode 100644 tools/perf/util/unwind-libunwind-local.c -- 2.53.0.371.g1d285c8824-goog