Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2210788pxa; Mon, 17 Aug 2020 04:10:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVoTlzM4x+r2mwCgFQ1xXvhQqukXi1CQKBynn+7NFGU7JMZ/Sn6/IRokvkumes9/3S4Pro X-Received: by 2002:a17:906:640c:: with SMTP id d12mr3290276ejm.388.1597662609848; Mon, 17 Aug 2020 04:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597662609; cv=none; d=google.com; s=arc-20160816; b=FVp2ABfasHiNMI2/2/lSTqRKjYIA2QH1rmUlQ+UNsmAwsDUGTS/Xhls1aa0YDjoOei KvrifOVDanmgKqhjrVXWOroxhajrU4k5btO1+TbaLoCIlMrmQW3QCwhKEHqR8uUr2UEh 1pJot44VmpG3ibll8YqXrjDCtN7x/e3fcsEQffmT+M6CujYsesyUQDW4jgUKlDg/nVZl zo4f0rOYCM8eGYEeh2zHqgGmLn0ZsAHfSdLQnmF3SYmNWJKA0qP3RfrvbsjArNuE8Q0X VJzlMSSyjmYPsS5h4ZJMAVMVGspF0M4eLbwWvm++Ds7yn7A1LKJZ3Cygam2ikf9r9DWe T5nQ== 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=tCMnJfObwCyL2eTDgA6dzftJdizfSpsP6mr0meg6ino=; b=xKBoD5W5Ic7WIzcZ1D9hnzhys50EHDRNDQUWVphxTdBFTHKP43ZGljBBEAbVu7OVQF 1OQo3AQvEkxscfLv34lKhMStShg+swpfqlhsUgSCRF0Ls1KGpqtJsWAPAIjUkGXy4Zi2 4tONkoJWWAPIbgONc/O/P/V6J9jqiDtBOeQKfBic2VXzdderIwZsbe1Ztb68exX36vwv 2jcPMbZsaPb7CKJvBQ9HaqqvVdtvueIS3U0moNMxl6TkM2NzyUBqbWb5X90V2msTLV8E 2g+wFrswYSRQwWV5pxFvEXE5tslhRtczZnsESqhiv102N15JfVzAFIu23nxhtSCJPk+p 9EKw== 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 b2si11289349edy.370.2020.08.17.04.09.46; Mon, 17 Aug 2020 04:10:09 -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 S1727983AbgHQLIM (ORCPT + 99 others); Mon, 17 Aug 2020 07:08:12 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9747 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726403AbgHQLIG (ORCPT ); Mon, 17 Aug 2020 07:08:06 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E80D389EC9CBD5A5F5F1; Mon, 17 Aug 2020 19:08:00 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.187.22) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Mon, 17 Aug 2020 19:07:51 +0800 From: Keqian Zhu To: , , , CC: Marc Zyngier , Steven Price , "Andrew Jones" , Catalin Marinas , "Will Deacon" , James Morse , Suzuki K Poulose , , Keqian Zhu Subject: [PATCH v2 2/2] KVM: arm64: Use kvm_write_guest_lock when init stolen time Date: Mon, 17 Aug 2020 19:07:28 +0800 Message-ID: <20200817110728.12196-3-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20200817110728.12196-1-zhukeqian1@huawei.com> References: <20200817110728.12196-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 Reviewed-by: Andrew Jones Reviewed-by: Steven Price --- 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