aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-01-27 05:57:19 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2015-01-27 15:31:12 -0500
commit128ca093cc3cf3fc0368fa56b6a98f395090ddb0 (patch)
treead495664807c971ea380e8b8c2673d4859940044
parent82268083fa78452c1c8be30a82984e470d9678c7 (diff)
kvm: iommu: Add cond_resched to legacy device assignment code
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>
-rw-r--r--arch/x86/kvm/iommu.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/iommu.c b/arch/x86/kvm/iommu.c
index 17b73eeac8a4..7dbced309ddb 100644
--- a/arch/x86/kvm/iommu.c
+++ b/arch/x86/kvm/iommu.c
@@ -138,7 +138,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
138 138
139 gfn += page_size >> PAGE_SHIFT; 139 gfn += page_size >> PAGE_SHIFT;
140 140
141 141 cond_resched();
142 } 142 }
143 143
144 return 0; 144 return 0;
@@ -306,6 +306,8 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
306 kvm_unpin_pages(kvm, pfn, unmap_pages); 306 kvm_unpin_pages(kvm, pfn, unmap_pages);
307 307
308 gfn += unmap_pages; 308 gfn += unmap_pages;
309
310 cond_resched();
309 } 311 }
310} 312}
311 313