From: Michael Roth <michael.roth@amd.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: <linux-kernel@vger.kernel.org>, <kvm@vger.kernel.org>,
<seanjc@google.com>
Subject: Re: [PATCH v2 14/14] KVM: guest_memfd: abstract how prepared folios are recorded
Date: Mon, 29 Jul 2024 16:59:54 -0500 [thread overview]
Message-ID: <20240729215954.fpnh4wr7jq4doblx@amd.com> (raw)
In-Reply-To: <20240726185157.72821-15-pbonzini@redhat.com>
On Fri, Jul 26, 2024 at 02:51:57PM -0400, Paolo Bonzini wrote:
> Right now, large folios are not supported in guest_memfd, and therefore the order
> used by kvm_gmem_populate() is always 0. In this scenario, using the up-to-date
> bit to track prepared-ness is nice and easy because we have one bit available
> per page.
>
> In the future, however, we might have large pages that are partially populated;
> for example, in the case of SEV-SNP, if a large page has both shared and private
> areas inside, it is necessary to populate it at a granularity that is smaller
> than that of the guest_memfd's backing store. In that case we will have
> to track preparedness at a 4K level, probably as a bitmap.
>
> In preparation for that, do not use explicitly folio_test_uptodate() and
> folio_mark_uptodate(). Return the state of the page directly from
> __kvm_gmem_get_pfn(), so that it is expected to apply to 2^N pages
> with N=*max_order. The function to mark a range as prepared for now
> takes just a folio, but is expected to take also an index and order
> (or something like that) when large pages are introduced.
>
> Thanks to Michael Roth for pointing out the issue with large pages.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael Roth <michael.roth@amd.com>
next prev parent reply other threads:[~2024-07-29 22:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 18:51 [PATCH v2 00/14] KVM: guest_memfd: lazy preparation of pages + prefault support for SEV-SNP Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 01/14] KVM: x86: disallow pre-fault for SNP VMs before initialization Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 02/14] KVM: guest_memfd: return folio from __kvm_gmem_get_pfn() Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 03/14] KVM: guest_memfd: delay folio_mark_uptodate() until after successful preparation Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 04/14] KVM: guest_memfd: do not go through struct page Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 05/14] KVM: rename CONFIG_HAVE_KVM_GMEM_* to CONFIG_HAVE_KVM_ARCH_GMEM_* Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 06/14] KVM: guest_memfd: return locked folio from __kvm_gmem_get_pfn Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 07/14] KVM: guest_memfd: delay kvm_gmem_prepare_folio() until the memory is passed to the guest Paolo Bonzini
2024-07-29 21:40 ` Michael Roth
2024-07-26 18:51 ` [PATCH v2 08/14] KVM: guest_memfd: make kvm_gmem_prepare_folio() operate on a single struct kvm Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 09/14] KVM: remove kvm_arch_gmem_prepare_needed() Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 10/14] KVM: guest_memfd: move check for already-populated page to common code Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 11/14] KVM: cleanup and add shortcuts to kvm_range_has_memory_attributes() Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 12/14] KVM: extend kvm_range_has_memory_attributes() to check subset of attributes Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 13/14] KVM: guest_memfd: let kvm_gmem_populate() operate only on private gfns Paolo Bonzini
2024-07-26 18:51 ` [PATCH v2 14/14] KVM: guest_memfd: abstract how prepared folios are recorded Paolo Bonzini
2024-07-29 21:59 ` Michael Roth [this message]
2024-07-29 22:06 ` [PATCH v2 00/14] KVM: guest_memfd: lazy preparation of pages + prefault support for SEV-SNP Michael Roth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240729215954.fpnh4wr7jq4doblx@amd.com \
--to=michael.roth@amd.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®