From: Christoffer Dall <cdall@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: marc.zyngier@arm.com, kvmarm@lists.cs.columbia.edu,
linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org
Subject: Re: [PATCH] kvm: arm/arm64: Simplify lock relaxation in stage2_wp_range
Date: Fri, 17 Mar 2017 09:48:34 +0100 [thread overview]
Message-ID: <20170317084834.GV1277@cbox> (raw)
In-Reply-To: <1489688674-17692-1-git-send-email-suzuki.poulose@arm.com>
On Thu, Mar 16, 2017 at 06:24:34PM +0000, Suzuki K Poulose wrote:
> From: Marc Zyngier <marc.zyngier@arm.com>
>
> Add checks to make sure that kvm->mmu_lock is held while calling
> stage2_wp_range. Also avoid explicit checks already done by cond_resched_lock().
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> [ Added assert_spin_locked check ]
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Christoffer Dall <cdall@linaro.org>
> ---
> arch/arm/kvm/mmu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> index 7628ef1..37e67f5 100644
> --- a/arch/arm/kvm/mmu.c
> +++ b/arch/arm/kvm/mmu.c
> @@ -1162,6 +1162,8 @@ static void stage2_wp_range(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
> pgd_t *pgd;
> phys_addr_t next;
>
> + assert_spin_locked(&kvm->mmu_lock);
> +
> pgd = kvm->arch.pgd + stage2_pgd_index(addr);
> do {
> /*
> @@ -1171,8 +1173,7 @@ static void stage2_wp_range(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
> * CONFIG_LOCKDEP. Additionally, holding the lock too long
> * will also starve other vCPUs.
> */
> - if (need_resched() || spin_needbreak(&kvm->mmu_lock))
> - cond_resched_lock(&kvm->mmu_lock);
> + cond_resched_lock(&kvm->mmu_lock);
>
> next = stage2_pgd_addr_end(addr, end);
> if (stage2_pgd_present(*pgd))
> --
> 2.7.4
>
WARNING: multiple messages have this Message-ID (diff)
From: cdall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] kvm: arm/arm64: Simplify lock relaxation in stage2_wp_range
Date: Fri, 17 Mar 2017 09:48:34 +0100 [thread overview]
Message-ID: <20170317084834.GV1277@cbox> (raw)
In-Reply-To: <1489688674-17692-1-git-send-email-suzuki.poulose@arm.com>
On Thu, Mar 16, 2017 at 06:24:34PM +0000, Suzuki K Poulose wrote:
> From: Marc Zyngier <marc.zyngier@arm.com>
>
> Add checks to make sure that kvm->mmu_lock is held while calling
> stage2_wp_range. Also avoid explicit checks already done by cond_resched_lock().
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> [ Added assert_spin_locked check ]
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Christoffer Dall <cdall@linaro.org>
> ---
> arch/arm/kvm/mmu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> index 7628ef1..37e67f5 100644
> --- a/arch/arm/kvm/mmu.c
> +++ b/arch/arm/kvm/mmu.c
> @@ -1162,6 +1162,8 @@ static void stage2_wp_range(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
> pgd_t *pgd;
> phys_addr_t next;
>
> + assert_spin_locked(&kvm->mmu_lock);
> +
> pgd = kvm->arch.pgd + stage2_pgd_index(addr);
> do {
> /*
> @@ -1171,8 +1173,7 @@ static void stage2_wp_range(struct kvm *kvm, phys_addr_t addr, phys_addr_t end)
> * CONFIG_LOCKDEP. Additionally, holding the lock too long
> * will also starve other vCPUs.
> */
> - if (need_resched() || spin_needbreak(&kvm->mmu_lock))
> - cond_resched_lock(&kvm->mmu_lock);
> + cond_resched_lock(&kvm->mmu_lock);
>
> next = stage2_pgd_addr_end(addr, end);
> if (stage2_pgd_present(*pgd))
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-03-17 8:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 18:24 [PATCH] kvm: arm/arm64: Simplify lock relaxation in stage2_wp_range Suzuki K Poulose
2017-03-16 18:24 ` Suzuki K Poulose
2017-03-17 8:48 ` Christoffer Dall [this message]
2017-03-17 8:48 ` Christoffer Dall
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=20170317084834.GV1277@cbox \
--to=cdall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=suzuki.poulose@arm.com \
/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.