Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp33869rwb; Fri, 19 Aug 2022 16:15:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR7NyHI1+ssyLaRy7PjPqtwVQDTJUSetZwjx48Iqq4H1bu4h7xF+hGIfUge15Ndu5BujYEJh X-Received: by 2002:a05:6402:2756:b0:443:4a6d:f05a with SMTP id z22-20020a056402275600b004434a6df05amr7820542edd.396.1660950956967; Fri, 19 Aug 2022 16:15:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660950956; cv=none; d=google.com; s=arc-20160816; b=KqsyFvnU/xwk1f+iFDdEqFCAm38PH6s89aEZtvwhUAI8fvUP5SR0qceYknaItaL/eG JmbkebQlpZANH4/tgZeV/q/vyNwfrr9Igf+7wrHK4oQItIJCKnpKHigbeaFy7uE0e2Jt bdyZi7K0QWC08n2G9KDdFuWsL3C2HuucVloL8tpMv4KvRBwztmNY44m+NElLBozQnPdd r9h0J+DI+FOU2E4FDNosWpn8IDcW0S9co/6Xq0E7s8ZFKoZ6O8kmDTYi3IG4zQHxlVG0 k6SY1SCbtDi7At+W4SVYl2YCuzCAoyCTOwakGOAPEyx2djM8Qwcs51SBfmLz1/DWxKq5 X4eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bxsKzsoodl9uJzFJZZrQwWPMoj9Im81AmgcsZB9Gfmw=; b=NOiT6btTMELEkof09l1ZAZZkwx/andCs3NsKQXA/soSluqih0MGLp9EKYXkZa2Vwzb HPLjYAWk5uDqA0CExu9TVdvEYY2RikQ7vXCx4DQVmiK4V18b+2VnhdDpkA+Jr9rPoyhs /a0YWrVmxycp16HGGI+xXLn0wX0/jw4P57mE6lNvHogE3ZkKVAXDmX/figYWpFbqrOjz 0ecvUUAtNX7gTDc2TDI7PAl6B0fJqwhp4WBy4YmyjJy4fyPKy3g7fTrRc6XolK0JcV0z OVewxpOsGHi43OYeNoardyIGpCF8gpF83WBz82ncNW9gTbWbGJVjdv0LWrhzuOELAk7L H1fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="qt/sbuA4"; 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 f13-20020a50a6cd000000b0043c158735basi3679718edc.467.2022.08.19.16.15.31; Fri, 19 Aug 2022 16:15:56 -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="qt/sbuA4"; 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 S243185AbiHSWxL (ORCPT + 99 others); Fri, 19 Aug 2022 18:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243127AbiHSWxJ (ORCPT ); Fri, 19 Aug 2022 18:53:09 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 981BA10E78F for ; Fri, 19 Aug 2022 15:53:07 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id 20so5247504plo.10 for ; Fri, 19 Aug 2022 15:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=bxsKzsoodl9uJzFJZZrQwWPMoj9Im81AmgcsZB9Gfmw=; b=qt/sbuA4OKmJaHmOuxnwa2lGGy6KF/9YxtJ8CEBc62ECZi8/Xq0wY0tron+FkYYdUs X9/M4egtRP0lG6q4e8/IWltnCwwAIXqgqPcmV59AnmXMmxflSpitxJaAXuVmi8jeOb7u ZYWkCe4cfUOnwv+GJ6FAghcaXtVFWtU/VjFn+HZAKAe7LVuzmplI1YXQYgelBcp8xph3 XxuS2HQx3IoH2+jqfCiCLhnkIeS5J/e3C/uJb7oa4kLmq1AEXHLKDQEqspeDUi54j69u rkCsWutnedC/95sn0+Cf9uinQ+8ih+35v91Myr1oidh4MK/5DNYfVzYMeF+QXp50vSUG yQZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=bxsKzsoodl9uJzFJZZrQwWPMoj9Im81AmgcsZB9Gfmw=; b=Rq0DinPd73QuutoWkIfOjdbO0eeXZod/btrlSP4i9EvlI2jPholHsqPh1m6crSQF82 6tC9zf9O9H++sB0Zq53oWJ5OofHKP9cl32D8w3Gw9lnhnR2a176uVWj1wKsNX+ubuz5y yTsHieLKDkUmam4tp8F/TzpyPL/T4JVP+dCdmTdvpPBOpKdxCAAOTMTumw32qvMNcvRv nqNlpD4fWqRm5NO9ouOvnEGHHgvwk67k5prLFUQcdeCmv5L5xeRtdEhm0VfL/6Wpeldw hvyhNLp/8LOaVySMuRwuenNT/uh5lSCFu7IwzBvkpqe8XPmdFzJNVztDHyVs49kpa9Qk 08Xw== X-Gm-Message-State: ACgBeo3UOse722OOJykq0Uz2iRkD7gL6wvXby+cWbF0GmY3nc7CRwcu2 f6LKE1DQh5MJFbQU/gUEU2twcA== X-Received: by 2002:a17:90b:1b4a:b0:1f5:5578:6398 with SMTP id nv10-20020a17090b1b4a00b001f555786398mr10621956pjb.122.1660949586764; Fri, 19 Aug 2022 15:53:06 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id h2-20020a63c002000000b0040cb1f55391sm3280975pgg.2.2022.08.19.15.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 15:53:06 -0700 (PDT) Date: Fri, 19 Aug 2022 22:53:02 +0000 From: Sean Christopherson To: Hugh Dickins Cc: "Kirill A . Shutemov" , 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, linux-kselftest@vger.kernel.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" , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , Michael Roth , mhocko@suse.com, Muchun Song , "Gupta, Pankaj" Subject: Re: [PATCH v7 00/14] KVM: mm: fd-based approach for supporting KVM guest private memory Message-ID: References: <20220706082016.2603916-1-chao.p.peng@linux.intel.com> <20220818132421.6xmjqduempmxnnu2@box> <226ab26d-9aa8-dce2-c7f0-9e3f5b65b63@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <226ab26d-9aa8-dce2-c7f0-9e3f5b65b63@google.com> X-Spam-Status: No, score=-14.4 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,FSL_HELO_FAKE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=no 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 Thu, Aug 18, 2022, Hugh Dickins wrote: > On Fri, 19 Aug 2022, Sean Christopherson wrote: > > On Thu, Aug 18, 2022, Kirill A . Shutemov wrote: > > > On Wed, Aug 17, 2022 at 10:40:12PM -0700, Hugh Dickins wrote: > > > > If your memory could be migrated, that would be some reason to use > > > > filesystem page cache (because page migration happens to understand > > > > that type of memory): but it cannot be migrated. > > > > > > Migration support is in pipeline. It is part of TDX 1.5 [1]. > > > > And this isn't intended for just TDX (or SNP, or pKVM). We're not _that_ far off > > from being able to use UPM for "regular" VMs as a way to provide defense-in-depth > > UPM? That's an acronym from your side of the fence, I spy references to > it in the mail threads, but haven't tracked down a definition. I'll > just take it to mean the fd-based memory we're discussing. Ya, sorry, UPM is what we came up with as shorthand for "Unmapping guest Private Memory". Your assumption is spot on, it's just a fancy way of saying "guest is backed with inaccessible fd-based memory". > > without having to take on the overhead of confidential VMs. At that point, > > migration and probably even swap are on the table. > > Good, the more "flexible" that memory is, the better for competing users > of memory. But an fd supplied by KVM gives you freedom to change to a > better implementation of allocation underneath, whenever it suits you. > Maybe shmem beneath is good from the start, maybe not. The main flaw with KVM providing the fd is that it forces KVM to get into the memory management business, which us KVM folks really, really do not want to do. And based on the types of bugs KVM has had in the past related to memory management, it's a safe bet to say the mm folks don't want us getting involved either :-) The combination of gup()/follow_pte() and mmu_notifiers has worked very well. KVM gets a set of (relatively) simple rules to follow and doesn't have to be taught new things every time a new backing type comes along. And from the other side, KVM has very rarely had to go poke into other subsystems' code to support exposing a new type of memory to guests. What we're trying to do with UPM/fd-based memory is establish a similar contract between mm and KVM, but without requiring mm to also map memory into host userspace. The only way having KVM provide the fd works out in the long run is if KVM is the only subsystem that ever wants to make use of memory that isn't accessible from userspace and isn't tied to a specific backing type, _and_ if the set of backing types that KVM ever supports is kept to an absolute minimum.