Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp969577rdb; Sat, 7 Oct 2023 06:34:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFiq6ZoUe2HAicFNhd0HHq233OTPpaa3vMfP9cF1GAOBuD7gFQxO4frW6GebsPZPs780iKF X-Received: by 2002:a17:90a:8b0f:b0:276:785f:7edd with SMTP id y15-20020a17090a8b0f00b00276785f7eddmr10534367pjn.25.1696685678413; Sat, 07 Oct 2023 06:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696685678; cv=none; d=google.com; s=arc-20160816; b=Mb4TbW4sEGvVOjVq5ALOAAJ++bSZ3Yhfv+REQu3jfsFN5ATj0EPjTsPzQY9Dy+Qopj ueoMBI1Bnk4B1QRdWGcyWIyHgxdAfyCfkK5jIcft/tr7mlaXwSU7netrQMkXMg+Ez4xS zD396BpYxGRClomTuSFDLvzqMT9dWYzbxJAiV5b3MmPxqcKzeQQpg2s1QvdAYfziXbrV Sbe65H5Ujk755pxOE5HkFvXVlseOjuskYSr0o73u8AKzO5pv6fmB0oB6cJO+mi6lz3KB VTGGplAeKUYjk1xmkkLCvUTiXMFcgk/6jYWrjk5dMHvV4XQafCe2AGDAb6MwK5RvyUDd X18w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=9WqdPRqJ+uit9NTuBvlR9POFY3m85nsVh57xw+FjxTM=; fh=ag1hNIuLlf4Fk0D8D14u1Q6kSQPtK7GmK5CsXbIGlXM=; b=kuhSbjE+9BFsP8mLzz3CMiu/zEJtS5HxprCtDBtROSVi8hKHzLqnug9CNaHV50t9oZ jy7CPY+kDbRzCMNXt2XmpYAvT6W8V76l9JI5MrUMV3blpyQFEuAjOMe9QLF3bf4dgl7I ielf3vb2hdY/9qVm8mlbtiL4w7RElpajBKvl6o8xtXsj13FzePJyqRoH/2n0dGmtBJPI CvaoO8/8Np51safjlyOIAzc6JWXeKLXK9LSV3Rt0Ma0TsLTm+sbeNvq6Cg4dU8CM0ymP uq2WcWp5iO+vlDzYW16b1ImJ1ZmQ59W5YWVAqlFmX3sppZ7HDbGonUrpCd0x5rbRxJsU zMkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ob4-20020a17090b390400b00274d6373fe1si8817656pjb.120.2023.10.07.06.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 06:34:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 4A9FD803B3AC; Sat, 7 Oct 2023 06:34:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343880AbjJGN3w (ORCPT + 99 others); Sat, 7 Oct 2023 09:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343627AbjJGN3w (ORCPT ); Sat, 7 Oct 2023 09:29:52 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADAE6AB; Sat, 7 Oct 2023 06:29:48 -0700 (PDT) X-QQ-mid: bizesmtp88t1696685377tixjkyac Received: from linux-lab-host.localdomain ( [116.30.131.235]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 07 Oct 2023 21:29:36 +0800 (CST) X-QQ-SSF: 01200000000000E0Y000000A0000000 X-QQ-FEAT: uGhnJwy6xZJV/e0VH8OkfFMOH//RSXNosQBDUF7ZgNu4tnUxukivDhU5cuyB7 XloNsxalsLoVEKJoacjMo8tIjByfc9yws6qcaf5yIW9vl4Sv8vreGJSeYU7AnrWpgiDjEGA /jVVbA5i3USp5MjqqBTn7YOLTz3XIIk0qn5ClJkR2xmjHJe1kDXBygKbAmPMgDx5LOtLS6Y 9eGAxj+0xWVb5DMJ2JSUQzJYwkL0JeVKE3cTS2GilDQ4XBJ2f3/XgtY2brOAxG5IBiIEp74 u6q4EA4mlAyAUABRZ/h/CfeFTtBNqUYqJFiYk/TTGJP+USiKteN/iTi3Ckn6dFgQ/1ZCpgf WHHE9ur/U9x9YStAXTpSGRtqgQrNZ5IHLT5LFabhyeGDssoI6sMKWeHh1cdKI6fImGtbTAq X-QQ-GoodBg: 0 X-BIZMAIL-ID: 8522446484513126745 From: Zhangjin Wu To: arnd@arndb.de Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, tim.bird@sony.com Subject: Re: [PATCH v1 6/7] DCE/DSE: riscv: add HAVE_TRIM_UNUSED_SYSCALLS support Date: Sat, 7 Oct 2023 21:29:35 +0800 Message-Id: <20231007132935.6276-1-falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <3a8f0d0a-25ad-49c3-9cd2-66db44a4a1e6@app.fastmail.com> References: <3a8f0d0a-25ad-49c3-9cd2-66db44a4a1e6@app.fastmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Sat, 07 Oct 2023 06:34:36 -0700 (PDT) Hi, Arnd > 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. Thanks, Zhangjin > Arnd