kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: giangyi@amazon.com, maz@kernel.org
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH] KVM: arm/arm64: release kvm->mmu_lock in loop to prevent starvation
Date: Thu, 7 May 2020 12:01:28 +0100	[thread overview]
Message-ID: <0e448ae0-af4c-3f0a-2dd5-6ab86c0d60c0@arm.com> (raw)
In-Reply-To: <20200415084229.29992-1-giangyi@amazon.com>

On 04/15/2020 09:42 AM, Jiang Yi wrote:
> Do cond_resched_lock() in stage2_flush_memslot() like what is done in
> unmap_stage2_range() and other places holding mmu_lock while processing
> a possibly large range of memory.
> 
> Signed-off-by: Jiang Yi <giangyi@amazon.com>
> ---
>   virt/kvm/arm/mmu.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/virt/kvm/arm/mmu.c b/virt/kvm/arm/mmu.c
> index e3b9ee268823..7315af2c52f8 100644
> --- a/virt/kvm/arm/mmu.c
> +++ b/virt/kvm/arm/mmu.c
> @@ -417,16 +417,19 @@ static void stage2_flush_memslot(struct kvm *kvm,
>   	phys_addr_t next;
>   	pgd_t *pgd;
>   
>   	pgd = kvm->arch.pgd + stage2_pgd_index(kvm, addr);
>   	do {
>   		next = stage2_pgd_addr_end(kvm, addr, end);
>   		if (!stage2_pgd_none(kvm, *pgd))
>   			stage2_flush_puds(kvm, pgd, addr, next);
> +
> +		if (next != end)
> +			cond_resched_lock(&kvm->mmu_lock);
>   	} while (pgd++, addr = next, addr != end);
>   }

Given that this is called under the srcu_lock this looks
good to me:

Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>

>   
>   /**
>    * stage2_flush_vm - Invalidate cache for pages mapped in stage 2
>    * @kvm: The struct kvm pointer
>    *
>    * Go through the stage 2 page tables and invalidate any cache lines
> 

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

      reply	other threads:[~2020-05-07 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15  8:42 [PATCH] KVM: arm/arm64: release kvm->mmu_lock in loop to prevent starvation Jiang Yi
2020-05-07 11:01 ` Suzuki K Poulose [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=0e448ae0-af4c-3f0a-2dd5-6ab86c0d60c0@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=giangyi@amazon.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@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 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).