Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2172758pxa; Mon, 17 Aug 2020 02:55:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYGBXwBDQ/WCixECV+eyQkvB9IRbSihtRBFm1tRhB8ReJZ9qPkGPA8QWH3ybU0mz6uNf1G X-Received: by 2002:a17:906:9717:: with SMTP id k23mr14561673ejx.493.1597658111206; Mon, 17 Aug 2020 02:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597658111; cv=none; d=google.com; s=arc-20160816; b=X7wMgPEhhlRalXUSRrbPXKqTYLBuWKDPFMvivJLXJOY92KR3JCFlPVaevGm9awfmZO SRBR8y8mHWncqxdJZIagZuEAjysN6m5fv5kHzbSMV/PgBV89pGMVAx2XgxlQF6efS604 /61z0Cd5ybgQN8FCbwu08jW8FkKE5OKBuZHIdWi5Jpk4dfvqpwy3K1k5S46m7NxGUarp eHA0tGndcx0UIiWaV+OWebTq+hSFuUcCiOlvk6IbfLalDlIUQxlK6oOWSusRjw5yjWyY qH6IguQaW9URJTqKpJOIE3Nv9HqpQfdrxUe1htslo4h++SgZ11aUKdjjWYqHOsBoVO/U W/Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=FOn66Ls4IRfBEjL06Jm2FPbFy0TMq/3suU2Rlliv6mE=; b=ef6+l5F1kIQ1sUGw1KNcPDyDv/krPIkrUpSysrYGHUyeJuih6eOJ3BR0Rza18sr/8w rPye+nw6+XvkXp78J30nHeKwPemLlwyS2dNLqk4AXaorGWosOpf4iuIiMyPPPh3rw8w9 o4X09iW626CSk5iUDenLGOBhwHy80Qs/+ZWYvn3g4e4UoxmdG4RZNWDnerRB/htH0OqS 4TCxt9G34fxDiHS+CB4wpbwGYCC4tP0SzwprWdiKsoBOSgsatQBZfRsgKVm8owsSxJZN NQDrUvLexKmFSm5K7g0eXXW5KlUe4GK56wofWolYb3JR8WCUQo7khN935V21Y94efijW pGng== 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 w1si10338195eds.83.2020.08.17.02.54.48; Mon, 17 Aug 2020 02:55:11 -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 S1726898AbgHQJxM (ORCPT + 99 others); Mon, 17 Aug 2020 05:53:12 -0400 Received: from foss.arm.com ([217.140.110.172]:52352 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726575AbgHQJxM (ORCPT ); Mon, 17 Aug 2020 05:53:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7054031B; Mon, 17 Aug 2020 02:53:11 -0700 (PDT) Received: from [192.168.1.179] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EC453F66B; Mon, 17 Aug 2020 02:53:09 -0700 (PDT) Subject: Re: [PATCH 3/3] KVM: arm64: Use kvm_write_guest_lock when init stolen time To: Keqian Zhu , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: Marc Zyngier , Catalin Marinas , Will Deacon , James Morse , Suzuki K Poulose , wanghaibin.wang@huawei.com References: <20200817033729.10848-1-zhukeqian1@huawei.com> <20200817033729.10848-4-zhukeqian1@huawei.com> From: Steven Price Message-ID: <41523036-7492-d554-e256-32f42959684d@arm.com> Date: Mon, 17 Aug 2020 10:53:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200817033729.10848-4-zhukeqian1@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/08/2020 04:37, Keqian Zhu wrote: > There is a lock version kvm_write_guest. Use it to simplify code. > > Signed-off-by: Keqian Zhu 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; > } >