Skip to content

Commit

Permalink
kvm: iommu: Add cond_resched to legacy device assignment code
Browse files Browse the repository at this point in the history
When assigning devices to large memory guests (>=128GB guest
memory in the failure case) the functions to create the
IOMMU page-tables for the whole guest might run for a very
long time. On non-preemptible kernels this might cause
Soft-Lockup warnings. Fix these by adding a cond_resched()
to the mapping and unmapping loops.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Joerg Roedel authored and Paolo Bonzini committed Jan 27, 2015
1 parent 8226808 commit 128ca09
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/x86/kvm/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)

gfn += page_size >> PAGE_SHIFT;


cond_resched();
}

return 0;
Expand Down Expand Up @@ -306,6 +306,8 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
kvm_unpin_pages(kvm, pfn, unmap_pages);

gfn += unmap_pages;

cond_resched();
}
}

Expand Down

0 comments on commit 128ca09

Please sign in to comment.