Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ADC5C433DB for ; Mon, 28 Dec 2020 02:43:55 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 00C8220796 for ; Mon, 28 Dec 2020 02:43:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00C8220796 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=axis.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Date:Message-ID:MIME-Version:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=A1zIzmnhyDeDdil06dH3RtA9e5MlcYC2FPdUOsuIV54=; b=pZY0dx75b5qmgYNaPQiaspyHZE OxYUtyYNkn1sE7wOZiK8xypsGaKL+unJOshR23zK92sGVvB9EhGBQXkZtGhaiKjY4kNoquYYcleSK 0MEF1gzcmO6xOs8+nGiqsKMfb02SoXzobUTIAvpdA3AKn3xYRqQUzum8muNE5D6394pSaATgmx939 qB/uki+jsf8eS7TxW/nGBtmjAGgmQnv2eCrYJ/FJdEDQvIycBDv0TkV49j2uqGqyZt3kNCokkRg0t Iy7OyzzqRCN94+KgfY5cIPOgTLKR0IPFp/aFV3eN3aaXNimOxFIB96MBJoiBbXqMrQuuDX1QXVjxE n/QNyRRg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktiTz-0005Pe-T3; Mon, 28 Dec 2020 02:42:03 +0000 Received: from smtp2.axis.com ([195.60.68.18]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktiTw-0005Ol-I7 for linux-arm-kernel@lists.infradead.org; Mon, 28 Dec 2020 02:42:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1609123320; x=1640659320; h=from:to:cc:subject:mime-version: content-transfer-encoding:message-id:date; bh=c/Ou/kG0IGXrZXF2bpT2eD4g6EjPFR87QllRTAJk7vs=; b=QLLN0PAfyL3uIWcaxvULVDqtjpOhRwTtmPFitLGZSYarf0zNInN0JLtg ORa91FsIUYHsqRvVTiiW6ncuJsDLwz9RxgmPZw04DyBVR9Hn+Q2xqTov0 fQLTCUyys94YH/0EsraXG7wyZkmqiefSFLMnsHOqVc6pS4/dxKjbu9xoh qIUma9wxmN/h1lGbovjFjw5p5NDCv0bkzXOZzfjqx2cA/U3kEPcZC69g7 rWV8QrSVrFI4n5+1FlqaopQjHRyvVDOM46qZpJVxarKDLs8oc1+VP/hzc htVZgv/3MwZrxzNbYcIdaGEtizXolQFW4Ebsyw5HolVsrBKLV+fUt1M8q A==; From: Hans-Peter Nilsson To: , Subject: [PATCH] perf arm64: Simplify mksyscalltbl MIME-Version: 1.0 Message-ID: <20201228024159.2BB66203B5@pchp3.se.axis.com> Date: Mon, 28 Dec 2020 03:41:59 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201227_214200_864905_184C4D1A X-CRM114-Status: GOOD ( 10.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kim Phillips , Mathieu Poirier , Peter Zijlstra , Jiri Olsa , John Garry , Arnaldo Carvalho de Melo , Alexander Shishkin , Ingo Molnar , Leo Yan , Namhyung Kim , Will Deacon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch isn't intended to have any effect on the compiled code. It just removes one level of indirection: calling the *host* compiler to build and then run a program that just printf:s the numerical entries of the syscall-table. In other words, the generated syscalls.c changes from: [46] = "ftruncate", to: [__NR3264_ftruncate] = "ftruncate", The latter is as good as the former to the user of perf, and this can be done directly by the shell-script. The syscalls defined as non-literal values (like "#define __NR_ftruncate __NR3264_ftruncate") are trivially resolved at compile-time without namespace-leaking and/or collision for its sole user, perf/util/syscalltbl.c, that just #includes the generated file. A future "-mabi=32" support would probably have to handle this differently, but that is a pre-existing problem not affected by this simplification. Calling the *host* compiler only complicates things and accidentally can get a completely wrong set of files and syscall numbers, see earlier commits. Note that the script parameter hostcc is now unused. At the time of this patch, powerpc (the origin, see comments), and also e.g. x86 has moved on, from filtering "gcc -dM -E" output to reading separate specific text-file, a table of syscall numbers. IMHO should arm64 consider adopting this. Signed-off-by: Hans-Peter Nilsson Cc: John Garry Cc: Will Deacon Cc: Mathieu Poirier Cc: Leo Yan Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Kim Phillips --- tools/perf/arch/arm64/entry/syscalls/mksyscalltbl | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl index a7ca48d1e37b..22cdf911dd9a 100755 --- a/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl +++ b/tools/perf/arch/arm64/entry/syscalls/mksyscalltbl @@ -23,34 +23,17 @@ create_table_from_c() { local sc nr last_sc - create_table_exe=`mktemp ${TMPDIR:-/tmp}/create-table-XXXXXX` - - { - - cat <<-_EoHEADER - #include - #include "$input" - int main(int argc, char *argv[]) - { - _EoHEADER - while read sc nr; do - printf "%s\n" " printf(\"\\t[%d] = \\\"$sc\\\",\\n\", __NR_$sc);" + printf "%s\n" " [$nr] = \"$sc\"," last_sc=$sc done - printf "%s\n" " printf(\"#define SYSCALLTBL_ARM64_MAX_ID %d\\n\", __NR_$last_sc);" - printf "}\n" - - } | $hostcc -I $incpath/include/uapi -o $create_table_exe -x c - - - $create_table_exe - - rm -f $create_table_exe + printf "%s\n" "#define SYSCALLTBL_ARM64_MAX_ID __NR_$last_sc" } create_table() { + echo "#include \"$input\"" echo "static const char *syscalltbl_arm64[] = {" create_table_from_c echo "};" -- 2.11.0 brgds, H-P _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel