* [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code
@ 2014-12-16 15:47 Joerg Roedel
2014-12-17 1:38 ` Chen, Tiejun
0 siblings, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2014-12-16 15:47 UTC (permalink / raw)
To: Gleb Natapov, Paolo Bonzini; +Cc: kvm, linux-kernel, Joerg Roedel
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>
---
virt/kvm/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index c1e6ae9..ac427e8 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -137,7 +137,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
gfn += page_size >> PAGE_SHIFT;
-
+ cond_resched();
}
return 0;
@@ -311,6 +311,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] 5+ messages in thread
* Re: [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code
2014-12-16 15:47 [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code Joerg Roedel
@ 2014-12-17 1:38 ` Chen, Tiejun
2014-12-17 10:35 ` Joerg Roedel
0 siblings, 1 reply; 5+ messages in thread
From: Chen, Tiejun @ 2014-12-17 1:38 UTC (permalink / raw)
To: Joerg Roedel, Gleb Natapov, Paolo Bonzini; +Cc: kvm, linux-kernel, Joerg Roedel
On 2014/12/16 23:47, 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>
> ---
> virt/kvm/iommu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> index c1e6ae9..ac427e8 100644
> --- a/virt/kvm/iommu.c
> +++ b/virt/kvm/iommu.c
This file is already gone after one latest commit c274e03af705, "kvm:
x86: move assigned-dev.c and iommu.c to arch/x86/" is introduced, so you
need to pull your tree firstly :)
Tiejun
> @@ -137,7 +137,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
>
> gfn += page_size >> PAGE_SHIFT;
>
> -
> + cond_resched();
> }
>
> return 0;
> @@ -311,6 +311,8 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
> kvm_unpin_pages(kvm, pfn, unmap_pages);
>
> gfn += unmap_pages;
> +
> + cond_resched();
> }
> }
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code
2014-12-17 1:38 ` Chen, Tiejun
@ 2014-12-17 10:35 ` Joerg Roedel
2014-12-17 10:46 ` Paolo Bonzini
0 siblings, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2014-12-17 10:35 UTC (permalink / raw)
To: Chen, Tiejun; +Cc: Joerg Roedel, Gleb Natapov, Paolo Bonzini, kvm, linux-kernel
On Wed, Dec 17, 2014 at 09:38:57AM +0800, Chen, Tiejun wrote:
> On 2014/12/16 23:47, Joerg Roedel wrote:
> >diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
> >index c1e6ae9..ac427e8 100644
> >--- a/virt/kvm/iommu.c
> >+++ b/virt/kvm/iommu.c
>
> This file is already gone after one latest commit c274e03af705,
> "kvm: x86: move assigned-dev.c and iommu.c to arch/x86/" is
> introduced, so you need to pull your tree firstly :)
Hmm, I based the patch on kvm/master, where the file is still present.
What is the branch to base kvm patches on these days?
Joerg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code
2014-12-17 10:35 ` Joerg Roedel
@ 2014-12-17 10:46 ` Paolo Bonzini
2014-12-17 10:50 ` Joerg Roedel
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2014-12-17 10:46 UTC (permalink / raw)
To: Joerg Roedel, Chen, Tiejun; +Cc: Joerg Roedel, Gleb Natapov, kvm, linux-kernel
On 17/12/2014 11:35, Joerg Roedel wrote:
>> >
>> > This file is already gone after one latest commit c274e03af705,
>> > "kvm: x86: move assigned-dev.c and iommu.c to arch/x86/" is
>> > introduced, so you need to pull your tree firstly :)
> Hmm, I based the patch on kvm/master, where the file is still present.
> What is the branch to base kvm patches on these days?
kvm/master in the -rc period, kvm/next during the merge window and for
the next release. But it's not a problem, I can sort it out.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code
2014-12-17 10:46 ` Paolo Bonzini
@ 2014-12-17 10:50 ` Joerg Roedel
0 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2014-12-17 10:50 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Chen, Tiejun, Joerg Roedel, Gleb Natapov, kvm, linux-kernel
On Wed, Dec 17, 2014 at 11:46:24AM +0100, Paolo Bonzini wrote:
>
>
> On 17/12/2014 11:35, Joerg Roedel wrote:
> >> >
> >> > This file is already gone after one latest commit c274e03af705,
> >> > "kvm: x86: move assigned-dev.c and iommu.c to arch/x86/" is
> >> > introduced, so you need to pull your tree firstly :)
> > Hmm, I based the patch on kvm/master, where the file is still present.
> > What is the branch to base kvm patches on these days?
>
> kvm/master in the -rc period, kvm/next during the merge window and for
> the next release. But it's not a problem, I can sort it out.
Great, thanks Paolo. So I will base my future patches on kvm/next.
Joerg
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-12-17 10:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-16 15:47 [PATCH] kvm: iommu: Add cond_resched to legacy device assignment code Joerg Roedel
2014-12-17 1:38 ` Chen, Tiejun
2014-12-17 10:35 ` Joerg Roedel
2014-12-17 10:46 ` Paolo Bonzini
2014-12-17 10:50 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).