Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1135091rdb; Sat, 7 Oct 2023 13:43:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHG2zrG22oC5j3kdSSdBQKWwyXvkQdC7rkoYDChGgxOX15eg2gt/SU+FEsVAiHdhRrhDu9i X-Received: by 2002:a05:6a20:3d03:b0:15e:bb88:b76e with SMTP id y3-20020a056a203d0300b0015ebb88b76emr13452568pzi.14.1696711419496; Sat, 07 Oct 2023 13:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696711419; cv=none; d=google.com; s=arc-20160816; b=kAGnrLUhngJPbjcuQYtGybdf72rGwDhL9Rl4VjpgW/ZuKQKpGoFqi7+L7KWgA/Pj+r 4mng7+IOtWYplwbQqw3xsXzWDZ39R2XhycAbKfbA2111ChlZDKwiQTbmf/rrPLoidJr9 KfZgidV7Rs8PKAjNC081IpakXdei5pbBSBlepFF6/qnErXuPmnJgoJfprglO7JxMZX5f 6rxSaovXLlJ0kWwSApXYkrE2f0s5B8bvmxjPnHx7cy8Af2XzYO2Bz6oS3kYnZkHvcn0s Tl8PnFhbnzLetg3zJWpqmTwN23rDGbxWCw1/14N0HRRxn1ENG7y6i/17AagrlOP4CjE8 i0vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=Jd6oPV1HwL3F0QLUt2/FiCFCe/IH/cVqDsjrmGPSj08=; fh=BlCoEQ7tlPSGhghHBI8nsOMtNenXc1aa7pPLIR0LlX4=; b=E8YSDhmYkVOnuyMJyvXR4CfCdQhihqFeCsAHcLIYbzex6bfwllgj13BUcrQ82Ga3yf kemEBtC6PWMjjm0c1oqmo736j1iqKfYU7ll2H/bCvp/Ww6ZiUgTIBN1sc36V8qfiwifV zXjwXDTHYM7jTMU1PndNuNIcBXz/jMyShE4ikBkWKAodSwst+MciRseit+XzrI7NAZIQ D0CsNiOGRTbL6tbBJ/kNH/oys8QC0V2DcDq2o7mcW2UGHbGaSOOVHemmK5IEb0ULpyOu YPXUXbu4LA9SW+FcgR4xPfiSK/euZDcijFGRNwb7GujlAbDNPIdd8cXVoCruwQGq8lBP AItA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=PcbdYMuj; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=G7pisHS2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bq25-20020a056a000e1900b0069339f19f7dsi4108187pfb.199.2023.10.07.13.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 13:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=PcbdYMuj; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=G7pisHS2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8D26C804ACD6; Sat, 7 Oct 2023 13:43:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344164AbjJGUnb (ORCPT + 99 others); Sat, 7 Oct 2023 16:43:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344151AbjJGUnb (ORCPT ); Sat, 7 Oct 2023 16:43:31 -0400 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F18E93; Sat, 7 Oct 2023 13:43:29 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 282563200A41; Sat, 7 Oct 2023 16:43:28 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute5.internal (MEProxy); Sat, 07 Oct 2023 16:43:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1696711407; x=1696797807; bh=Jd 6oPV1HwL3F0QLUt2/FiCFCe/IH/cVqDsjrmGPSj08=; b=PcbdYMujupkVriXQqs nxdE2yb0NKJK03O8nigY9gnDF4ryRVi81s4Ql7hIQoqL/oB9hIrWuL2fYkv+w7z+ QWUSKwMTFJHKJV9yPM1kNsRkCqoHpTUBp/eBgb3L0mdfeQLlKZ/Q4BfBJvzcMs2h XwksBGE+sOPkPxsDHxaJZJfI7HwcThXLOGJWa1COswoS+CilKoP3QpILKAr1l3tD G0RjMroZmrZQHVOalenDRm0SvulC0D6v8SPkMBdKMu78J+bTH71p1BYsdWP4LN5T wqgw3J0IeUmQamPEfbCSRZWSTchHBBzmPmCZd1YLQhVVlh2OyzusrtD5fHQ+O6AC 2XPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1696711407; x=1696797807; bh=Jd6oPV1HwL3F0 QLUt2/FiCFCe/IH/cVqDsjrmGPSj08=; b=G7pisHS29ez4Ol95QqqbusGJhoNNJ pAsabspLytCgj8DLReaWzIm37dEA+HPsgSttggb7GLGl0mKboZ6zRzEULwDd3BpV zU0XbPu8jQlg5wtgmxnlm4sZNGDuTC9mzt8Q7kcx2YSD20nukAkqv1tANMn1sVg+ l3VfFEAfgiJ9zE5xSJvEgX1h/rjZ0y3l3zmiIluYmbgKsSvOTftV2Srzojzjunvr TCQr8SEa66GJf2clQ20rzgTJ/d4O+pJXQ/Jo9cP5edRK/oOX7lveK0iqyROT5RQE OlRI04Mdja+ylFoltGOmjA9mjgmrz0mHLXWFCL3I/P27Hn6/oDCBQAqug== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrgeelgdduhedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7825E1700089; Sat, 7 Oct 2023 16:43:26 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-958-g1b1b911df8-fm-20230927.002-g1b1b911d MIME-Version: 1.0 Message-Id: In-Reply-To: <20231007132935.6276-1-falcon@tinylab.org> References: <3a8f0d0a-25ad-49c3-9cd2-66db44a4a1e6@app.fastmail.com> <20231007132935.6276-1-falcon@tinylab.org> Date: Sat, 07 Oct 2023 22:43:06 +0200 From: "Arnd Bergmann" To: "Zhangjin Wu" Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, "Tim Bird" Subject: Re: [PATCH v1 6/7] DCE/DSE: riscv: add HAVE_TRIM_UNUSED_SYSCALLS support Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 07 Oct 2023 13:43:38 -0700 (PDT) On Sat, Oct 7, 2023, at 15:29, Zhangjin Wu wrote: >> On Tue, Sep 26, 2023, at 00:42, Zhangjin Wu wrote: >> > For HAVE_TRIM_UNUSED_SYSCALLS, the syscall tables are hacked with the >> > inputing unused_syscalls. >> > >> > Firstly, the intermediate preprocessed .i files are generated from the >> > original C version of syscall tables respectively, and named with a >> > 'used' suffix: syscall_table_used.i, compat_syscall_table_used.i. >> > >> > Secondly, all of the unused syscalls are commented. >> > >> > At last, two new objective files sufixed with 'used' are generated from >> > the hacked .i files and they are linked into the eventual kernel image. >> > >> > Signed-off-by: Zhangjin Wu >> >> As mentioned in my comment on the mips patch, hacking the preprocessed >> file here is too much strain on the old infrastructure, the >> asm-generic/unistd.h file is already too hard to understand for >> anyone and in need of an overhaul, so let's work together on fixing >> it up first. >> > > Ok, I was thinking about using asm/syscall_table.h instead of > asm/unistd.h like mips. > > void * const sys_call_table[NR_syscalls] = { > [0 ... NR_syscalls - 1] = __riscv_sys_ni_syscall, > #include > }; > > Therefore, we can generate syscall_table.h from asm/unist.h with a tool > like scripts/syscallused.sh > > Another solution may be firstly generate a list of `#define __USED_NR_##call 1` > for the used syscalls from Kconfig symbol, and then change __SYSCALL() macro > to: > > #define __SYSCALL(nr, call) [nr] = > __is_defined(__USED_NR_##call) ? __riscv_##call : > __riscv_sys_ni_syscall, > > `include/linux/kconfig.h` defined the '__is_defined'. > > This method may work for the archs with .tbl files too. Right, either way would be much better than than your first approach. For the mips version (and all the other traditional architectures that use the syscall.tbl method) I think I'd integrate the filtering in scripts/syscalltbl.sh if we decide to go that way. For the riscv version (and all the others using asm-generic/unistd.h), the __USED_NR_## macro would be fine as an intermediate step, until we manage to convert those to syscall.tbl parsing. On the other hand, based on the earlier findings, my overall feeling is that we're better off not adding the extra indirection at all, but instead add the more Kconfig symbols to control the largest groups of syscalls, with the hope of conditionally removing additional code for each of these symbols beyond the automatic gc-section logic. Arnd