Received: by 2002:ac8:1418:0:b0:3ab:920c:4c8b with SMTP id k24csp5402447qtj; Wed, 4 Jan 2023 07:33:03 -0800 (PST) X-Google-Smtp-Source: AMrXdXunnN0RNEttxvOVI2U7PQLterTrfHDjRwdgFsxoyyPzrhDKFIy0gPxhdS871cGtfICuqu7z X-Received: by 2002:a17:90b:c12:b0:226:2124:ef67 with SMTP id bp18-20020a17090b0c1200b002262124ef67mr27589848pjb.38.1672846383725; Wed, 04 Jan 2023 07:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672846383; cv=none; d=google.com; s=arc-20160816; b=OBQ6vGaul2dThNPZ6GN+giVt4oPJTS1WcO8h+kuKSV3xZfDjvJd7JvM07ZNi+gDLNF dkyL9QdBhm11z6Wjb2Wq3QOutvF6Lfk4s+OWYLTH0uiQdDNhcOt8A65cAMR/rvAQh06d KFT9CVHnTvTw7QL05Pf/cvF9CcO35ie8gr7SAFJW+wbCeBQ4SYj73Kv18A02bbdPqjbf QEZC2bXSGYfM7bzsAaVzeDXkvAfdGeptAlOhSfitUhWKtQnzGRPzx672DJMNY4YHZhPa 9x1c9M3pX7RlF6tw+hjoiIqKmLc01/XTl0ibZ0wjYLUdd75if5zqdQZmXKBE0qfKu6fB nZug== 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=fpEUk44maKjVWbWBkP1VcRbhT1/QJjXgzws8WxvQnas=; b=HWAR38Md9ac6mS278JOD3m/IGagO+9JJTKQBUkoUXlsSLo51BM8b8YeCUw9JLt/CN3 nLeCoIGNMgoNnVuBUuMP6NGGRFgoFSQyuN/FQfOAJPJgsjOzG8jTUDF41wKiqWYE3fbi ysnsmFGYFbVHaKUKeyIgECk7ZxRiBCofeMBfT+dPp/O+2l8NKuK25UDuF0S2Mx+oZ+sp My2x4zllYegekDHPdfM0xuzc91hTdO0Ho7fccWqxZ0oWsnQDCCcRuGj8Ng4LrSKG2Y6F vWwfeypsMSsBlIx9GCYY7eC3p3kC2LajxzKPZtHS29wfA7RWci9n+p61w758NvPKO1im 4Yuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=kjFbpSLZ; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=kKmqoWkR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a17090a9c0e00b0022688033d4esi6430513pjp.101.2023.01.04.07.32.55; Wed, 04 Jan 2023 07:33:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=kjFbpSLZ; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=kKmqoWkR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235104AbjADPIM (ORCPT + 57 others); Wed, 4 Jan 2023 10:08:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239470AbjADPHx (ORCPT ); Wed, 4 Jan 2023 10:07:53 -0500 Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2362A45E for ; Wed, 4 Jan 2023 07:07:52 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0BF615C0056; Wed, 4 Jan 2023 10:07:52 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute6.internal (MEProxy); Wed, 04 Jan 2023 10:07:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc: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=1672844872; x=1672931272; bh=fpEUk44maK jVWbWBkP1VcRbhT1/QJjXgzws8WxvQnas=; b=kjFbpSLZ4aiGDC8SwW7cyJUo0m VkhuO28hYkRv4r54enNhKqXtMI4sTsoo4v8C85qtYhTLi+h+VhhCRNbawPKi/1q6 JCjPTjAl2PhyFSHpnCkQftMWWTa0JlLDMa8USgnplPBsGf3cw34pkT9UPsmJdxDT 31EMPB05pHIQWRBe7NtKqF/GcPrVOPPIlWWdwpzqv6F5O7GUWdtFfYrT05odq6Ug xfv6QT38pqqnporvQuYjWRe5Gsycb/pf1ITeAzkQbtZtOMCErvx+mqGXoEnMNurC xUgmlNONGitdhtC8skYWuB4Bjk4wxF2NAR0tlEOWp+7SfASAqW1c2M21f+6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1672844872; x=1672931272; bh=fpEUk44maKjVWbWBkP1VcRbhT1/Q JjXgzws8WxvQnas=; b=kKmqoWkREmn4Guq1hXTHOjJo9VU/KKT7GRkjxDJdRZnA zbgOuK12/SODkgJhh8eXGWNnuAVKz/lxw3r+kM28FrwDJTjVmY8S33AmY12hW4P2 jScQsKTHuG5aRqnfRsdFlzQvR3RkV5nlPDlFNKHqe6Uf/kQ0d54OGkZw8YrqhSVV x5ihN0E9o1DYSFJKBKz1ruHtTlIPixNgFWanJkoFDOpNQBlPeSuu3X5CVGJciDao IQ3jsxono4YjPI4PzSGtijjoNn4j3GQ9B1qGLM73pNFx24jINQvJNwumZiX+v4Zm IWq3qCIhpW2l9pv6NNO1fsrd6FjTVXAWL40QwpKyTg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrjeeigdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdetrhhn ugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrghtth gvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedtkeet ffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrh hnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7E44CB60086; Wed, 4 Jan 2023 10:07:51 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 Mime-Version: 1.0 Message-Id: <7c747897-bb5b-46b0-a342-aefe30079c06@app.fastmail.com> In-Reply-To: <20230103164359.24347-13-ysionneau@kalray.eu> References: <20230103164359.24347-1-ysionneau@kalray.eu> <20230103164359.24347-13-ysionneau@kalray.eu> Date: Wed, 04 Jan 2023 16:07:32 +0100 From: "Arnd Bergmann" To: "Yann Sionneau" Cc: "Christian Brauner" , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, "Clement Leger" , "Guillaume Thouvenin" , "Julian Vetter" , "Julien Villette" , "Marius Gligor" Subject: Re: [RFC PATCH 12/25] kvx: Add system call support Content-Type: text/plain X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 On Tue, Jan 3, 2023, at 17:43, Yann Sionneau wrote: > + > +/* > + * Ensure that the range [addr, addr+size) is within the process's > + * address space > + */ > +static inline int __access_ok(unsigned long addr, unsigned long size) > +{ > + return size <= TASK_SIZE && addr <= TASK_SIZE - size; > +} This is the same as the generic version, so just use that instead. > +#define HAVE_GET_KERNEL_NOFAULT > + > +#define __get_kernel_nofault(dst, src, type, err_label) \ > +do { \ > + long __kr_err; \ > + \ > + __get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \ > + if (unlikely(__kr_err)) \ > + goto err_label; \ > +} while (0) > + > +#define __put_kernel_nofault(dst, src, type, err_label) \ > +do { \ > + long __kr_err; \ > + \ > + __put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \ > + if (unlikely(__kr_err)) \ > + goto err_label; \ > +} while (0) The wrapper around __get_user_nocheck/__put_user_nocheck is not ideal here. Since I think you only support new compilers anyway, you can use the asm-goto-with-output feature to define the asm to branch to the label directly, and use the same thing to build __get_user()/__put_user(). > +++ b/arch/kvx/include/uapi/asm/unistd.h > @@ -0,0 +1,16 @@ > + > +#define __ARCH_WANT_RENAMEAT > +#define __ARCH_WANT_NEW_STAT > +#define __ARCH_WANT_SET_GET_RLIMIT > +#define __ARCH_WANT_SYS_CLONE3 It's good to have clone3() but the other three sets of syscalls should no longer be defined for new architectures, so please remove those. Arnd