Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp558054rdb; Tue, 31 Oct 2023 15:40:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9QmYNVbqQ6bneuD1sSUSkdXnEJkyRCz88YPKk1aAHdUba2E9wu4fN66u1g8ngQ8SJybDX X-Received: by 2002:a17:903:32c2:b0:1cc:4985:fbf8 with SMTP id i2-20020a17090332c200b001cc4985fbf8mr7787300plr.59.1698792026578; Tue, 31 Oct 2023 15:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698792026; cv=none; d=google.com; s=arc-20160816; b=t0AVWOQa+9/b7LIlbszo6sv6UpOTuihsW9FZ+PpaNeE87N8LkG0/MhHpVlsWNbsbcB 7/qofbrAV3CwUsqofIVmGeFx7nIWeDLbx6Fb0MCA/IMV8wC8G1aK/yJy8YdACcOfDpUN wIMpOBINLiCisSvJOEYicHJwffS3zGXjTllKKCCNJJ/+xqT7HGxLWOLFBMPoQ2ZxbwoO YA07P6jhblb8OwTU2sGTrpWm6hH6z/tuIPUjqpa1++jRyoAPrv6S61xjQqDQoMi8gVqT eJsIjDFAQXEzbyoBT/5J8COS6umD74aZQJSfaXY6OpphFYYriXWZutDvYJYu58BhLgUO xcBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dJWbuo+9TPVToDVPf96jeRxWUliwPBKXtZxQViTwJnU=; fh=qdyjXyB1NmbWuUvP2GQHevOARl2q6dCcNPNdvYweWg0=; b=olPSFRlIf6rD4TsMwo+SBrzTYvFDzDyehG9pOBCq9TUMTxHyo8x6fRWVd4RDi8DbMH Ugod/lU71gdoAovOJ6ASonFaa6FAQFVfVuklpotaYLWdgvITqt2gBEyDs4rsWTeBTOS2 k6JaEVaHuXj6TA+OXuLIOvl8jlYFVmtRYkQ1+UJRo4ZKUt2N7chTtoGkw9vODIqbGwcK 74JwEGvJcK34SLf8ikVqsyuMWVQXA1k2HGxjVSot3o+LaAtLOrhw9aMJsrqszHGSAozj 4gsMcN0Key/ToAXHMXQQUp9ssdyd5c0KzkWrUuOun2zCRc+S95bYxZk4GRPjPyc5sYxU YPSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="1K8ZS/bJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e10-20020a17090301ca00b001c6069b659csi1748016plh.384.2023.10.31.15.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 15:40:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="1K8ZS/bJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1CE7C802CD27; Tue, 31 Oct 2023 15:40:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232160AbjJaWkS (ORCPT + 99 others); Tue, 31 Oct 2023 18:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231910AbjJaWkR (ORCPT ); Tue, 31 Oct 2023 18:40:17 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EDE8F5 for ; Tue, 31 Oct 2023 15:40:14 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-32f7c44f6a7so2318563f8f.1 for ; Tue, 31 Oct 2023 15:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698792013; x=1699396813; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dJWbuo+9TPVToDVPf96jeRxWUliwPBKXtZxQViTwJnU=; b=1K8ZS/bJ+GdgqaZUvAP2WwNROh7zVafE6rW0I41BI7g6Cuii9iWqj6tqLetfVQnuij mqrLEsygd5w8lFAbQgvkcROrnJCCEWMldrHP4O25qc38/KI1iGCpM4/wrvLPnGiRRjUy UET+n2k3pAZakVazyzGziZONC7dCPAfAWcn8RnZtvZvjJ74w7BjYg9SOd2E/VCWJsh/Q hjUqjy6DwE0Kw7wq3scIRWXIYCWNSNlnBFHdqI4GR7b6c9oH1dXwTcZ3eALS/mu/CWM4 6h7c+KWgRKLbE/7nXwFViCsz1g/egULjDKcBBbXrfllPtyavfMqnz40g0XlTC3tuQAJS fXUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698792013; x=1699396813; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dJWbuo+9TPVToDVPf96jeRxWUliwPBKXtZxQViTwJnU=; b=Pta8CijAac8Al9iBAY9PDP00/zPhPM/z6WEhTf23NFU51ydYza9u+aX9doSygaYUA7 ZVb/RKvuNh3RCJymI7optRJ36gWd/xgs0EGAymxi3h25Kx7p7ekF20eNRuv2GzrvYi5W 1Jp6jLGf5ZY3eKvfGzPTlb/aKiIBEqlqHaM+wnhc3Cy4Tsy2wDbJ9rmzI8K5kYQNgcD6 VODVURoJob2GKyS/iRY66YQEND8CM/n1xpNe9xIcfshriHCjOm5tVb3lzw08zivoA4AY B64Q0lszEpGpwcmwsyBQ1FZx1VmlKiploMaN1vxSDR1ufX4RAu+yWyk6zOErs/a9qjs4 77RA== X-Gm-Message-State: AOJu0YyX/WyM5ZjWxLqMQcEXBDvMyUT4u1qclBP+pnM09JzC67IRhw4J c/oy+6SlTCyah1ji0BsUQT6+4pCSTcvt/EZ8Id7Wwg== X-Received: by 2002:adf:d1ef:0:b0:32f:7db1:22fb with SMTP id g15-20020adfd1ef000000b0032f7db122fbmr8716023wrd.28.1698792012937; Tue, 31 Oct 2023 15:40:12 -0700 (PDT) MIME-Version: 1.0 References: <20231027182217.3615211-1-seanjc@google.com> <20231027182217.3615211-17-seanjc@google.com> In-Reply-To: From: David Matlack Date: Tue, 31 Oct 2023 15:39:42 -0700 Message-ID: Subject: Re: [PATCH v13 16/35] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory To: Sean Christopherson Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexander Viro , Christian Brauner , "Matthew Wilcox (Oracle)" , Andrew Morton , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Xiaoyao Li , Xu Yilun , Chao Peng , Fuad Tabba , Jarkko Sakkinen , Anish Moorthy , Yu Zhang , Isaku Yamahata , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 15:40:24 -0700 (PDT) On Tue, Oct 31, 2023 at 2:36=E2=80=AFPM Sean Christopherson wrote: > On Tue, Oct 31, 2023, David Matlack wrote: > > On 2023-10-27 11:21 AM, Sean Christopherson wrote: > > > Introduce an ioctl(), KVM_CREATE_GUEST_MEMFD, to allow creating file-= based > > > memory that is tied to a specific KVM virtual machine and whose prima= ry > > > purpose is to serve guest memory. > > > Maybe can you sketch out how you see this proposal being extensible to > > using guest_memfd for shared mappings? > > For in-place conversions, e.g. pKVM, no additional guest_memfd is needed.= What's > missing there is the ability to (safely) mmap() guest_memfd, e.g. KVM nee= ds to > ensure there are no outstanding references when converting back to privat= e. > > For TDX/SNP, assuming we don't find a performant and robust way to do in-= place > conversions, a second fd+offset pair would be needed. Is there a way to support non-in-place conversions within a single guest_me= mfd?