Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2145297pxa; Mon, 17 Aug 2020 01:56:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3MYwYSgfu+5cZ66sWav+4mHiqlrSSuxR39JmKL3ZoTHintOvlsALYWblNKmWGgQjai2Z9 X-Received: by 2002:a50:9dc2:: with SMTP id l2mr6172714edk.290.1597654576207; Mon, 17 Aug 2020 01:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597654576; cv=none; d=google.com; s=arc-20160816; b=PCR6XeOdanXkSddmYECkgQoCHWLFOtlLGBeOsjC9t9QWVIn/vIOVmUmdKxTV+BlZuM FVODnn58CEmG8dlQkZAXOELUdcFyVHbx/arSinO1acPvPq2YlcKZXK2A4ejx+3nuyaFH +6QbySqpiWRVGd4EJi+aT9bfYHKZWiouwGQr1DlQtixXKK/6BzUBemUyfetL+0Rtjkag voI2oG3zejUUzRuJZS0LbjwCi4ygPhnJxZT5q+tFNj1Hfk9z6T6kK2vtWV5306n8szvR HO05awg712Pkul7m6X/VzdAddioRWFntY//VN1izPTqsM4qblIPyJ6L2yduKttsK3muf 4SRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=0YghR5Mms8jHBUWQxThuVTLlaBCYQmrwY5aHeC7UwVY=; b=v9t9Av4o0Uq1QWdpJZBI7Ln0bKwa0iTnsVTDs/+6pCfeQqk+U2lcTeQXq9svS1Vx8X 4nxKPJclBmwTgzhplG/QEjmskIZLoCu1uEPP4OWXStdSHpr3leSVhVPQISRpIa1NqqOz TlzTiWoZ/i8aFE+YiF4jK4sjTnslbQ0AyA0CDu5n8nA9SAy0OBYi09yQbn8bHGZFiFA8 GhrZciMFvfBwDukwgM5bC13Ws0pllNitQh6WTuzI/UhKIEKTJo8Y4QSkocz78U4vao68 bIiNoK4heIAr8SBtKsAzwbcMVDaQLaUw3iAJznOhv6uj7lQWM0rJ5wx6PeS3LUWAZXCG L8vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=an7O0aBs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lo6si10677691ejb.584.2020.08.17.01.55.53; Mon, 17 Aug 2020 01:56:16 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=an7O0aBs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728536AbgHQIxL (ORCPT + 99 others); Mon, 17 Aug 2020 04:53:11 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:25752 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727084AbgHQIxK (ORCPT ); Mon, 17 Aug 2020 04:53:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597654389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0YghR5Mms8jHBUWQxThuVTLlaBCYQmrwY5aHeC7UwVY=; b=an7O0aBsWCgLmaoRMMhgf6p/ja2PpOG8Nk++ie1nAq9bqqUbxqpoPJ9tnlhrxt4kqMBvfB LCiZTEW+21OkbA63xkBlfh3CI24KPUP0CcUHz9G3RMmYq7czqgH5rdXYOfdEcp4zo5BM5Q riF8PydvAgO/07SJqJOXVknF0lUvFss= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-192-M9b1GrjmO6u9o76KkD9vjw-1; Mon, 17 Aug 2020 04:53:05 -0400 X-MC-Unique: M9b1GrjmO6u9o76KkD9vjw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E445425EF; Mon, 17 Aug 2020 08:53:03 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.40.192.210]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B4A4100EBA4; Mon, 17 Aug 2020 08:53:00 +0000 (UTC) Date: Mon, 17 Aug 2020 10:52:57 +0200 From: Andrew Jones To: Keqian Zhu Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Marc Zyngier , Catalin Marinas , Will Deacon , James Morse , Suzuki K Poulose , Steven Price , wanghaibin.wang@huawei.com Subject: Re: [PATCH 3/3] KVM: arm64: Use kvm_write_guest_lock when init stolen time Message-ID: <20200817085257.k3i2nyhqn2nwdotx@kamzik.brq.redhat.com> References: <20200817033729.10848-1-zhukeqian1@huawei.com> <20200817033729.10848-4-zhukeqian1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200817033729.10848-4-zhukeqian1@huawei.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 17, 2020 at 11:37:29AM +0800, Keqian Zhu wrote: > 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 > Reviewed-by: Andrew Jones