On Mon, 24 Feb 2020 06:40:33 -0500 Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote: > From: Ulrich Weigand <Ulrich.Weigand@xxxxxxxxxx> > > 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@xxxxxxxxxx> > Acked-by: David Hildenbrand <david@xxxxxxxxxx> > [borntraeger@xxxxxxxxxx: patch simplification] > Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx> > --- > Documentation/virt/kvm/devices/s390_flic.rst | 11 +- > arch/s390/include/asm/kvm_host.h | 3 - > arch/s390/kvm/interrupt.c | 170 ++++++------------- > 3 files changed, 51 insertions(+), 133 deletions(-) Reviewed-by: Cornelia Huck <cohuck@xxxxxxxxxx>