From patchwork Mon Nov 4 21:06:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charlie Jenkins X-Patchwork-Id: 13862041 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (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 9C2331FCC7A for ; Mon, 4 Nov 2024 21:07:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754447; cv=none; b=UN2rY8n+G/0XcvJNNfWztpa8KL5sA6+nI5X4gkEHjjCs9mF5IZA1ZtxKTk+v1FqAbX1XjZb2HqpbqDh2f+IrW1nJ3QbeZr6bgJ9tNkn0MuHRuktF9T/Dl8tnkiVOk7g599YuYrw6i1z61eLU45cwt4sbhadwaUthGIWpoqHa1MU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730754447; c=relaxed/simple; bh=OoyBSoSR0YKW97xqx60uS1tbyNrKDGxM4Vocad6xjfw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NE6tFtumzAN2HxCWDan8x8SL1uXyVUshFHSzyIpAnJTxSuYXgo3eYbiAe6eJYcYk/2Xf+V/T4MSOLl9/+LkYQ4oxfEH9dgOMvGe9IeN5BUd3/iHcpBJLRb2jlwfHzddWIhYrEYxZEQuBhh3M4ELZ4Hc2fwKCVl7Mb5A7RbWZcT0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=jFnpIdpI; arc=none smtp.client-ip=209.85.167.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="jFnpIdpI" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3e5fcf464ecso3098158b6e.0 for ; Mon, 04 Nov 2024 13:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1730754445; x=1731359245; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=92GrRLDgka7EWUObBkAeZ/OwF0Pa5ocJ0bqq37OhKZU=; b=jFnpIdpIcYo0Giy+0B5TxmWYZRsCfg5QbP/oWvJHy+kAGEKqW4aynIc80Lf1khCl3I fcNb14iJbXpG/8dmIZ/U4pJJaINQg/aSCXg5LpN3HyrgL/pP8V29kPz4JSKNpB/2KwKe P+WtTOz6J2sJ9j2Vqazng5/DprYwc6gTkv1TkSVXYBNCnGxnp61r1RYuESRCwUjvC4d4 sWXv+YB+w11uJf3sYxfBbs5n0DexWhxEcmfqXHVqzL5Z3s2HB7SjF5g9okfBLlZ9Lkmy vmT5IkbKvniXRWh60VjFYd2GvVDoSYvGfxHT4Y2aGRZDXaXUGPUL8uMIUjIbEZwKu4IF EGjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730754445; x=1731359245; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=92GrRLDgka7EWUObBkAeZ/OwF0Pa5ocJ0bqq37OhKZU=; b=qQlgay+uJ9zubCyZLXOT8pL5Tm13qTG/VGBsumbrvleK5KMhiT39VY4Nd/NTm6NJ0o jlkYpyU3qdmja1PnIr1L9VK7/Y8LFJnFZi7L+rH7mkBc44Qg0uAbvaEFVAppMTl18Zec xOgaoH+XS2ZL7uyKEf1Z7W6u/UDPDRdfluD71CHYsNaiUAIhkqjMPhSVG2bwchYz5qHE yxtd0L9ZgYicF9GykQX//CM588bszWn+CiWVD2TZHa2Tnr/O+JyzGu0tAQvvrWnT5OxP /AftcXhPpGvZ39rwkqd07nlkZ3lEj3A1F6UH64xtVNJl4tu7cna6TzWZf610jOPvjau1 0JSQ== X-Forwarded-Encrypted: i=1; AJvYcCUkFlLSV3kCC8mVJ1gNyB8KAvjiqYyeOrA7B8tn0O0b0R+3zoEG2v8ChsX8fLueuBEHfRRMK2KdJ2md2/JD/mHygys1aag=@vger.kernel.org X-Gm-Message-State: AOJu0YyuYqeGh04zgBP7YdGBPAoN7pwJwUckZkcfSNAWdBrYZf2ze+1/ IyXgO9NdMJbNINNKecErVar4+wZ1Q1UZ5jnP1904lU4p/PfciSv1wAoq7kYJx58= X-Google-Smtp-Source: AGHT+IHwghEtsWHSIgna9eRpd6cfglYULyLkTu6aW9WjgN7UGabPnfWIpz8Ez2eA6OMZ9FOUKr0wsQ== X-Received: by 2002:a05:6808:2dc6:b0:3e5:d5c3:e88b with SMTP id 5614622812f47-3e638252a38mr30658820b6e.20.1730754443278; Mon, 04 Nov 2024 13:07:23 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7ee490e08f4sm7248293a12.40.2024.11.04.13.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 13:07:22 -0800 (PST) From: Charlie Jenkins Date: Mon, 04 Nov 2024 13:06:15 -0800 Subject: [PATCH RFT 13/16] perf tools: mips: Use generic syscall scripts Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241104-perf_syscalltbl-v1-13-9adae5c761ef@rivosinc.com> References: <20241104-perf_syscalltbl-v1-0-9adae5c761ef@rivosinc.com> In-Reply-To: <20241104-perf_syscalltbl-v1-0-9adae5c761ef@rivosinc.com> To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Paul Walmsley , Palmer Dabbelt , Albert Ou , =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , =?utf-8?q?G=C3=BCnt?= =?utf-8?q?her_Noack?= , Christian Brauner , Guo Ren , John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Jonathan Corbet , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org, linux-security-module@vger.kernel.org, bpf@vger.kernel.org, linux-csky@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5807; i=charlie@rivosinc.com; h=from:subject:message-id; bh=OoyBSoSR0YKW97xqx60uS1tbyNrKDGxM4Vocad6xjfw=; b=owGbwMvMwCHWx5hUnlvL8Y3xtFoSQ7qmeVzDqo9uN3/P0e+Y+X1GiiP7lWxnO5VU4cipb0t8O 5kz3nN1lLIwiHEwyIopsvBca2BuvaNfdlS0bALMHFYmkCEMXJwCMBEGAYb/defFH23OC3SMv36g U1NugXWUcNuMmNgu5wCu+wzKvy8FMzLs5BRVS1Z/f++7lcHm5Gu/D77wY1nimvjxivmqdWe+3k/ lAAA= X-Developer-Key: i=charlie@rivosinc.com; a=openpgp; fpr=7D834FF11B1D8387E61C776FFB10D1F27D6B1354 Use the generic scripts to generate headers from the syscall table for mips. Signed-off-by: Charlie Jenkins --- tools/perf/Makefile.config | 4 +-- tools/perf/Makefile.perf | 2 +- tools/perf/arch/mips/Makefile | 18 ------------ tools/perf/arch/mips/entry/syscalls/Kbuild | 2 ++ .../arch/mips/entry/syscalls/Makefile.syscalls | 5 ++++ tools/perf/arch/mips/entry/syscalls/mksyscalltbl | 32 ---------------------- tools/perf/arch/mips/include/syscall_table.h | 2 ++ tools/perf/util/syscalltbl.c | 4 --- 8 files changed, 12 insertions(+), 57 deletions(-) diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 2cf45e3f2659..ce7e9ae276e8 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config @@ -31,12 +31,12 @@ $(call detected_var,SRCARCH) ifneq ($(NO_SYSCALL_TABLE),1) NO_SYSCALL_TABLE := 1 - ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc s390 mips)) + ifeq ($(SRCARCH),$(filter $(SRCARCH),powerpc s390)) NO_SYSCALL_TABLE := 0 endif # architectures that use the generic syscall table scripts - ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch)) + ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch mips)) NO_SYSCALL_TABLE := 0 CFLAGS += -DGENERIC_SYSCALL_TABLE CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index ce2c4e1c0623..c9b78518c9a5 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -311,7 +311,7 @@ FEATURE_TESTS := all endif endif # architectures that use the generic syscall table -ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch)) +ifeq ($(SRCARCH),$(filter $(SRCARCH),riscv arc csky arm sh sparc xtensa x86 alpha parisc arm64 loongarch mips)) include $(srctree)/tools/perf/scripts/Makefile.syscalls endif include Makefile.config diff --git a/tools/perf/arch/mips/Makefile b/tools/perf/arch/mips/Makefile index cd0b011b3be5..6e1106fab26e 100644 --- a/tools/perf/arch/mips/Makefile +++ b/tools/perf/arch/mips/Makefile @@ -2,21 +2,3 @@ ifndef NO_DWARF PERF_HAVE_DWARF_REGS := 1 endif - -# Syscall table generation for perf -out := $(OUTPUT)arch/mips/include/generated/asm -header := $(out)/syscalls_n64.c -sysprf := $(srctree)/tools/perf/arch/mips/entry/syscalls -sysdef := $(sysprf)/syscall_n64.tbl -systbl := $(sysprf)/mksyscalltbl - -# Create output directory if not already present -$(shell [ -d '$(out)' ] || mkdir -p '$(out)') - -$(header): $(sysdef) $(systbl) - $(Q)$(SHELL) '$(systbl)' $(sysdef) > $@ - -clean:: - $(call QUIET_CLEAN, mips) $(RM) $(header) - -archheaders: $(header) diff --git a/tools/perf/arch/mips/entry/syscalls/Kbuild b/tools/perf/arch/mips/entry/syscalls/Kbuild new file mode 100644 index 000000000000..9a41e3572c3a --- /dev/null +++ b/tools/perf/arch/mips/entry/syscalls/Kbuild @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +syscall-y += syscalls_64.h diff --git a/tools/perf/arch/mips/entry/syscalls/Makefile.syscalls b/tools/perf/arch/mips/entry/syscalls/Makefile.syscalls new file mode 100644 index 000000000000..9ee914bdfb05 --- /dev/null +++ b/tools/perf/arch/mips/entry/syscalls/Makefile.syscalls @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + +syscall_abis_64 += n64 + +syscalltbl = $(srctree)/tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl diff --git a/tools/perf/arch/mips/entry/syscalls/mksyscalltbl b/tools/perf/arch/mips/entry/syscalls/mksyscalltbl deleted file mode 100644 index c0d93f959c4e..000000000000 --- a/tools/perf/arch/mips/entry/syscalls/mksyscalltbl +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 -# -# Generate system call table for perf. Derived from -# s390 script. -# -# Author(s): Hendrik Brueckner -# Changed by: Tiezhu Yang - -SYSCALL_TBL=$1 - -if ! test -r $SYSCALL_TBL; then - echo "Could not read input file" >&2 - exit 1 -fi - -create_table() -{ - local max_nr nr abi sc discard - - echo 'static const char *const syscalltbl_mips_n64[] = {' - while read nr abi sc discard; do - printf '\t[%d] = "%s",\n' $nr $sc - max_nr=$nr - done - echo '};' - echo "#define SYSCALLTBL_MIPS_N64_MAX_ID $max_nr" -} - -grep -E "^[[:digit:]]+[[:space:]]+(n64)" $SYSCALL_TBL \ - |sort -k1 -n \ - |create_table diff --git a/tools/perf/arch/mips/include/syscall_table.h b/tools/perf/arch/mips/include/syscall_table.h new file mode 100644 index 000000000000..b53e31c15805 --- /dev/null +++ b/tools/perf/arch/mips/include/syscall_table.h @@ -0,0 +1,2 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c index 7c8550ef0d7b..724e1391893f 100644 --- a/tools/perf/util/syscalltbl.c +++ b/tools/perf/util/syscalltbl.c @@ -25,10 +25,6 @@ static const char *const *syscalltbl_native = syscalltbl_powerpc_64; #include const int syscalltbl_native_max_id = SYSCALLTBL_POWERPC_32_MAX_ID; static const char *const *syscalltbl_native = syscalltbl_powerpc_32; -#elif defined(__mips__) -#include -const int syscalltbl_native_max_id = SYSCALLTBL_MIPS_N64_MAX_ID; -static const char *const *syscalltbl_native = syscalltbl_mips_n64; #elif defined(GENERIC_SYSCALL_TABLE) #include const int syscalltbl_native_max_id = SYSCALLTBL_MAX_ID;