Hi Wanghaibin,

On 06/09/2017 15:05, wanghaibin wrote:
> This patch fix the migrate restore tables failure.
> 
> The same scene, at the destination, the restore tables interface traversal 
> guest
> memory, and check the dte/ite is valid or not.
> If all dtes/ites are invalid, we will do try next one, and the last it will 
> take
> the 1 return value, but currently, it be treated as error. That's not correct.
> 
> This patch try to fix this problem.
> 
> Signed-off-by: wanghaibin <[email protected]>
> ---
>  virt/kvm/arm/vgic/vgic-its.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c
> index 5c20352..2c69aeb 100644
> --- a/virt/kvm/arm/vgic/vgic-its.c
> +++ b/virt/kvm/arm/vgic/vgic-its.c
> @@ -2025,7 +2025,7 @@ static int vgic_its_restore_dte(struct vgic_its *its, 
> u32 id,
>               return PTR_ERR(dev);
>  
>       ret = vgic_its_restore_itt(its, dev);
> -     if (ret) {
> +     if (ret < 0) {
>               vgic_its_free_device(its->dev->kvm, dev);
>               return ret;
>       }
> @@ -2147,9 +2147,6 @@ static int vgic_its_restore_device_tables(struct 
> vgic_its *its)
>                                    vgic_its_restore_dte, NULL);
>       }
>  
> -     if (ret > 0)
> -             ret = -EINVAL;
Reworking error handling in scan_its_table as I previously proposed
indeed don't work for L2 tables, as pointed out by Christoffer. As such
I eventually think your approach is the best.

The only remark I have left is restore table IOCTL is likely to return 1
with your change. 1 is not documented in the API as a returned value. I
think we should return 0 in this case. We are lucky because QEMU
kvm_device_access does not interpret positive values as errors.

Thanks

Eric

> -
>       return ret;
>  }
>  
> 
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to