Received: by 10.223.176.5 with SMTP id f5csp2162127wra; Sun, 4 Feb 2018 22:21:56 -0800 (PST) X-Google-Smtp-Source: AH8x227MMojhe0nRToa7G/7WuNodLnMrkYWUBK8J6vYy2dr6q3ax7DMVaEU1KMgj2YZC1L2LtybS X-Received: by 10.101.68.138 with SMTP id l10mr27877358pgq.150.1517811716109; Sun, 04 Feb 2018 22:21:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517811716; cv=none; d=google.com; s=arc-20160816; b=QhS6IOW3vAWxGLPTh34FvObUaqhRagjplXz0q47BNXMqbXXYVBByQPA65kRfeJR6jl 1gVxNDI+5N6xEZA+7sTHn3LIyPulIjpVPCf2mrAhLGx1o28IvfnKkxXaWMYPpsjv1Xu/ 90475vzXrrBAi3ihhBZcz4QUAMfLcZDDIhisVIMZe8tB1sr81DA3+H1O7iX+NNqLpBkh JRwpY2koDH0jTa9JCHWYbPfKu56U6SbkNiAhKb3UT3Ypeta0czEsitBjrA9bqMttvv/P GjG+bgvQga5F07ZPgHUfAhPQ7vaNzLUcxVbDLQ6vBVLlNXF0wPE6n+F5cyzac4GXO755 1z8g== 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:arc-authentication-results; bh=xZpyPlmHl3yWawlhb+iweoaYzKcxU+3jMnFl4q2lZzQ=; b=Y7Qkebv8Fz9OCNxIj1f92aQwoqYDaNYQFw9gilc61bIlnJNi8mN2kWcxXuv6ZpwoT+ djysIvHr2MXNg01MitJSMFAKF3n+yWT1rkBf5oYOcSZ8r9rVjvdbzPmFfr0In3qLH+5M 4l26qnERxwcIphw1NEHotnyKp2iK3tj6Y+XIlojM1QbToxSYgiXoUPyOJOuKDkSus2lm BJBWWfjF2voAhCF9t6nKS+PGkvD9ofIYbB6NOzjDb759hQ2IOfPCsQGROkw74/dvUUpT ritbXvULveRMO9pRx2PrvBzudeUAAM8werdcFGQQaYFubro8cidYJ7dHDvtEb9LOCUli 2AyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m186si4430045pfm.25.2018.02.04.22.21.40; Sun, 04 Feb 2018 22:21:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752325AbeBEGVB (ORCPT + 99 others); Mon, 5 Feb 2018 01:21:01 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:4763 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750784AbeBEGU4 (ORCPT ); Mon, 5 Feb 2018 01:20:56 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id E717B71915D15; Mon, 5 Feb 2018 14:20:40 +0800 (CST) Received: from [127.0.0.1] (10.142.68.147) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.361.1; Mon, 5 Feb 2018 14:20:32 +0800 Subject: Re: [PATCH v9 5/7] arm64: kvm: Introduce KVM_ARM_SET_SERROR_ESR ioctl To: James Morse CC: "christoffer.dall@linaro.org" , "marc.zyngier@arm.com" , "linux@armlinux.org.uk" , "catalin.marinas@arm.com" , "rjw@rjwysocki.net" , "bp@alien8.de" , "robert.moore@intel.com" , "lv.zheng@intel.com" , "corbet@lwn.net" , "will.deacon@arm.com" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.cs.columbia.edu" , "linux-acpi@vger.kernel.org" , "devel@acpica.org" , Huangshaoyu References: <0184EA26B2509940AA629AE1405DD7F201A9E8EA@DGGEMA503-MBS.china.huawei.com> <5A70C5A0.1050600@arm.com> From: gengdongjiu Message-ID: Date: Mon, 5 Feb 2018 14:19:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <5A70C5A0.1050600@arm.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org James, Thank you for your time to reply me. On 2018/1/31 3:21, James Morse wrote: > Hi gengdongjiu, > > On 24/01/18 20:06, gengdongjiu wrote: >>> On 06/01/18 16:02, Dongjiu Geng wrote: >>>> The ARM64 RAS SError Interrupt(SEI) syndrome value is specific to the >>>> guest and user space needs a way to tell KVM this value. So we add a >>>> new ioctl. Before user space specifies the Exception Syndrome Register >>>> ESR(ESR), it firstly checks that whether KVM has the capability to set >>>> the guest ESR, If has, will set it. Otherwise, nothing to do. >>>> >>>> For this ESR specifying, Only support for AArch64, not support AArch32. >>> >>> After this patch user-space can trigger an SError in the guest. If it wants to migrate the guest, how does the pending SError get migrated? >>> >>> I think we need to fix migration first. Andrew Jones suggested using >>> KVM_GET/SET_VCPU_EVENTS: >>> https://www.spinics.net/lists/arm-kernel/msg616846.html >>> >>> Given KVM uses kvm_inject_vabt() on v8.0 hardware too, we should cover systems without the v8.2 RAS Extensions with the same API. I >>> think this means a bit to read/write whether SError is pending, and another to indicate the ESR should be set/read. >>> CPUs without the v8.2 RAS Extensions can reject pending-SError that had an ESR. >> >> For the CPUs without the v8.2 RAS Extensions, its ESR is always 0, >> we only can inject a SError with ESR 0 to guest, cannot set its ESR. > > 0? It's always implementation-defined. On Juno it seems to be always-0, but > other systems may behave differently. (Juno may generate another ESR value when > I'm not watching it...) For the armv8.0 cpu without RAS Extensions, it does not have vsesr_el2, so when guest take a virtual SError, its ESR is 0, can not control the virtual SError's syndrom value, it does not have such registers to control that. Does Juno not have RAS Extension? if yes, I think we can only inject an SError, but can not change its ESR value, because it does not have vsesr_el2. > > Just because we can't control the ESR doesn't mean injecting an SError isn't > something user-space may want to do. yes, we may need to support user-space injects an SError even through CPU does not have RAS Extension. > If we tackle migration of pending-SError first, I think that will give us the > API to create a new pending SError with/without an ESR as appropriate. sure, we should. Last week, I checked the KVM_GET/SET_VCPU_EVENTS IOCTL, it should meet our migration requirements > > >> About how about to use the KVM_GET/SET_VCPU_EVENTS, I will check the code, and >> consider your suggestion at the same time. > > (Not my suggestion, It was Andrew Jones idea.) Got it. > >> The IOCTL KVM_GET/SET_VCPU_EVENTS has been used by X86. > > We would be re-using the struct to have values with slightly different meanings. > But for migration the upshot is the same, call KVM_GET_VCPU_EVENTS on one > system, and pass the struct to KVM_SET_VCPU_EVENTS on the new system. If we're > lucky Qemu may be able to do this in shared x86/arm64 code. > Thanks for the reminder, I know your meaning. In the x86, the kvm_vcpu_events includes exception/interrupt/nmi/smi. For the RAS, we only involves the exception, so Qemu handling logic is different. Anyway, I will try to share code for the two platform in Qemu. /* for KVM_GET/SET_VCPU_EVENTS */ struct kvm_vcpu_events { struct { __u8 injected; __u8 nr; __u8 has_error_code; __u8 pad; __u32 error_code; } exception; struct { __u8 injected; __u8 nr; __u8 soft; __u8 shadow; } interrupt; struct { __u8 injected; __u8 pending; __u8 masked; __u8 pad; } nmi; __u32 sipi_vector; __u32 flags; struct { __u8 smm; __u8 pending; __u8 smm_inside_nmi; __u8 latched_init; } smi; __u32 reserved[9]; }; > >>>> diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index >>>> 5c7f657..738ae90 100644 >>>> --- a/arch/arm64/kvm/guest.c >>>> +++ b/arch/arm64/kvm/guest.c >>>> @@ -277,6 +277,11 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, >>>> return -EINVAL; >>>> } >>>> >>>> +int kvm_arm_set_sei_esr(struct kvm_vcpu *vcpu, u32 *syndrome) { >>>> + return -EINVAL; >>>> +} >>> >>> Does nothing in the patch that adds the support? This is a bit odd. >>> (oh, its hiding in patch 6...) >> >> To make this patch simple and small, I add it in patch 6. > > But that made the functionality of this patch: A new API to return -EINVAL from > the kernel. > > Swapping the patches round would have avoided this. > Regardless, I think this will fold out in a rebase. yes, I will, thanks for your kind suggestion. > > > Thanks, > > James > > . >