]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: s390: Fall back to short-term pinning in MAP ioctl
authorJaehoon Kim <jhkim@linux.ibm.com>
Fri, 24 Jul 2026 13:39:43 +0000 (08:39 -0500)
committerChristian Borntraeger <borntraeger@linux.ibm.com>
Mon, 27 Jul 2026 07:23:53 +0000 (09:23 +0200)
commit9972befc3e34ff8b6847198c84f11bfc312dde40
tree4122e362d821f1f933753bdb78ed6f06e6649690
parent868d32ac72cba21c5c6d8a66a814b7c25a3a5c01
KVM: s390: Fall back to short-term pinning in MAP ioctl

FOLL_LONGTERM pinning fails for some memory types, such as file-backed
guest memory. As a result, kvm_s390_adapter_map() returns -EINVAL and
irqfd adapter registration fails even though interrupt delivery could
still work via the existing non-atomic path.

When FOLL_LONGTERM pinning fails, verify that the page is accessible
using a short-term pin instead. If the short-term pin succeeds, unpin
the page and add a map entry with pinned=false to preserve MAP/UNMAP
symmetry. The non-atomic irqfd path already performs short-term pinning
for interrupt delivery, so this restores the previous behavior for
memory that cannot be pinned long-term.

get_map_info() is updated to return NULL for unpinned entries so that
the atomic irqfd fast path falls back to the non-atomic path.
kvm_s390_adapter_unmap() and kvm_s390_unmap_all_adapters() skip dirty
marking and unpin for unpinned entries.

Update Documentation/virt/kvm/devices/s390_flic.rst to reflect the
new MAP/UNMAP behavior.

Fixes: c9a568838086 ("KVM: s390: Add map/unmap ioctl and clean mappings post-guest")
Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com>
Reviewed-by: Douglas Freimuth <freimuth@linux.ibm.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Documentation/virt/kvm/devices/s390_flic.rst
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/interrupt.c