Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9977062rwp; Thu, 20 Jul 2023 12:36:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/3ApYhlBMRBUjob2upljJyquRj4G9au0USPimW5rZRF31Q7QSHymiZnVmr94rmWrP1CaF X-Received: by 2002:a17:902:bc85:b0:1b8:76fc:5bf6 with SMTP id bb5-20020a170902bc8500b001b876fc5bf6mr366389plb.43.1689881763324; Thu, 20 Jul 2023 12:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689881763; cv=none; d=google.com; s=arc-20160816; b=YNEW1vC52VPjv55q86hkqx2idnWjbBAJ8OoNj/AlA42qTHQwW8VduvFHiepBKRl6ka 4iM4DH7TJHYCprlUgfW3B2BQRnWrAKdpdYO3vAoZq5hpamjMfzo+q32GJmdX1IAY2LZW VjyzUGKoPRCwPi0MWr27AEXxJXBRENo25zAsMItu2jDROgFH1M/ommA5LsorECvAI8Jn Rm4c/AdJnb/coCV55HYrcY9k7uqKWHI7GF00KgGfdvFZOo4snK0dwAr6zMSAyazQL8EV xfyDk6FoyFIlGcR5lNYhDaPhUrfYv2b5LLlJEpk/i4mQrY3sElyTuFA+UNOqjHubKNfQ CCvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:cc:to:date :from:dkim-signature; bh=/Sg8ZUof4litkbVkI93lEgkMdRKQns2dkKRJ6nxytjc=; fh=j0mIxYw5aDBsoaeDq9u1A6LTFRf+YkOzZj3Mmxv5p1I=; b=bqlS7FU48TT6gACdfBj8BQREvlwPelYYT1ic39TIAtLSYmhViP8FCLRtORmNrBZBIM rXxSwonmS0/eZUoM4mjSBtkmFwSpgHKje1xH5t5atg673zrvAwGn/G7fkDoLc2MYRhOr K9okM3r3RM1WIXcp3LK18BaLjVfZkiwPnLTiJseNFMo+A+Ynn5mNV0tO63boH+2SYbUO P0M+nRM2ZccgzBnO4dl0/4z+IJ4VvPAiM245nLCJ+BDoqjCkuoNLIInMxsn1zu/fyePa sgm+r7zD6PCKyLvfeu+Mn75uwX+1dzCS8DC9m76jOwdzHcUay10JhywixQ033Lm+pDgj aWVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=GXAmdxea; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a170902c65100b001b9d5e34e57si1332267pls.415.2023.07.20.12.35.50; Thu, 20 Jul 2023 12:36:03 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b=GXAmdxea; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbjGTTYe (ORCPT + 99 others); Thu, 20 Jul 2023 15:24:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbjGTTYd (ORCPT ); Thu, 20 Jul 2023 15:24:33 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DC13171E for ; Thu, 20 Jul 2023 12:24:32 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id d2e1a72fcca58-666ecb21f86so1014166b3a.3 for ; Thu, 20 Jul 2023 12:24:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689881071; x=1690485871; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:date:from:from:to:cc:subject :date:message-id:reply-to; bh=/Sg8ZUof4litkbVkI93lEgkMdRKQns2dkKRJ6nxytjc=; b=GXAmdxeabjwJMPspdMR69ghzU9reliykQR+pO/kFRAHXyaOq2QQWLw2SMbQucFHQV9 /fVbvWAQ41BINMQURi6E8uv7Nk0OOdnJwRKbmoqdMqtNPWrwXoHgNahv4Sudfu2g967V xeSxU0X9vGL+q/Ku+GHYhzRbpjvOi33+dJfyPh6uaTDs1OVKMzpqJ4avBt+prjKpSR/a GUUlgRt5y+zwXBi96MzfUvC0HL0GiNAVooaRoJN2FivNvRc29hkgPlOvufo5a1FLju84 HxxNHZEmaz67C9GqWsm7Y/F+qpZpIRxYDpKT2dJZ9ctLUlh1l+p5Sw6EcGOtVyg99YMW R8og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689881071; x=1690485871; h=content-transfer-encoding:mime-version:message-id:references :in-reply-to:user-agent:subject:cc:to:date:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/Sg8ZUof4litkbVkI93lEgkMdRKQns2dkKRJ6nxytjc=; b=V5Ai22VQmYXk8fcdF5jpqorH3AexFnHVXSPDBHTLRbnEiAYv0bPwJXZModAR2Y32q3 jOY2sDYHGtLBNlrGwQ6mRCgpudESThlAyQ20qmsiVQk7hqc4faoUSby80LzwjccSL3ed lOuISSyxJEnkMcz7nFWBA3j7A6ow6ZENlWOdrlMSbDGkhtFqF9Fda3buDgrQGDhawAwa B5QlCasY6q0XQHBA1e1n4GnzpbBsdV33OLDMWdjoRrHLI8IHXu4VFieKvLFuzLQ+TcLZ 3dWp67X1s3K46IrjuLEBc+oT1SQJnD40fcpbGqlU5ZiPt30wluqdRBFGyR99f/LJVBX7 ZWNA== X-Gm-Message-State: ABy/qLbvbVixYgMtwxQByVGXoHeTrX0qcae3cnpQx69WFyDZ4nshBri/ 2rcpILjKb/ozQ6hcGC0scxA= X-Received: by 2002:a05:6a20:7288:b0:131:a21:9f96 with SMTP id o8-20020a056a20728800b001310a219f96mr510744pzk.6.1689881071203; Thu, 20 Jul 2023 12:24:31 -0700 (PDT) Received: from [127.0.0.1] ([212.107.28.55]) by smtp.gmail.com with ESMTPSA id q18-20020a639812000000b00563709c8647sm1642656pgd.7.2023.07.20.12.24.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jul 2023 12:24:30 -0700 (PDT) From: Celeste Liu X-Google-Original-From: Celeste Liu Date: Fri, 21 Jul 2023 03:24:08 +0800 To: =?ISO-8859-1?Q?Bj=F6rn_T=F6pel?= , Andreas Schwab CC: Palmer Dabbelt , Paul Walmsley , Albert Ou , Guo Ren , =?ISO-8859-1?Q?Bj=F6rn_T=F6pel?= , Conor Dooley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Felix Yan , Ruizhe Pan , Shiqi Zhang Subject: Re: [PATCH v3] riscv: entry: set a0 = -ENOSYS only when syscall != -1 User-Agent: K-9 Mail for Android In-Reply-To: <87wmyvq7ai.fsf@all.your.base.are.belong.to.us> References: <20230718210037.250665-1-CoelacanthusHex@gmail.com> <878rbbkgqo.fsf@all.your.base.are.belong.to.us> <54D8BFF7-C4D2-417E-B18C-62B5DB17B51B@gmail.com> <87wmyvq7ai.fsf@all.your.base.are.belong.to.us> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 July 20, 2023 5:08:37 PM GMT+08:00, "Bj=C3=B6rn T=C3=B6pel" wrote: >Celeste Liu writes: > >> On July 20, 2023 12:28:47 AM GMT+08:00, "Bj=C3=B6rn T=C3=B6pel" wrote: >>>Andreas Schwab writes: >>> >>>> On Jul 19 2023, Celeste Liu wrote: >>>> >>>>> @@ -308,7 +312,7 @@ asmlinkage __visible __trap_section void do_trap= _ecall_u(struct pt_regs *regs) >>>>> =20 >>>>> if (syscall < NR_syscalls) >>>>> syscall_handler(regs, syscall); >>>>> - else >>>>> + else if ((long)syscall !=3D -1L) >>>> >>>> You can also use syscall !=3D -1UL or even syscall !=3D -1=2E >>> >>>The former is indeed better for the eyes! :-) The latter will get a >>>-Wsign-compare warning, no? >>> >>> >>>Bj=C3=B6rn >> >> Well, that's true=2E And I just found out that by C standards, converti= ng >> ulong to long is implementation-defined behavior, unlike long to ulong >> which is well-defined=2E So it is really better than (long)syscall !=3D= -1L=2E > >If you're respinning, I suggest you use David's suggestion: > * Remove the comment I suggest you to add > * Use (signed) long > * Add syscall >=3D 0 && > * else if (syscall !=3D -1) > >Which is the least amount of surprises IMO=2E v4 has sent