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 EC6FFD6B6DA for ; Wed, 30 Oct 2024 22:18:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 861686B0096; Wed, 30 Oct 2024 18:18:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E9BD6B009B; Wed, 30 Oct 2024 18:18:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63D416B009C; Wed, 30 Oct 2024 18:18:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 42D836B0096 for ; Wed, 30 Oct 2024 18:18:40 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EA97012113A for ; Wed, 30 Oct 2024 22:18:39 +0000 (UTC) X-FDA: 82731682824.19.45FB64E Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by imf19.hostedemail.com (Postfix) with ESMTP id 398FF1A000F for ; Wed, 30 Oct 2024 22:18:05 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="xocWCaI/"; spf=pass (imf19.hostedemail.com: domain of fvdl@google.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=fvdl@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=1730326636; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ATUKPegUcqo8YgRnCQbayM11NO//DrT2d618hoaV2QI=; b=68Nu/uZ+AZF0UfgMv0zVrDwdEiOcS1oYqGEZgCx7KYzTzQR6uNjhlCop+se0htP+/yVUKu 13CAWQXix1NwCKeWO4APrmzLaKekgANFwmH8Qz3SYeld9+RH0o4vjXeR/MuG6dKTOt1H4y 0m4R5S3oiIKqtCuflkBCm5nJpQh/MW8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730326636; a=rsa-sha256; cv=none; b=v/apu6NXQOMHSXLbsRJRcHM7WNoc1qoi9S6NX+6s872VbAoX9bPJrpsJoU5flCfprhRBuG 5WNTj25ZtA4ASwhDPosyHAJ9hGGoU0FisR1cGzHVGXb44E3jF6E2VSGLctsfpxvlTmjPTX Bjr/WIxSxpPTRLvtWdJ4R7nIbA3To4U= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="xocWCaI/"; spf=pass (imf19.hostedemail.com: domain of fvdl@google.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=fvdl@google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4315ee633dcso45425e9.1 for ; Wed, 30 Oct 2024 15:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730326717; x=1730931517; darn=kvack.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=ATUKPegUcqo8YgRnCQbayM11NO//DrT2d618hoaV2QI=; b=xocWCaI/h/Sin3Ek878kJUsK0BmEaKqvI5k+25j7GpLucteY1yoOW68OXYj3b071SM sP3mW3MqwC12np9FZciYj6L8CY+g7ol0oP6xzuP5x5GGFzOQwQYVOLbo0NWtGWahN8Kl 44TFTVt7Lnh9uYxUfhMLDyWJXuJ1YL3ErBdNWdS5I1JMKPCbmTuP2/dkjUNtYOmDai8Y 0ClMbWrN2/0fRx4c97x0m3EWl3Y3DvGJysWiscZhaSCzUIcZQ3xrzuQB58R/SA/X9lv6 zM12BtccD0wVmOcBza6wxB8Fp1yVVPF1DJBzuIb7kwPLu2YfQXdbQZKJ9WU8Tzkqj0wT x3Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730326717; x=1730931517; 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=ATUKPegUcqo8YgRnCQbayM11NO//DrT2d618hoaV2QI=; b=Rjca+V0y6EiOkEXi66tbeiXjdktULg/xAbfjgwT6REMCFwoyDJ0y+fM/N2LQSUXBUs MiiQ64ivBSGjutmuXGNN09C73OK6HinwTRBQaV7Vgfa5VaJ2dP3ryDnSGNQ23OSBdw5F T0HnusHEl7xXkzXVRWE+sy08hFizLHAAcxKzZ0VhjjIajwPtrYf88nw6f99J9qsJAgz9 JV21Nj1BpSo/ndtYjGuyaRxdxofp4evxvY6LlwANF7oistBbeMSXXvJqTQn5KYOOc338 Mm1Ia6cb9gJdRqqf9cpksKomJPcu6Q91jBBsYpBWYOYOp+I8rF40DMw2XnxNl/LS75R1 8L9g== X-Forwarded-Encrypted: i=1; AJvYcCV38hG5K2p9RE3Z349dGyYFTzuKJRCihv6+iSzczFTdyrLrvacUkJ8iiGJ+rlv2SQxh1si/jkELeg==@kvack.org X-Gm-Message-State: AOJu0YzHXpbJmBIfPJMo4egFH+hu1tZwR7s3k+8haOQK3fV/HQKWsmhT WmlLVxiVgZ4mFdSHK4V4mv1Y1vWcEJB+Fhp9F3XhtPS9m6SvNuyFrmxpl36JPj4hTkpAPS3BCWI 92G+uZXm1rD11bhYAdSJDh29J21JFNEhb5/wq X-Gm-Gg: ASbGncuuTXZeFQfwz/Q+yN1bGZG9pgRLYduU2VHE0xXTNu23xhqc80i4xu/Icnab4kv uWVqTbPXnIZVGd6Xh6akXSOdOKD9T X-Google-Smtp-Source: AGHT+IGgBxG9itQN01XAI+q7Fq91bG06PVTigFgOg09wvSOuCtpqcUewGTf7vCbKMXJrOM8i9YvEy2dObrXwLiwtf/4= X-Received: by 2002:a05:600c:3acc:b0:426:66a0:6df6 with SMTP id 5b1f17b1804b1-4327bd7e197mr1792485e9.0.1730326716591; Wed, 30 Oct 2024 15:18:36 -0700 (PDT) MIME-Version: 1.0 References: <20240805093245.889357-1-jgowans@amazon.com> <20240805093245.889357-6-jgowans@amazon.com> <20241029120232032-0700.eberman@hu-eberman-lv.qualcomm.com> In-Reply-To: <20241029120232032-0700.eberman@hu-eberman-lv.qualcomm.com> From: Frank van der Linden Date: Wed, 30 Oct 2024 15:18:25 -0700 Message-ID: Subject: Re: [PATCH 05/10] guestmemfs: add file mmap callback To: Elliot Berman Cc: James Gowans , linux-kernel@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Alexander Viro , Steve Sistare , Christian Brauner , Jan Kara , Anthony Yznaga , Mike Rapoport , Andrew Morton , linux-mm@kvack.org, Jason Gunthorpe , linux-fsdevel@vger.kernel.org, Usama Arif , kvm@vger.kernel.org, Alexander Graf , David Woodhouse , Paul Durrant , Nicolas Saenz Julienne Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam10 X-Stat-Signature: y4u3utso45iomad7gz5wyorgfsmrtbb9 X-Rspamd-Queue-Id: 398FF1A000F X-Rspam-User: X-HE-Tag: 1730326685-712180 X-HE-Meta: U2FsdGVkX1/td12oWU9G3RE4fEYo8YYKQlTYUXs16+2mYydiVoEmsCk3Qe+3YYhVEhiH22DdEGuh4FBZ9GYJjpazL3U9/ZPn/y6XJ3OoQ9luFy9S++AoUrdWfQ5Kwz1Ey5qmTka2jCCSBDRRWSluELjA8msHeBsvYJfWibjQrc9C7Kve6Pda0FzcRXT0MDB71oiInS74IxE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1BSan/xG7J83XuleUoUcQ7bP4= 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: List-Subscribe: List-Unsubscribe: On Tue, Oct 29, 2024 at 4:06=E2=80=AFPM Elliot Berman wrote: > > On Mon, Aug 05, 2024 at 11:32:40AM +0200, James Gowans wrote: > > Make the file data usable to userspace by adding mmap. That's all that > > QEMU needs for guest RAM, so that's all be bother implementing for now. > > > > When mmaping the file the VMA is marked as PFNMAP to indicate that ther= e > > are no struct pages for the memory in this VMA. Remap_pfn_range() is > > used to actually populate the page tables. All PTEs are pre-faulted int= o > > the pgtables at mmap time so that the pgtables are usable when this > > virtual address range is given to VFIO's MAP_DMA. > > Thanks for sending this out! I'm going through the series with the > intention to see how it might fit within the existing guest_memfd work > for pKVM/CoCo/Gunyah. > > It might've been mentioned in the MM alignment session -- you might be > interested to join the guest_memfd bi-weekly call to see how we are > overlapping [1]. > > [1]: https://lore.kernel.org/kvm/ae794891-fe69-411a-b82e-6963b594a62a@red= hat.com/T/ > > --- > > Was the decision to pre-fault everything because it was convenient to do > or otherwise intentionally different from hugetlb? > It's memory that is placed outside of of page allocator control, or even outside of System RAM - VM_PFNMAP only. So you don't have much of a choice.. In general, for things like guest memory or persistent memory, even if struct pages were available, it doesn't seem all that useful to adhere to the !MAP_POPULATE standard, why go through any faults to begin with? For guest_memfd: as I understand it, it's folio-based. And this is VM_PFNMAP memory without struct pages / folios. So the main task there is probably to teach guest_memfd about VM_PFNMAP memory. That would be great, since it then ties in guest_memfd with external guest memory. - Frank