Re: [PATCH v3 3/5] KVM: s390: vsie: Fix unshadowing logic

From: Christian Borntraeger

Date: Tue May 19 2026 - 12:22:13 EST




Am 19.05.26 um 17:01 schrieb Claudio Imbrenda:
In some cases (i.e. under extreme memory pressure on the host),
attempting to shadow memory will result in the same memory being
unshadowed, causing a loop.

Add a PGSTE bit to distinguish between shadowed memory and shadowed DAT
tables, fix the unshadowing logic in _gmap_ptep_xchg() to prevent
unnecessary unshadowing and perform better checks.

Also fix the unshadowing logic in _gmap_crstep_xchg_atomic() which did
not unshadow properly when the large page would become unprotected.

Opportunistically add a check in gmap_protect_rmap() to make sure it
won't be called with level == TABLE_TYPE_PAGE_TABLE.

Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
Fixes: a2c17f9270cc ("KVM: s390: New gmap code")

Reviewed-by: Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>