From mboxrd@z Thu Jan 1 00:00:00 1970 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 02C212586D8 for ; Mon, 10 Feb 2025 16:51:13 +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=1739206277; cv=none; b=LS4PcbDM+5QzOHb4juP2O3fpBFRewTnPdDg4nxKHUhgBeIO6NGqC2unmrgivYI0MnKH22qU/QBXpjiDKf3yIaFW/pJL7LRafymybqNgNq7fMt64o/68NlV6SV8C61/r4gnom+Ob1e70XCy5nM0A17HTnqpDxgM9RGm5fvzjzGIw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739206277; c=relaxed/simple; bh=wUxKlFy9AiDHYLrtR6cwrYB//7laKsogskhbtE0PxCQ=; h=Date:Message-Id:Mime-Version:Subject:From:To:Content-Type; b=GSLZ+arsOm+1gnuH9u2a7qLqOAiLZyBoQKFBNmqIkot5opmtdY08oByx/dh7l+VsVgU7aU9UZFK/t7FJDj8RwgNVgyclbbJRo6Hdu4B3D3PbeHtaXAd5pjy3v5GurRlq+1GxfTLNtL+CW6Lund02AyrKb+AYN8KwUf6o/CnnIfA= 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=FM6T14yK; 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="FM6T14yK" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6f987726f8bso45868997b3.2 for ; Mon, 10 Feb 2025 08:51:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1739206273; x=1739811073; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=kmoQ0hJ6fUHzIAxNKRxmy53Q9EYukD3q6SfZlICWqA0=; b=FM6T14yKNekHLhwV/cJ6Nqsh9nm897edptiEqsb5BKBdDlln6g2rSg8gIhkxOB/dt2 0ob1oWzN/o+gR2LftEhRw7XfTKKFgONidJXeiIxm2FPtcU3mHwftWEuYOTFvotwMZsir C4gZKvQgEpRkMo7SkSpVlKuxC9W1ILiILwCmRdJMVueHBQpL1/OjxWYNp7OehaBRvjzs PsYj5OtQsgaiQEQQMWANCwaD/2rfXK4vRmih3McPwil2xDqAC2+X+UgZj4gwzdooePdd XAXki5uuxAghYg6efuSEgiCBkdOD6InxdLIdcTD60BUw++19Xz+UbRNqsSkaX8nTQ9ae nwkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739206273; x=1739811073; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kmoQ0hJ6fUHzIAxNKRxmy53Q9EYukD3q6SfZlICWqA0=; b=CEgXldW06NlLHo/p84IKw1ysyOwIavdxX/iV+8DUxoFOSsgHo8OkyGoEQz5Z4tpT8M NdtJNFKuHf0C/6NflKWTzFduPBGRE0St0wIuSaZTDzkjrQWHlcHhPqXgDgOXVBcpspIx e4DX2RPBXTx0RcO+0WeL3ebA9eZTyQRbvqTdeObrGcodqdaRmBIhNpivCPJEs3o19IH4 GAjwTo4yAiSsx/eaPpikHL4/ND8uAOGQBlj3C/v2ChF/qz+Cez6EHI58Y0aPAJrPwnYc 0NaImBPZmvYhpGGtCSS9yVsGkvtGPB5UbVr8calK8aASvGFVuo9OVPykyuYhxrmEaLrT X1/w== X-Forwarded-Encrypted: i=1; AJvYcCVrCKaJuPf84ixV5pZWPJYlJx64UGKPnLScf5jsEnuhQU1Qp20nufejniIJbbngJbMEYvEYE85MorJYAY8=@vger.kernel.org X-Gm-Message-State: AOJu0YypLeWRSDDUksuqYvuneyhH17RIlQEQTZpQ+DbnNV/1Zyh0w/K0 xPeD3G4wsnyhL0zc01fNSxdx/sgpMHyjPU3/vz86mWxx78Oh2zhUsR7TyLCD770oykkAkbzEf9E zYVFzpg== X-Google-Smtp-Source: AGHT+IEMtGF5r1fPJEqxllkQEpJmEpGfF/fYkueb8YcpPNyVeR8kWRxqXWQw5vuIofyE3IHky/IxQ7Jh9GGu X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:c64e:af58:30d4:168d]) (user=irogers job=sendgmr) by 2002:a25:dd44:0:b0:e5a:f4dc:c2cb with SMTP id 3f1490d57ef6-e5b46a36651mr105648276.4.1739206272904; Mon, 10 Feb 2025 08:51:12 -0800 (PST) Date: Mon, 10 Feb 2025 08:51:01 -0800 Message-Id: <20250210165108.95894-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.48.1.502.g6dc24dfdaf-goog Subject: [PATCH v2 0/7] perf: Support multiple system call tables in the build 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 , Charlie Jenkins , Bibo Mao , Arnd Bergmann , Huacai Chen , Catalin Marinas , Jiri Slaby , "=?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?=" , 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 Content-Type: text/plain; charset="UTF-8" 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. 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 (7): 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 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 | 275 +++++++++++------- tools/perf/scripts/Makefile.syscalls | 61 ---- tools/perf/scripts/syscalltbl.sh | 86 ------ tools/perf/trace/beauty/syscalltbl.sh | 274 +++++++++++++++++ tools/perf/util/syscalltbl.c | 142 ++++----- tools/perf/util/syscalltbl.h | 22 +- tools/perf/util/thread.c | 50 ++++ tools/perf/util/thread.h | 14 +- 54 files changed, 598 insertions(+), 506 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 -- 2.48.1.502.g6dc24dfdaf-goog