* [PATCH v2] kvm: iommu: Add cond_resched to legacy device assignment code
@ 2015-01-27 10:57 Joerg Roedel
2015-01-27 20:31 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Joerg Roedel @ 2015-01-27 10:57 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, linux-kernel, joro, jroedel
From: Joerg Roedel <jroedel@suse.de>
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>
---
arch/x86/kvm/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kvm/iommu.c b/arch/x86/kvm/iommu.c
index 17b73ee..7dbced3 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)
gfn += page_size >> PAGE_SHIFT;
-
+ cond_resched();
}
return 0;
@@ -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();
}
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] kvm: iommu: Add cond_resched to legacy device assignment code
2015-01-27 10:57 [PATCH v2] kvm: iommu: Add cond_resched to legacy device assignment code Joerg Roedel
@ 2015-01-27 20:31 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2015-01-27 20:31 UTC (permalink / raw)
To: Joerg Roedel, Gleb Natapov; +Cc: kvm, linux-kernel, jroedel
On 27/01/2015 11:57, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
>
> 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>
> ---
> arch/x86/kvm/iommu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/iommu.c b/arch/x86/kvm/iommu.c
> index 17b73ee..7dbced3 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)
>
> gfn += page_size >> PAGE_SHIFT;
>
> -
> + cond_resched();
> }
>
> return 0;
> @@ -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();
> }
> }
>
>
Applying to kvm/queue, thanks.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-27 20:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27 10:57 [PATCH v2] kvm: iommu: Add cond_resched to legacy device assignment code Joerg Roedel
2015-01-27 20:31 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.