From patchwork Wed Feb 19 18:56:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 13982710 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 DAA64C021B0 for ; Wed, 19 Feb 2025 18:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:From:Subject :Mime-Version:Message-Id:Date:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=EXw58HqPBaiRnglriOhbvm+UYcMbbold2y+H8kTZDlk=; b=YtQuu8+JipHyUNUZlFzwVIl6s4 xl9FoXYJ9znN4oCvyPwAzepEvSrOOfo6TeaOA8L9goSxSrqo7QfY1+10IuUyCDJDtupulSqeibPn/ I/rDWR4+eMuG94tY02xJGvcIPh8zrASpY3affPS91HoEL0ZcVYxHlXKqwvwX9YpoPygf8QNDvs7l+ noTXNVD1/Ht3BMxtGNTDahJSEBxdwwaf43g2w/i8yqufRRAVn5/9PRA9gIarZx8WMFrMJY789mw+6 pkPobHzDo+YrmdiPiYd3ja0HR9QIk1qI1OKJsmtVV7/aLWY6ZCHLHqxNU5cXBbNdcaGmWCXIv3rQ/ TyI82pOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tkpHQ-0000000EUTB-2UgD; Wed, 19 Feb 2025 18:58:44 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tkpFv-0000000ETt7-2v9o for linux-arm-kernel@lists.infradead.org; Wed, 19 Feb 2025 18:57:13 +0000 Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-e3a1bc0c875so221614276.2 for ; Wed, 19 Feb 2025 10:57:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1739991430; x=1740596230; darn=lists.infradead.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=EXw58HqPBaiRnglriOhbvm+UYcMbbold2y+H8kTZDlk=; b=uKzrYJckjJM9ZgFDYAVn4T3w5/CoPZgK4a04x4LOPh3bhOnoUg+slOPQxkoLW6L3Qi LqIpBn8qkgkejN+DukBq8XoCdJXfeEpf20lUPtPWyKDu49zsyQcIL4Tw7hl5JnmHYv1l TPhLcEJ9YErr9eYSuyeoLpAjcVqTz3bGonfH0YKJPVM4C8FbZKEFnCu5f18covqzEmgU ygs38vnLfnknbRXCZSAmp2Gbspnibb3i3yg6ZSHDIi7aqED5rNVkIt8Kqnzdb2a7QF+N 4YMMESW2FqSPcivmZGTssa39EkyVSWjS9SoOnvBorpcMO9XKxuiHa9suVFjxJAzOq/oL aGQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739991430; x=1740596230; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=EXw58HqPBaiRnglriOhbvm+UYcMbbold2y+H8kTZDlk=; b=ZtqO+KMUWmapr+vIWH8Pbkw0xxSAriehBIPzHYTG4O1IeAQNqYfBUEwtdg8m8hi1nS trj8GA0J22U1k0DpgGu+ECjMsVNzTJeAAcVgY1JZs5ld7XTeiQUmiJG0xm1SsbWAWkQp H5MBJ1s2XK8zVUqu/YfhHOKLRUR4QMuM9lt8v1yXcIi7DA39+mPJlvhR4lfmhCeTyw3f /7GPf/gAIG1UI9ENhXKFAgToaUt8QcB2xoOvdKXDRR0XRRrICe7e4j421Uoyp9BNB+4B vUR4tLgbtNP0S4YqfSFNbo2uWk4ZFVi1SUa/38LjFLHrSMlIpv6MKKMJAUj0Ou9xgMPW 7BSA== X-Forwarded-Encrypted: i=1; AJvYcCWJ9247JAYOf16lvSs5H7gbQIizRhJw3xfEnfhzSuyrfv6FzLa1X7+FpVGmT5GA/a7Jk3wLskrWbq0XT/oS01si@lists.infradead.org X-Gm-Message-State: AOJu0YyBUqMb/BP5atDPBvTKNPpR+5Lt1BccGlJvnMfc21OA8i0pzIdo Jx7PR0SfybtPv/M87MJbuYOn3wiAtqY5QgdfHpC5C9VvnOwzHSQLJwTJ9PGULmErC9i88nwEgps pNlwtQQ== X-Google-Smtp-Source: AGHT+IGPMbTasl19lEsUyLjUBa94fVbMRWecTemZAnOiwhvnSubmTuBnVXcV7haTvztOLL4qQ5ayFxZCzw56 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:c57b:86f0:c166:3061]) (user=irogers job=sendgmr) by 2002:a25:ab6f:0:b0:e5b:1238:a7c3 with SMTP id 3f1490d57ef6-e5dc90398e5mr199232276.3.1739991430005; Wed, 19 Feb 2025 10:57:10 -0800 (PST) Date: Wed, 19 Feb 2025 10:56:49 -0800 Message-Id: <20250219185657.280286-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.48.1.601.g30ceb7b040-goog Subject: [PATCH v3 0/8] perf: Support multiple system call tables in the build From: Ian Rogers To: Ian Rogers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , guoren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Charlie Jenkins , Bibo Mao , Huacai Chen , Catalin Marinas , Jiri Slaby , " =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= " , Howard Chu , 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, linux-mips@vger.kernel.org, Arnd Bergmann X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250219_105711_759403_C46C5EF8 X-CRM114-Status: GOOD ( 19.02 ) 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 This work builds on the clean up of system call tables and removal of libaudit by Charlie Jenkins . The system call table in perf trace is used to map system call numbers to names and vice versa. Prior to these changes, a single table matching the perf binary's build was present. The table would be incorrect if tracing say a 32-bit binary from a 64-bit version of perf, the names and numbers wouldn't match. Change the build so that a single system call file is built and the potentially multiple tables are identifiable from the ELF machine type of the process being examined. To determine the ELF machine type, the executable's header is read from /proc/pid/exe with fallbacks to using the perf's binary type when unknown. Remove some runtime types used by the system call tables and make equivalents generated at build time. v3: Add Charlie's reviewed-by tags. Incorporate feedback from Arnd Bergmann on additional optional column and MIPS system call numbering. Rebase past Namhyung's global system call statistics and add comments that they don't yet support an e_machine other than EM_HOST. v2: Change the 1 element cache for the last table as suggested by Howard Chu, add Howard's reviewed-by tags. Add a comment and apology to Charlie for not doing better in guiding: https://lore.kernel.org/all/20250114-perf_syscall_arch_runtime-v1-1-5b304e408e11@rivosinc.com/ After discussion on v1 and he agreed this patch series would be the better direction. Ian Rogers (8): perf syscalltble: Remove syscall_table.h perf trace: Reorganize syscalls perf syscalltbl: Remove struct syscalltbl perf thread: Add support for reading the e_machine type for a thread perf trace beauty: Add syscalltbl.sh generating all system call tables perf syscalltbl: Use lookup table containing multiple architectures perf build: Remove Makefile.syscalls perf syscalltbl: Mask off ABI type for MIPS system calls tools/perf/Makefile.perf | 10 +- tools/perf/arch/alpha/entry/syscalls/Kbuild | 2 - .../alpha/entry/syscalls/Makefile.syscalls | 5 - tools/perf/arch/alpha/include/syscall_table.h | 2 - tools/perf/arch/arc/entry/syscalls/Kbuild | 2 - .../arch/arc/entry/syscalls/Makefile.syscalls | 3 - tools/perf/arch/arc/include/syscall_table.h | 2 - tools/perf/arch/arm/entry/syscalls/Kbuild | 4 - .../arch/arm/entry/syscalls/Makefile.syscalls | 2 - tools/perf/arch/arm/include/syscall_table.h | 2 - tools/perf/arch/arm64/entry/syscalls/Kbuild | 3 - .../arm64/entry/syscalls/Makefile.syscalls | 6 - tools/perf/arch/arm64/include/syscall_table.h | 8 - tools/perf/arch/csky/entry/syscalls/Kbuild | 2 - .../csky/entry/syscalls/Makefile.syscalls | 3 - tools/perf/arch/csky/include/syscall_table.h | 2 - .../perf/arch/loongarch/entry/syscalls/Kbuild | 2 - .../entry/syscalls/Makefile.syscalls | 3 - .../arch/loongarch/include/syscall_table.h | 2 - tools/perf/arch/mips/entry/syscalls/Kbuild | 2 - .../mips/entry/syscalls/Makefile.syscalls | 5 - tools/perf/arch/mips/include/syscall_table.h | 2 - tools/perf/arch/parisc/entry/syscalls/Kbuild | 3 - .../parisc/entry/syscalls/Makefile.syscalls | 6 - .../perf/arch/parisc/include/syscall_table.h | 8 - tools/perf/arch/powerpc/entry/syscalls/Kbuild | 3 - .../powerpc/entry/syscalls/Makefile.syscalls | 6 - .../perf/arch/powerpc/include/syscall_table.h | 8 - tools/perf/arch/riscv/entry/syscalls/Kbuild | 2 - .../riscv/entry/syscalls/Makefile.syscalls | 4 - tools/perf/arch/riscv/include/syscall_table.h | 8 - tools/perf/arch/s390/entry/syscalls/Kbuild | 2 - .../s390/entry/syscalls/Makefile.syscalls | 5 - tools/perf/arch/s390/include/syscall_table.h | 2 - tools/perf/arch/sh/entry/syscalls/Kbuild | 2 - .../arch/sh/entry/syscalls/Makefile.syscalls | 4 - tools/perf/arch/sh/include/syscall_table.h | 2 - tools/perf/arch/sparc/entry/syscalls/Kbuild | 3 - .../sparc/entry/syscalls/Makefile.syscalls | 5 - tools/perf/arch/sparc/include/syscall_table.h | 8 - tools/perf/arch/x86/entry/syscalls/Kbuild | 3 - .../arch/x86/entry/syscalls/Makefile.syscalls | 6 - tools/perf/arch/x86/include/syscall_table.h | 8 - tools/perf/arch/xtensa/entry/syscalls/Kbuild | 2 - .../xtensa/entry/syscalls/Makefile.syscalls | 4 - .../perf/arch/xtensa/include/syscall_table.h | 2 - tools/perf/builtin-trace.c | 290 +++++++++++------- tools/perf/scripts/Makefile.syscalls | 61 ---- tools/perf/scripts/syscalltbl.sh | 86 ------ tools/perf/trace/beauty/syscalltbl.sh | 274 +++++++++++++++++ tools/perf/util/syscalltbl.c | 148 ++++----- tools/perf/util/syscalltbl.h | 22 +- tools/perf/util/thread.c | 50 +++ tools/perf/util/thread.h | 14 +- 54 files changed, 616 insertions(+), 509 deletions(-) delete mode 100644 tools/perf/arch/alpha/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/alpha/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/alpha/include/syscall_table.h delete mode 100644 tools/perf/arch/arc/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/arc/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/arc/include/syscall_table.h delete mode 100644 tools/perf/arch/arm/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/arm/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/arm/include/syscall_table.h delete mode 100644 tools/perf/arch/arm64/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/arm64/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/arm64/include/syscall_table.h delete mode 100644 tools/perf/arch/csky/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/csky/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/csky/include/syscall_table.h delete mode 100644 tools/perf/arch/loongarch/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/loongarch/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/loongarch/include/syscall_table.h delete mode 100644 tools/perf/arch/mips/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/mips/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/mips/include/syscall_table.h delete mode 100644 tools/perf/arch/parisc/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/parisc/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/parisc/include/syscall_table.h delete mode 100644 tools/perf/arch/powerpc/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/powerpc/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/powerpc/include/syscall_table.h delete mode 100644 tools/perf/arch/riscv/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/riscv/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/riscv/include/syscall_table.h delete mode 100644 tools/perf/arch/s390/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/s390/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/s390/include/syscall_table.h delete mode 100644 tools/perf/arch/sh/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/sh/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/sh/include/syscall_table.h delete mode 100644 tools/perf/arch/sparc/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/sparc/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/sparc/include/syscall_table.h delete mode 100644 tools/perf/arch/x86/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/x86/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/x86/include/syscall_table.h delete mode 100644 tools/perf/arch/xtensa/entry/syscalls/Kbuild delete mode 100644 tools/perf/arch/xtensa/entry/syscalls/Makefile.syscalls delete mode 100644 tools/perf/arch/xtensa/include/syscall_table.h delete mode 100644 tools/perf/scripts/Makefile.syscalls delete mode 100755 tools/perf/scripts/syscalltbl.sh create mode 100755 tools/perf/trace/beauty/syscalltbl.sh