Re: [PATCH v4 15/17] [GMEM-DEPENDENT] KVM: guest_memfd: Add a pre-zap hook .gmem_prezap()

From: Yan Zhao

Date: Wed Oct 14 2026 - 03:08:05 EST


On Mon, Sep 28, 2026 at 05:12:12PM +0800, Yan Zhao wrote:
> From: Sean Christopherson <seanjc@xxxxxxxxxx>
...
> Not-Yet-Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Part of this patch is taken from Sean's patch [1], and another part is split out
from Sean's [2]. I renamed the op name to .gmem_prezap(), defined it as
safe-without-rollback in the op comment, and had it invoked by
__kvm_gmem_set_attributes() after rebasing.
Since I wasn't sure my changes would look good to Sean, I used the Not-Yet tag.

Rick reminded me that using a tag in this way is not appropriate. Since both [1]
and [2] carry Sean's SoB, I'll update the tags and changelog parts to:


Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Co-developed-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
Signed-off-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
Link: https://lore.kernel.org/all/20260129011517.3545883-44-seanjc@xxxxxxxxxx [1]
Link: https://lore.kernel.org/all/aXt_L6QKB9CSTZcW@xxxxxxxxxx [2]
Link: https://lore.kernel.org/all/anLrGmbZwgWnNUkp@xxxxxxxxxxxxxxxxxxxxxxxxx [3]
---
v4:
1. Split the parts of introducing .gmem_convert() and updating
kvm_arch_gmem_convert() from the patch in link [2] and merged them
into patch [1]. (Yan)
2. Renamed .gmem_convert() in [1] to .gmem_prezap() as previously noted in
[3] (Yan)
3. Used attr_filter for private/shared info. (Yan)
4. Added a comment for .gmem_prezap() noting that the hook is allowed to
fail and must be safe without any rollback in the event of an error.
(Yan).
5. Rebased gmem in-place conversion series and invoke .gmem_prezap() in
kvm_gmem_set_attributes(). (Yan)

> [Yan: Renamed to .gmem_prezap(), used attr_filter for private/shared info]
> Signed-off-by: Yan Zhao <yan.y.zhao@xxxxxxxxx>
> ---
> - Rebased to gmem in-place conversion v13.
> - Renamed .gmem_convert() in [1] to .gmem_prezap() as previously noted in
> [2].
> - Added a comment for .gmem_prezap() noting that the hook is allowed to
> fail and must be safe without any rollback in the event of an error.(Yan)
>
> [1] https://lore.kernel.org/all/20260129011517.3545883-44-seanjc@xxxxxxxxxx
> [2] https://lore.kernel.org/all/anLrGmbZwgWnNUkp@xxxxxxxxxxxxxxxxxxxxxxxxx