]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
KVM: s390/interrupt: do not pin adapter interrupt pages
authorUlrich Weigand <Ulrich.Weigand@de.ibm.com>
Tue, 4 Feb 2020 13:51:58 +0000 (08:51 -0500)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 20 Mar 2020 19:32:52 +0000 (14:32 -0500)
commitdd3874a47f198833bf5e27d92279541f0f4a0cad
tree968f723bef0cc11ce386bf5f9e22ab2a931fc8ef
parente954e7009d738746fda4c88c6c60519828ea233b
KVM: s390/interrupt: do not pin adapter interrupt pages

BugLink: https://bugs.launchpad.net/bugs/1835531
The adapter interrupt page containing the indicator bits is currently
pinned. That means that a guest with many devices can pin a lot of
memory pages in the host. This also complicates the reference tracking
which is needed for memory management handling of protected virtual
machines. It might also have some strange side effects for madvise
MADV_DONTNEED and other things.

We can simply try to get the userspace page set the bits and free the
page. By storing the userspace address in the irq routing entry instead
of the guest address we can actually avoid many lookups and list walks
so that this variant is very likely not slower.

If userspace messes around with the memory slots the worst thing that
can happen is that we write to some other memory within that process.
As we get the the page with FOLL_WRITE this can also not be used to
write to shared read-only pages.

Signed-off-by: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
[borntraeger@de.ibm.com: patch simplification]
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
(cherry picked from commit f65470661f3648fe6d3d13475d01a744bb14f8b4 linux-next)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Documentation/virt/kvm/devices/s390_flic.txt
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/interrupt.c