Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1126103rwb; Fri, 23 Sep 2022 08:30:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nudsCJ3J5sSDK05BZ8ydEc9OGv9/5sI+uYIV+yAVqDS7ZuBZKTNluOkvjD7mBZkDPaDOI X-Received: by 2002:a17:907:724e:b0:780:45d1:969b with SMTP id ds14-20020a170907724e00b0078045d1969bmr7897502ejc.26.1663947053653; Fri, 23 Sep 2022 08:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663947053; cv=none; d=google.com; s=arc-20160816; b=QEH7VJkZZp6cLJ3iemFmW2mFODUBtgpTAQtonLkVXwaiAENrr1fuXF9EefxKHzcCvw sM/+dj8AuUlnz0a4mDt90kqSEpkxFHrDqi70OX9gBvZHnUsDAhlaNpL8bQtTRxeOOm/A wLzFrppmUz7Z7etXPcC1UHsjMbH0loXoe3x4XcUPD2iSUfChyVZ9OwxS4Lcs/KSdPY56 o/Znu4FwLxA79iNZgiEdT0NAhiUQuHiZHVM3DC1FmvRAVttVAJqErKnledXnq96J12o9 +d9NphbumMlSKhBO43TxEZtP7DBcxOfoX5gdI08YnMqraDWZEgABQqScqT6PdoneoWb/ Tt0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=buJ2Vw0w3M4WrtI5/DU3oXsQobrkkmx9rFyElDeN7mE=; b=wfzlu8ltw/Bt1SLiF3jyPhtVBCMkRbYA6D+Te/CbZZEmxo6hE+07dcw8cLU+5XKpMX A/CjniaGzUTeUb9zG7+v5xi0qUPqSWf9+x+MpMUBfaCgW6eFohLkC4cNtSfserg+dbzY efdulupYGdGHjzidKjoWXuevmiRpXzmbASPP2kLJhpVq9MJChhF3a3yOaNHxwfg3Bcei B2S6r9eyfp1VjtgulrKql02H3Fwj+dm1DuVJ4NAq2wTPZGp2K7sx12BxWlzbGqbvUwnt Hn8Nb4vtFt3m6xlvRd4gBWSUUNMBZvLZYSGokOEGniHN33r8kBurv1p50TeVFa/KuXxJ Xgag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=e4OQSAjF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a0564021f0100b0045597e79c24si2477265edb.514.2022.09.23.08.30.27; Fri, 23 Sep 2022 08:30:53 -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=@google.com header.s=20210112 header.b=e4OQSAjF; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232585AbiIWPV3 (ORCPT + 99 others); Fri, 23 Sep 2022 11:21:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232562AbiIWPVC (ORCPT ); Fri, 23 Sep 2022 11:21:02 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B30BB5A73 for ; Fri, 23 Sep 2022 08:20:59 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id k10so817653lfm.4 for ; Fri, 23 Sep 2022 08:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=buJ2Vw0w3M4WrtI5/DU3oXsQobrkkmx9rFyElDeN7mE=; b=e4OQSAjFu3gpxUO4Unn7HPTzW4khEaeLVPKzk0HjIO1WzfoYTIkCo/F1RYrvwR66SF JwCMt5XxADhIKzoYXxMVuOAC/AuI4zxQZgSxUcFBjf8hrr2yXlfmAMcitgt6vZxhWH7Z +VIcwj2/Ns3wteLBkCd1UIvA6lB5eXh/e73AYfVmUkfoy7XbWsS6Q2HYL5D+SrhsOsPZ qOl0jP48UI31PUrNDZzwE9j3uXZ/4o/lWYfvXhojlsVXKd3GrscU+YcreZEHR9zMjYjf xc0uDmUYT7UwO9Q1pGoCLduSZHAasvlCEIMiRTg83bldOSofpAYj2YT99ZO5jc8hyvkT Y9Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=buJ2Vw0w3M4WrtI5/DU3oXsQobrkkmx9rFyElDeN7mE=; b=CdXlBwxQvfBAasSO4O6pkOJqGdEDZJDZYhBQHlEeiREAhd2/+eVGBHQOEoe0GTo+m5 dc/0raj849NYiPVeRPhXb+SJATUVQr41CdddWqp24W+17JjchNpLjpWO2N535BHb6vf0 JFmxLLbxVh4P6wqjKwKEEXS6OxsJJTgQR+c1VHIJzjle5IoVj5EP32+MnFzRQXdRdoeg tLsk6AmrhN4p5bRO0USPMEe7ENSkf/FaIT1YO1+8Z+cJoDNT4oYRHDtPRXrnZ09uggRx 3HI20GOIHE//632nqsjtLu8kfobqTjQpiQ74I86NTSVShVAJ7xt/QzrYl/w/NPm5cIQj 3RQQ== X-Gm-Message-State: ACrzQf2PLlmcTuVOJG95FxC4Pzms+MVks30mtOZ8Bj1P1HPcitkUH2Nl pzmZiFkQda5FtzJ6zp6JfZwl8dkCw5z9LIjjw1mdqw== X-Received: by 2002:a05:6512:b85:b0:499:202a:bde9 with SMTP id b5-20020a0565120b8500b00499202abde9mr3630798lfv.550.1663946457534; Fri, 23 Sep 2022 08:20:57 -0700 (PDT) MIME-Version: 1.0 References: <20220915142913.2213336-1-chao.p.peng@linux.intel.com> <20220915142913.2213336-2-chao.p.peng@linux.intel.com> <20220923005319.wkzpl36uailh4zbw@box.shutemov.name> In-Reply-To: <20220923005319.wkzpl36uailh4zbw@box.shutemov.name> From: Fuad Tabba Date: Fri, 23 Sep 2022 16:20:21 +0100 Message-ID: Subject: Re: [PATCH v8 1/8] mm/memfd: Introduce userspace inaccessible memfd To: "Kirill A . Shutemov" Cc: Sean Christopherson , "Wang, Wei W" , Chao Peng , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "linux-fsdevel@vger.kernel.org" , "linux-api@vger.kernel.org" , "linux-doc@vger.kernel.org" , "qemu-devel@nongnu.org" , Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "x86@kernel.org" , "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Lutomirski, Andy" , "Nakajima, Jun" , "Hansen, Dave" , "ak@linux.intel.com" , "david@redhat.com" , "aarcange@redhat.com" , "ddutile@redhat.com" , "dhildenb@redhat.com" , Quentin Perret , Michael Roth , "Hocko, Michal" , Muchun Song Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Hi, On Fri, Sep 23, 2022 at 1:53 AM Kirill A . Shutemov wrote: > > On Thu, Sep 22, 2022 at 07:49:18PM +0000, Sean Christopherson wrote: > > On Thu, Sep 22, 2022, Wang, Wei W wrote: > > > On Thursday, September 15, 2022 10:29 PM, Chao Peng wrote: > > > > +int inaccessible_get_pfn(struct file *file, pgoff_t offset, pfn_t *pfn, > > > > + int *order) > > > > > > Better to remove "order" from this interface? > > > > Hard 'no'. > > > > > Some callers only need to get pfn, and no need to bother with > > > defining and inputting something unused. For callers who need the "order", > > > can easily get it via thp_order(pfn_to_page(pfn)) on their own. > > > > That requires (a) assuming the pfn is backed by struct page, and (b) assuming the > > struct page is a transparent huge page. That might be true for the current > > implementation, but it most certainly will not always be true. > > > > KVM originally did things like this, where there was dedicated code for THP vs. > > HugeTLB, and it was a mess. The goal here is very much to avoid repeating those > > mistakes. Have the backing store _tell_ KVM how big the mapping is, don't force > > KVM to rediscover the info on its own. > > I guess we can allow order pointer to be NULL to cover caller that don't > need to know the order. Is it useful? I think that would be useful. In pKVM we don't need to know the order, and I had to use a dummy variable when porting V7. Cheers, /fuad > -- > Kiryl Shutsemau / Kirill A. Shutemov