All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Joerg Roedel <joro@8bytes.org>, Gleb Natapov <gleb@kernel.org>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, jroedel@suse.de
Subject: Re: [PATCH v2] kvm: iommu: Add cond_resched to legacy device assignment code
Date: Tue, 27 Jan 2015 21:31:26 +0100	[thread overview]
Message-ID: <54C7F59E.9090806@redhat.com> (raw)
In-Reply-To: <1422356239-18203-1-git-send-email-joro@8bytes.org>



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

      reply	other threads:[~2015-01-27 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C7F59E.9090806@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.