Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2024480pxa; Sun, 16 Aug 2020 20:40:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztXtLobh0QHB1/zyPGHPDx+gbZD0UhL9qVrLv+xvq0nNT6BAWCCJ9Yjq0TsLvya1yKcjPq X-Received: by 2002:a05:6402:2285:: with SMTP id cw5mr12912317edb.242.1597635653610; Sun, 16 Aug 2020 20:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597635653; cv=none; d=google.com; s=arc-20160816; b=TkhPieMkjPEX1ROpyqAI2X+DXMCvhxZlzi5kJUZS4moyUpYrdM/akFD+L37zjw242t cvTDjlb2Pj0DmRkcDs6MknuDG1LoqvxY9tYskO2+blEC+dlHzpEfcoYMBcy6Qta2f6YB d0YI5CYw3KZaLJP8zmYOWpSq2RnvFZpJwTkzq+QHy3KGGvuXeKJ7JslCFjCTfoxnwQ+H BAiFFbgofS50EN3k7WSTFFvjVjKq6iDmCxeHRyO3MrQ1C7kac0NAmtMmOguB9J7ZSdRZ v3+UhEizTT6hNQZrPkiWj5Tip35V8faOcobO1XhQDWPiPguVqCQM/6zWH5ugitHrfqxb k5iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=G5/I2RDg6U8g1fL+fhrQyLWXUiBWdQIifruLbKex+Jo=; b=wL3hWf1hOivLsSuGb1st2KFvgOpqlTtkJ+G1obZm1FB921hGfOMuBUxxUCwyUrBcET dJQ7iJWINYjQuwXekJeh6byQKgC17a+DipQkoOiHS3rLl5qhRqAIH5ouOecD7i1JtrAY Sqnc1SByK7mirq8viPfbnyT9C1IUOjzBRGKka/FSjQZDsOuAc7WqXXUJw4ZuCIMLv0do H7zXYJdfls8rn6byCA3l+XEpwbyDS5RHQF3bXyQSx7CTKKk8D+DnGQu7vNDCzAEOMO6C kjo8bjXF2aD8AevgG+e1sINSML52aWWZT+rG5KgiXRXeRufeWLtnPt01Y/pooMOjS//o QRsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si11418277edn.359.2020.08.16.20.40.30; Sun, 16 Aug 2020 20:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727772AbgHQDi0 (ORCPT + 99 others); Sun, 16 Aug 2020 23:38:26 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43272 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727074AbgHQDiW (ORCPT ); Sun, 16 Aug 2020 23:38:22 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 5A30889994A65CB4171F; Mon, 17 Aug 2020 11:38:18 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.187.22) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Mon, 17 Aug 2020 11:38:07 +0800 From: Keqian Zhu To: , , , CC: Marc Zyngier , Catalin Marinas , Will Deacon , James Morse , "Suzuki K Poulose" , Steven Price , , Keqian Zhu Subject: [PATCH 3/3] KVM: arm64: Use kvm_write_guest_lock when init stolen time Date: Mon, 17 Aug 2020 11:37:29 +0800 Message-ID: <20200817033729.10848-4-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20200817033729.10848-1-zhukeqian1@huawei.com> References: <20200817033729.10848-1-zhukeqian1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.22] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a lock version kvm_write_guest. Use it to simplify code. Signed-off-by: Keqian Zhu --- 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