From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933871AbdJQHLG (ORCPT ); Tue, 17 Oct 2017 03:11:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59086 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752471AbdJQHK7 (ORCPT ); Tue, 17 Oct 2017 03:10:59 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 38C4B7E439 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eric.auger@redhat.com From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, cdall@linaro.org, peter.maydell@linaro.org, andre.przywara@arm.com, wanghaibin.wang@huawei.com Cc: wu.wubin@huawei.com, drjones@redhat.com, wei@redhat.com Subject: [PATCH v4 07/11] KVM: arm/arm64: vgic-its: Always attempt to save/restore device and collection tables Date: Tue, 17 Oct 2017 09:10:05 +0200 Message-Id: <1508224209-15366-8-git-send-email-eric.auger@redhat.com> In-Reply-To: <1508224209-15366-1-git-send-email-eric.auger@redhat.com> References: <1508224209-15366-1-git-send-email-eric.auger@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 17 Oct 2017 07:10:59 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case the device table save fails, we currently do not attempt to save the collection table. However it may happen that the device table fails because the structures in memory are inconsistent with device GITS_BASER however this does not mean collection backup can't and shouldn't be performed. Same must happen on restore path. Without this patch, after a reset and early state backup, the device table restore may fail due to L1 entry not valid. If we don't restore the collection table the guest does not reboot properly. Signed-off-by: Eric Auger --- candidate to be CC'ed stable --- virt/kvm/arm/vgic/vgic-its.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index e18f1e4..1c3e83f 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -2381,12 +2381,9 @@ static int vgic_its_save_tables_v0(struct vgic_its *its) } ret = vgic_its_save_device_tables(its); - if (ret) - goto out; - ret = vgic_its_save_collection_table(its); + ret |= vgic_its_save_collection_table(its); -out: unlock_all_vcpus(kvm); mutex_unlock(&its->its_lock); mutex_unlock(&kvm->lock); @@ -2413,11 +2410,9 @@ static int vgic_its_restore_tables_v0(struct vgic_its *its) } ret = vgic_its_restore_collection_table(its); - if (ret) - goto out; - ret = vgic_its_restore_device_tables(its); -out: + ret |= vgic_its_restore_device_tables(its); + unlock_all_vcpus(kvm); mutex_unlock(&its->its_lock); mutex_unlock(&kvm->lock); -- 2.5.5 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Auger Subject: [PATCH v4 07/11] KVM: arm/arm64: vgic-its: Always attempt to save/restore device and collection tables Date: Tue, 17 Oct 2017 09:10:05 +0200 Message-ID: <1508224209-15366-8-git-send-email-eric.auger@redhat.com> References: <1508224209-15366-1-git-send-email-eric.auger@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: wu.wubin@huawei.com To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, cdall@linaro.org, peter.maydell@linaro.org, andre.przywara@arm.com, wanghaibin.wang@huawei.com Return-path: In-Reply-To: <1508224209-15366-1-git-send-email-eric.auger@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu List-Id: kvm.vger.kernel.org In case the device table save fails, we currently do not attempt to save the collection table. However it may happen that the device table fails because the structures in memory are inconsistent with device GITS_BASER however this does not mean collection backup can't and shouldn't be performed. Same must happen on restore path. Without this patch, after a reset and early state backup, the device table restore may fail due to L1 entry not valid. If we don't restore the collection table the guest does not reboot properly. Signed-off-by: Eric Auger --- candidate to be CC'ed stable --- virt/kvm/arm/vgic/vgic-its.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c index e18f1e4..1c3e83f 100644 --- a/virt/kvm/arm/vgic/vgic-its.c +++ b/virt/kvm/arm/vgic/vgic-its.c @@ -2381,12 +2381,9 @@ static int vgic_its_save_tables_v0(struct vgic_its *its) } ret = vgic_its_save_device_tables(its); - if (ret) - goto out; - ret = vgic_its_save_collection_table(its); + ret |= vgic_its_save_collection_table(its); -out: unlock_all_vcpus(kvm); mutex_unlock(&its->its_lock); mutex_unlock(&kvm->lock); @@ -2413,11 +2410,9 @@ static int vgic_its_restore_tables_v0(struct vgic_its *its) } ret = vgic_its_restore_collection_table(its); - if (ret) - goto out; - ret = vgic_its_restore_device_tables(its); -out: + ret |= vgic_its_restore_device_tables(its); + unlock_all_vcpus(kvm); mutex_unlock(&its->its_lock); mutex_unlock(&kvm->lock); -- 2.5.5