public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Keqian Zhu <zhukeqian1@huawei.com>
To: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<kvmarm@lists.cs.columbia.edu>, <kvm@vger.kernel.org>
Cc: Marc Zyngier <maz@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, James Morse <james.morse@arm.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	Steven Price <steven.price@arm.com>, <wanghaibin.wang@huawei.com>,
	Keqian Zhu <zhukeqian1@huawei.com>
Subject: [PATCH 3/3] KVM: arm64: Use kvm_write_guest_lock when init stolen time
Date: Mon, 17 Aug 2020 11:37:29 +0800	[thread overview]
Message-ID: <20200817033729.10848-4-zhukeqian1@huawei.com> (raw)
In-Reply-To: <20200817033729.10848-1-zhukeqian1@huawei.com>

There is a lock version kvm_write_guest. Use it to simplify code.

Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
---
 arch/arm64/kvm/pvtime.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/arm64/kvm/pvtime.c b/arch/arm64/kvm/pvtime.c
index f7b52ce..2b24e7f 100644
--- a/arch/arm64/kvm/pvtime.c
+++ b/arch/arm64/kvm/pvtime.c
@@ -55,7 +55,6 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu)
 	struct pvclock_vcpu_stolen_time init_values = {};
 	struct kvm *kvm = vcpu->kvm;
 	u64 base = vcpu->arch.steal.base;
-	int idx;
 
 	if (base == GPA_INVALID)
 		return base;
@@ -66,10 +65,7 @@ gpa_t kvm_init_stolen_time(struct kvm_vcpu *vcpu)
 	 */
 	vcpu->arch.steal.steal = 0;
 	vcpu->arch.steal.last_steal = current->sched_info.run_delay;
-
-	idx = srcu_read_lock(&kvm->srcu);
-	kvm_write_guest(kvm, base, &init_values, sizeof(init_values));
-	srcu_read_unlock(&kvm->srcu, idx);
+	kvm_write_guest_lock(kvm, base, &init_values, sizeof(init_values));
 
 	return base;
 }
-- 
1.8.3.1


  parent reply	other threads:[~2020-08-17  3:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17  3:37 [PATCH 0/3] KVM: arm64: Some fixes and code adjustments for pvtime ST Keqian Zhu
2020-08-17  3:37 ` [PATCH 1/3] KVM: arm64: Some fixes of PV-time interface document Keqian Zhu
2020-08-17  8:47   ` Andrew Jones
2020-08-17  9:02     ` zhukeqian
2020-08-17  9:39   ` Steven Price
2020-08-17  3:37 ` [PATCH 2/3] KVM: uapi: Remove KVM_DEV_TYPE_ARM_PV_TIME in kvm_device_type Keqian Zhu
2020-08-17  7:39   ` Marc Zyngier
2020-08-17  8:43     ` zhukeqian
2020-08-17  9:49       ` Steven Price
2020-08-17 10:56         ` zhukeqian
2020-08-17  3:37 ` Keqian Zhu [this message]
2020-08-17  8:52   ` [PATCH 3/3] KVM: arm64: Use kvm_write_guest_lock when init stolen time Andrew Jones
2020-08-17  9:53   ` Steven Price

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=20200817033729.10848-4-zhukeqian1@huawei.com \
    --to=zhukeqian1@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=wanghaibin.wang@huawei.com \
    --cc=will@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