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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10AD7C6FA82 for ; Fri, 23 Sep 2022 15:21:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A13948000D; Fri, 23 Sep 2022 11:20:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C2EA80007; Fri, 23 Sep 2022 11:20:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88B378000D; Fri, 23 Sep 2022 11:20:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7927080007 for ; Fri, 23 Sep 2022 11:20:59 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5412F120464 for ; Fri, 23 Sep 2022 15:20:59 +0000 (UTC) X-FDA: 79943713038.14.5CFF433 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf05.hostedemail.com (Postfix) with ESMTP id 12C7410000C for ; Fri, 23 Sep 2022 15:20:58 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id f9so829131lfr.3 for ; Fri, 23 Sep 2022 08:20:58 -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=1Yp9Na4D2IzWHeSeP74AFICSbVWF8O1FvlmSF7VFL+A8IZhhdkQgaNOsR59im8AQ8Z VDMAaKx0f0vilh7l4FyUpZdUpvqV6Vk0ObY0vbdiEvbseWR/0AnLRot9agIyoTVImBbP sspRdXCHU5QxsQmjbGmnGY8ioN2gi21VPtKwqzzAgI2vN5wNVSg6YjQBeSJlr9gwhrnh o/R0NLBGAqvN1SRk2pr3GFGaGJVLgDjR/nRAz8fjBpeWbgmi3WwY+q8GKxP2ieTmCMlx XilpET5nl3Q3jZ/TT2NpXVuHOpX7DkeuyEM6gQoCRlc7T4qarVSoqEVMGGNdGZ/7lDiS 7BZQ== X-Gm-Message-State: ACrzQf2Ua7Yqn/wl9mDPlV6daf757u0QRQcvLqTYV3HhBlXIjaIFHVMe zkpYKECvtdBBXDZ4qgO7zT+H7J+gP9zrWzPPMFAfuQ== 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" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663946459; a=rsa-sha256; cv=none; b=x/D6o7LnPGU8OH+fgrStCXSS5Gg441blo/fH/Z2dn/O0+2FKNyqeLmquD4aGZRlvcQJ1UX mpDfhL+foyvmZBNiuykOEihObssy/Us/wDEqyaKzU5ivudPrNyM5tBchnpYlJyJeJ2WbXu QvRhV3D7T6tciDmm0leNzvOFIIU0p1Q= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=e4OQSAjF; spf=pass (imf05.hostedemail.com: domain of tabba@google.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=tabba@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663946459; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=buJ2Vw0w3M4WrtI5/DU3oXsQobrkkmx9rFyElDeN7mE=; b=bHwIAKdbfoaWSCkrFyeaEIH1YD0tdq6T20xiRPqrK/kPW3HrhWclFwE27SA4ZE5WFVpBMh WiMfn4bj+AdDoE1Ih2OCSc883SQJBbdhXgRsY+oI//nStu1qci+jTSshT5K9EDH3U/P0gj I7Kjou2dr7N2LyEFnkS3C6POVBK6fio= X-Stat-Signature: 7pfqq3ega169ucpkqxa54eo3gtnjeu7m X-Rspamd-Queue-Id: 12C7410000C X-Rspam-User: X-Rspamd-Server: rspam11 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=e4OQSAjF; spf=pass (imf05.hostedemail.com: domain of tabba@google.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=tabba@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1663946458-70422 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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