Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp51221rwe; Thu, 25 Aug 2022 23:57:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ttiKnmhn7yWJt83R+J8OTY4V7i7ySTpQ5+/xjgtRu/TQa1iIV1YZ3Tdz0hjEvgY+18xtQ X-Received: by 2002:a05:6a00:1996:b0:52e:b0f7:8c67 with SMTP id d22-20020a056a00199600b0052eb0f78c67mr2556024pfl.20.1661497040475; Thu, 25 Aug 2022 23:57:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661497040; cv=none; d=google.com; s=arc-20160816; b=CkSTSX48CZpH1g3UKaagzWO2iUv8I4Pk/T/liY8Xk9r0OpCaRZsy/6/0qHv5YIdSsf x3VoNeT27MbxY43doCzIbayKqKODt16zNL0tcvANNM5kAyrqRcsgqp8e20dwizzKZCvD Oi/Sxt2dBeNtScFFAKiHJc2/DjbrE280yornVEe+DRi+EcrvTEH7OxNZMAwNl7U2ptIE l/BErAUJxK3zRqAQ1xsJm5DLZjfTJl3VqAfAwzJ3zL2IIs3fGKhh5YIOVOfy5nV2CNKS mFYDmKgDACp8Qc5gqjGoR5LRYTLtFY1iLpNePD9MpAWIDcKWrofdZdcArp/HTSgEZACI DZOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=iMeucohbqQFrNrkOm6s722EO+1Zd4yImCQ9PYYntpII=; b=sSO6ulF7GOvkGkPVNkO1Q9kHkDJZ6NKpJXEk/Ny6b25Oghcw2gmjMUt+w7S3XIMXn7 w0B6Grg4upl2jiKDXADt5E+9qFpAKzZeQ52hj7xvMlWaQGCri8JCfXV64yOXorCAbFrP C9t+M3hgk6dDiTD2+QRajlmAUw376GyML3oDLKv8SR5yViHE10HwTrb77crZXpm/t2dR 9vdt77ghN0phF86M/lGxa3gh0VNyMaESyIYuFe+9OWQG5bSf8ermh9Nj57CaOjqBm82b 5+rl28i6Hptlq/QCbqH5Togk3QQU6BGOpVakgF6fCZcEVVTW6rSf+OWAeVlRS38XjV8D dNKA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a170902c40400b0016c512176adsi968172plk.576.2022.08.25.23.57.08; Thu, 25 Aug 2022 23:57:20 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245018AbiHZGdy (ORCPT + 99 others); Fri, 26 Aug 2022 02:33:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240824AbiHZGdw (ORCPT ); Fri, 26 Aug 2022 02:33:52 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52F42D11D8 for ; Thu, 25 Aug 2022 23:33:51 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MDVLw34WWzkWfR; Fri, 26 Aug 2022 14:30:16 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 26 Aug 2022 14:33:49 +0800 Received: from [10.174.179.234] (10.174.179.234) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 26 Aug 2022 14:33:48 +0800 Message-ID: <3541c980-7fcf-7047-cec7-3c2ca6381a99@huawei.com> Date: Fri, 26 Aug 2022 14:33:47 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH -next v2 1/2] riscv: uaccess: rename __get/put_user_nocheck to __get/put_mem_nocheck To: Andrew Jones CC: Paul Walmsley , Palmer Dabbelt , Palmer Dabbelt , Albert Ou , , , , , Guohanjun References: <20220815032025.2685516-1-tongtiangen@huawei.com> <20220815032025.2685516-2-tongtiangen@huawei.com> <20220825105600.ezueddmwehob42rf@kamzik> From: Tong Tiangen In-Reply-To: <20220825105600.ezueddmwehob42rf@kamzik> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.234] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 在 2022/8/25 18:56, Andrew Jones 写道: > On Mon, Aug 15, 2022 at 03:20:24AM +0000, Tong Tiangen wrote: >> Current, The helpers __get/put_user_nocheck() is used by get/put_user() and >> __get/put_kernel_nofault(), which is not always uaccess, so the name with >> *user* is not appropriate. >> >> Also rename xxx_user_xxx to xxx_mem_xx on the call path of >> __get/put_user_nocheck() >> >> Only refactor code without any functional changes. >> >> Signed-off-by: Tong Tiangen >> --- >> arch/riscv/include/asm/uaccess.h | 48 ++++++++++++++++---------------- >> 1 file changed, 24 insertions(+), 24 deletions(-) >> >> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h >> index 855450bed9f5..1370da055b44 100644 >> --- a/arch/riscv/include/asm/uaccess.h >> +++ b/arch/riscv/include/asm/uaccess.h >> @@ -50,7 +50,7 @@ >> * call. >> */ >> >> -#define __get_user_asm(insn, x, ptr, err) \ >> +#define __get_mem_asm(insn, x, ptr, err) \ >> do { \ >> __typeof__(x) __x; \ >> __asm__ __volatile__ ( \ >> @@ -64,12 +64,12 @@ do { \ >> } while (0) >> >> #ifdef CONFIG_64BIT >> -#define __get_user_8(x, ptr, err) \ >> - __get_user_asm("ld", x, ptr, err) >> +#define __get_mem_8(x, ptr, err) \ >> + __get_mem_asm("ld", x, ptr, err) >> #else /* !CONFIG_64BIT */ >> -#define __get_user_8(x, ptr, err) \ >> +#define __get_mem_8(x, ptr, err) \ >> do { \ >> - u32 __user *__ptr = (u32 __user *)(ptr); \ >> + u32 *__ptr = (u32 *)(ptr); \ > > Doesn't casting away __user reduce sparse's utility? From the call logic[1], the address passed into this macro is not necessarily __user. I understand that no problem will be introduced for sparse's utility. In addition, there is no need to do a pointer conversion here, will be fixed next version. [1] __get_kernel_nofault -> __get_mem_nocheck -> __get_mem_8 > >> u32 __lo, __hi; \ >> __asm__ __volatile__ ( \ >> "1:\n" \ >> @@ -88,20 +88,20 @@ do { \ >> } while (0) >> #endif /* CONFIG_64BIT */ >> >> -#define __get_user_nocheck(x, __gu_ptr, __gu_err) \ >> +#define __get_mem_nocheck(x, __gu_ptr, __gu_err) \ > > The patch replaces all get/put_user instances with get/put_mem, > but what about 'gu' and 'pu' instances (which are presumably short > for get/put_user)? ok, missing that, It is not appropriate to use __gu_xxx,will be fixed next version. Thanks, Tong. > > Thanks, > drew > .