Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5888574rwb; Wed, 21 Sep 2022 14:04:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM727wLsI7ceazRI10jGFZDFPnxLFmpDgtSw2Pi0UqLJtBKcSvxvNxrDp9m7ESvzektUjNlH X-Received: by 2002:a17:902:720c:b0:172:a1ff:8c21 with SMTP id ba12-20020a170902720c00b00172a1ff8c21mr62840plb.159.1663794271832; Wed, 21 Sep 2022 14:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663794271; cv=none; d=google.com; s=arc-20160816; b=kuHt1rJCZFTU2wr0rgIczgWkDebmlraBtn2NgwMMJ7Jl1iVHyg6Vl2NHemVnsXh2Ib FDUFO6Ng0Z6Kq4ZknaKS2Q820lCE/zzYMN2TP4wYnA1PX4KcC3vt2DmLaqaVoMhaup0E WcbvIPoMGIiIY2vEzPjEJhZlgeo7t9Muou0zNgWUQxNDpHpLTMxmiqdxRo2naU48DjqH 4wau25CCDkKts6668VU4gSP8ZBRRcGZNU/K9uOrIeL8KrbJVDAf2ZU7dhq3zfVNPfWXr kTM4d2yb3YXF70hukALNx0xP84xr9NQ/PUB7qBIhdrK7mwStm+W3Fcr7b9GIMCiiBLDN s2Cw== 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:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=sqG2AIDQKKDIE+aKBMVPmM2IG52evSEYbtT3naoareY=; b=lfKx60DCEpybZaIO3sfh2YmJkjme8bMTi1S2uus+8WMvtxRLo++EOcwdxpj8R/8zzW eyUrUp0DxRAJXguKPzK4ZFK3LlV5VEvzqSDyJ1y/9HGL4Q8MyihiwbYjXFOhhWX7uGHY 0HkRJEcXEwVYhTlvJSOcr9BDOxedd20SOAISgax4VIGaFj3ipkGpJjLMzij1vjglFkWg y6wZAunsfzZuwoppgLtv/Qin9E8KsZDuYS4gjR25r+ZofldjQJaXb9I0rUawhbbAoyde R9DFZ4QuhT/qgdzVW/MOr9c3lqi5oFE5BMFfQ36xep/4T86Aw93NPvp8TGX2HDIUYEHJ Leww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=BBSldU+b; 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 q98-20020a17090a17eb00b001fe2eaaf1d6si3767448pja.62.2022.09.21.14.04.12; Wed, 21 Sep 2022 14:04:31 -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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=BBSldU+b; 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 S230443AbiIUUZK (ORCPT + 99 others); Wed, 21 Sep 2022 16:25:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbiIUUZH (ORCPT ); Wed, 21 Sep 2022 16:25:07 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC0033A20 for ; Wed, 21 Sep 2022 13:25:06 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id a29so7121241pfk.5 for ; Wed, 21 Sep 2022 13:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date; bh=sqG2AIDQKKDIE+aKBMVPmM2IG52evSEYbtT3naoareY=; b=BBSldU+bSB4OlpR9ZugkdEuCgPBnKNc+8QbIKCogH4mDwvWJ9SnKnG2omcEjKB4djJ Tih3+qSVPrty+9QPwr2RGb/XzY++8EKchwWodpep1/VYX3d6IO41WIL7wK3js2pSq1je tXfGQwpOgAWMDbIov1mD+/XnKLu0nQzYOom2W+IwKC8+Oq/pn2qAQKAMb2ApWwFd+SIT HsWpb5ULu6TZqVKmW44N2UeOxmqFihUWiChncYu3TOvzxVznBE/CW+cQz83GqpUQkVkg q6Mi0tGHmMuVGrXSFiXABJooHQr0egYvAIZ3MYbprwMJERtGe+okOe/oMz1w7zprMfc6 xRbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date; bh=sqG2AIDQKKDIE+aKBMVPmM2IG52evSEYbtT3naoareY=; b=E1TE4O1+mdk4Znv1GpskCveOOR2AjfQAtp2o+ybPyCZiA/fAVK704og+mLZNp2YI2H GY5ERKmzxJA09gaz0Yy2LvWGQBml/3RWQAwJoB/ZXysE2noO4IsJe6a7X4SBDTolEtRO 9xfzwXx0jijSoIKD/z+XFBp1flnAHBYLKS2acKMu9pUacH0eejTi0c+/74gMH35eBtHd aI5sJzNZv9iG9Dh3swhqflZ2+qTfzKPqMzYYb/Ty2Uy5vQW6O6heUBnBymA2t+eqYBCG slj7Ei3KNygFowqJYukTcTrD/nrx64ctjfuwQ1riqE+7HV9PT75ce98hGfH+Yr3VqTnN 1DOw== X-Gm-Message-State: ACrzQf3WNx/iEN3yMcsnlsl5JrQrSU/XAzHurHT44YGc5lXFaG+bWSS/ rQe9zIxMHttYj2kKACtl/tT4CA== X-Received: by 2002:a05:6a00:3392:b0:547:f861:1fad with SMTP id cm18-20020a056a00339200b00547f8611fadmr31009348pfb.16.1663791905942; Wed, 21 Sep 2022 13:25:05 -0700 (PDT) Received: from localhost (p200300ee3707fe003af25da13a798889.dip0.t-ipconnect.de. [2003:ee:3707:fe00:3af2:5da1:3a79:8889]) by smtp.gmail.com with ESMTPSA id s17-20020a170902ea1100b00176b5035045sm2419819plg.202.2022.09.21.13.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 13:25:04 -0700 (PDT) Date: Wed, 21 Sep 2022 13:25:04 -0700 (PDT) X-Google-Original-Date: Wed, 21 Sep 2022 08:31:52 PDT (-0700) Subject: Re: [PATCH -next v2 2/2] riscv: extable: add new extable type EX_TYPE_KACCESS_ERR_ZERO support In-Reply-To: <301cd27e-d003-584b-2eb0-8fa025348cff@huawei.com> CC: ajones@ventanamicro.com, Paul Walmsley , aou@eecs.berkeley.edu, Conor.Dooley@microchip.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, wangkefeng.wang@huawei.com, guohanjun@huawei.com From: Palmer Dabbelt To: tongtiangen@huawei.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Sat, 27 Aug 2022 03:39:38 PDT (-0700), tongtiangen@huawei.com wrote: > > > 在 2022/8/26 16:16, Andrew Jones 写道: >> On Fri, Aug 26, 2022 at 02:44:48PM +0800, Tong Tiangen wrote: >>> >>> >>> 在 2022/8/25 19:06, Andrew Jones 写道: >>>> On Mon, Aug 15, 2022 at 03:20:25AM +0000, Tong Tiangen wrote: >>>>> Currently, The extable type EX_TYPE_UACCESS_ERR_ZERO is used by >>>>> __get/put_kernel_nofault(), but those helpers are not uaccess type, so we >>>>> add a new extable type EX_TYPE_KACCESS_ERR_ZERO which can be used by >>>>> __get/put_kernel_no_fault(). >>>>> >>>>> Only refactor code without any functional changes. >>>> >>>> This isn't quite true. __get/put_kernel_nofault now sets a different >>>> extable type (as the commit message says). But, nothing special seems >>>> to be done with that, so there's effectively no functional change. Can >>>> you please elaborate on the motivation for this change? Where will the >>>> KACCESS type need to be distinguished from the UACCESS type? >>> >>> The introduction of EX_TYPE_KACCESS_ERR_ZERO does not change any function, >>> but makes a correct distinction in the actual type, indicating that there >>> are indeed some kaccess entries in extable. I think this optimization is >>> more clear and reasonable. >> >> Well, creating new types, just for new type sake, just bloats code. >> >>> >>> A few weeks ago, I did something similar on arm64[1]. I think this >>> optimization can also be used on riscv. >>> >>> We can do some features that are used on uaccss but not applicable on >>> kaccess in the future[2]. >>> >>> [1] >>> https://lore.kernel.org/lkml/20220621072638.1273594-2-tongtiangen@huawei.com/ >>> [2]https://lore.kernel.org/lkml/20220812070557.1028499-4-tongtiangen@huawei.com/ >>> >> >> This is part of the information, but I had already found this. What's >> still missing to me are the riscv patches, or at least a riscv plan, for >> actually implementing something which requires kaccess and uaccess to have >> distinct types. >> >> Thanks, >> drew > > At present, there is no such plan on riscv, because it is rely on > hardware support. > I think this patch can be merged as a small code optimization and > without any function change. Generally we need some use of the code in the upstream kernel to justify its existence. In this case I don't really see that: it's just another type that's exactly the same as the existing one, having some out of tree code that depends on making these types do something different isn't a sufficient justification.