From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73673C6FA8B for ; Fri, 23 Sep 2022 15:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232477AbiIWPVa (ORCPT ); Fri, 23 Sep 2022 11:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231601AbiIWPVD (ORCPT ); Fri, 23 Sep 2022 11:21:03 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53E2D13F705 for ; Fri, 23 Sep 2022 08:20:59 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id a2so806383lfb.6 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=eitwcpFoUZ+DvBwS4Br/fZVVImOAxhp7FMltS5p5IWK4heRiOhnnAtCdi9H4l0t1p3 6LeH+EDtCHYkwrdQrlWIBlDk5wdYD93yBB4YNGlb/LxUJz+hAacrqh/FzT2nM4wehmrA HtDVFkMbFy5cw+wxyzBwUFZADpMj6E38Q7BcUMm5oHOpgLy1lrlxNEKcvsSGFPhb9CeU pWYv4LWa6o1KFr0vNA4evCCNm5BEgqqiP9ve3AyJNwLIsmFQ9xaI307l4oICuhi7XLUD h2PYtc6zhNJRc6U6MG79xtTjczb/GLnW/6IFe5bRHSymSCu7k4Ka5/XOXc0cL1SuLmfR +vmg== X-Gm-Message-State: ACrzQf2gy21SD6roK7mESaJK+SpnTMOfthndtX83tyNTBWVwPNmH8iLZ 8VitXH2dloKg92lO8U2a4W1J8d1TD6j73URXKhidJw== X-Google-Smtp-Source: AMsMyM7tQgOI6niyU5IXyfNHgsog0iDYl0WXgb5yVh7a8oMMnxo4TbbSeRkhbm4RLcMIb8opCLgiEX29WHKjDwAENJs= 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" Precedence: bulk List-ID: X-Mailing-List: kvm@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