Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp949533rwd; Tue, 13 Jun 2023 02:38:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7revhdd/7Pl/9kdUhMUdpTAzMXrUEZc3CmxubeJizJRVMHTMxa7jM546vPhttxKsKSozkC X-Received: by 2002:a05:6a00:17a5:b0:63a:ea82:b7b7 with SMTP id s37-20020a056a0017a500b0063aea82b7b7mr15043309pfg.28.1686649106588; Tue, 13 Jun 2023 02:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686649106; cv=none; d=google.com; s=arc-20160816; b=mEyUC0S6HxOo3wSgG3CUo8rfVy4HqXQfSvWof1kQ5EGY2KABbsjqDm17NdoI1HIN3z dBLkoygEJrTk9RAW7SJ1GBROirwt1o79Axlp+68/IBhKIEGjc0bzFZ9nBoQuJd4wItGO rDCx/X3ZmwlwMnGJBWe17oo/8cE2t+FlQw9HFqYb54dFNbuH7v1zR9gOE9Js4g6YTyp/ 8DAzuTZ4OEXV6jaqjRcE8tOu4FFysZViZhJOBAhuR0RUsx5k8mkOdG/BYDw2qfVQ3Mjv jpGncx2WqXp7gtwFz0NfZhkkuSLtQR9eYnR5cR/Qt0w43KtnqVsKL3gKZku8fORilLzP xEYA== 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=XMhPEoAG1cg4aEIKU6iWxH70Dz0V2NbPuW9Y5cmd5w4=; b=yGNNIAUa4lCRUL/+IEGILmaIcMtTsGQwUYlgJ4tQtbByoFbJVx+nVf2Sbt2fVmmuek V0kjA5BZnm9csGxxkNR9PWGgxOFoOuIUc8vBYXqwZ3vLrNfujzV2kH7uYq3TtZz0S6XY NUUWxaGKfWYj7bX5dnbkhXYaPgtFJLts3wT3K+CVWluw+o7SkYBXnELDictwh0YCn9F2 Be6nx70HnUsKg6831zCpzEMnEGTdLQg7a1bnO2QLrrHKsjtOnI0qlxMiHh2g9NG1W7UX PbFXlGoPWkdiuQEUWynHrKHFQYaCDljP+JS9Yeevcgpx3kK+CtBGpJvcQI1FNEpdrQvB Ligg== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a637b4b000000b0053427b6841dsi5117951pgn.337.2023.06.13.02.38.12; Tue, 13 Jun 2023 02:38:26 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239865AbjFMIxU (ORCPT + 99 others); Tue, 13 Jun 2023 04:53:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240629AbjFMIxE (ORCPT ); Tue, 13 Jun 2023 04:53:04 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A43CDD2 for ; Tue, 13 Jun 2023 01:53:02 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4BED11FB; Tue, 13 Jun 2023 01:53:47 -0700 (PDT) Received: from [10.57.74.148] (unknown [10.57.74.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 130BE3F71E; Tue, 13 Jun 2023 01:52:56 -0700 (PDT) Message-ID: Date: Tue, 13 Jun 2023 09:52:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v3 0/3] Encapsulate PTE contents from non-arch code To: Muchun Song Cc: Andrew Morton , SeongJae Park , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Mike Rapoport , Yu Zhao , Jason Gunthorpe , David Airlie , Daniel Vetter , Dimitri Sivanich , Alex Williamson , Oleksandr Tyshchenko , Alexander Viro , Christian Brauner , Mike Kravetz , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Naoya Horiguchi , Miaohe Lin , Pasha Tatashin , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , linux-kernel@vger.kernel.org, Linux Memory Management List , damon@lists.linux.dev References: <20230612151545.3317766-1-ryan.roberts@arm.com> <3ECE40AA-536E-4A2C-82BA-FE74AA6FB689@linux.dev> From: Ryan Roberts In-Reply-To: <3ECE40AA-536E-4A2C-82BA-FE74AA6FB689@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 13/06/2023 03:16, Muchun Song wrote: > > >> On Jun 12, 2023, at 23:15, Ryan Roberts wrote: >> >> Hi All, >> >> (Including wider audience this time since changes touch a fair few subsystems) >> >> This is the second half of v3 of a series to improve the encapsulation of pte >> entries by disallowing non-arch code from directly dereferencing pte_t pointers. >> Based on earlier feedback, I split the series in 2; the first part, fixes for >> existing bugs, was already posted at [3] and merged into mm-stable. This second >> part contains the conversion from direct dereferences to instead use >> ptep_get()/ptep_get_lockless(). >> >> See the v1 cover letter at [1] for rationale for this work. >> >> Based on feedback at v2, I've removed the new ptep_deref() helper I originally >> added, and am now using the existing ptep_get() and ptep_get_lockless() helpers. > > When I first saw the name of ptep_get()/ptep_get_lockless(), I thought > the pte seems like to be protected by the refcount mechanism (Why I have > this though? Because Qi Zheng has proposed a approach to free pte page tables > by using the refcount mechanism [1]). And your proposed name of ptep_deref() > is intuitive for me, so I have another thought, should we rename ptep_get() > to ptep_deref()? Just a thought from me, I'd like to hear if others object. I see your point, but I think any renaming exercise should be discussed and applied in the context of a separate patch series, given that ptep_get() and ptep_get_lockless() already exist in the code base. This would be a much bigger job, since it would need to cover all the arch code too. > > Thanks. > > [1] https://lore.kernel.org/lkml/20211110105428.32458-7-zhengqi.arch@bytedance.com/