From: "Baicar, Tyler" <tbaicar@codeaurora.org>
To: James Morse <james.morse@arm.com>
Cc: linux-efi@vger.kernel.org, kvm@vger.kernel.org,
matt@codeblueprint.co.uk, catalin.marinas@arm.com,
will.deacon@arm.com, robert.moore@intel.com,
paul.gortmaker@windriver.com, lv.zheng@intel.com,
kvmarm@lists.cs.columbia.edu, fu.wei@linaro.org,
zjzhang@codeaurora.org, linux@armlinux.org.uk,
linux-acpi@vger.kernel.org, eun.taik.lee@samsung.com,
shijie.huang@arm.com, labbott@redhat.com, lenb@kernel.org,
harba@codeaurora.org, john.garry@huawei.com,
marc.zyngier@arm.com, punit.agrawal@arm.com, rostedt@goodmis.org,
nkaje@codeaurora.org, sandeepa.s.prabhu@gmail.com,
linux-arm-kernel@lists.infradead.org, devel@acpica.org,
rjw@rjwysocki.net, rruigrok@codeaurora.org,
linux-kernel@vger.kernel.org, astone@redhat.com,
hanjun.guo@linaro.org, joe@perches.com, pbonzini@redhat.com,
akpm@linux-foundation.org, bristot@redhat.com,
shiju.jose@huawei.com
Subject: Re: [PATCH V12 10/10] arm/arm64: KVM: add guest SEA support
Date: Fri, 10 Mar 2017 11:15:29 -0700 [thread overview]
Message-ID: <9e2dee3d-afb3-72f6-a8f2-4fa090e87ee8@codeaurora.org> (raw)
In-Reply-To: <58C02CA2.4030601@arm.com>
Hello James,
On 3/8/2017 9:09 AM, James Morse wrote:
> On 07/03/17 17:58, Baicar, Tyler wrote:
>> On 3/7/2017 4:48 AM, James Morse wrote:
>>> On 06/03/17 20:45, Tyler Baicar wrote:
>>>> Currently external aborts are unsupported by the guest abort
>>>> handling. Add handling for SEAs so that the host kernel reports
>>>> SEAs which occur in the guest kernel.
>>>> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
>>>> index a5265ed..f3608c9 100644
>>>> --- a/arch/arm/kvm/mmu.c
>>>> +++ b/arch/arm/kvm/mmu.c
>>>> @@ -1444,8 +1463,21 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu,
>>>> struct kvm_run *run)
>>>> /* Check the stage-2 fault is trans. fault or write fault */
>>>> fault_status = kvm_vcpu_trap_get_fault_type(vcpu);
>>>> - if (fault_status != FSC_FAULT && fault_status != FSC_PERM &&
>>>> - fault_status != FSC_ACCESS) {
>>>> +
>>>> + /* The host kernel will handle the synchronous external abort. There
>>>> + * is no need to pass the error into the guest.
>>>> + */
>>>> + if (is_abort_synchronous(fault_status)) {
>>>> + if(handle_guest_sea((unsigned long)fault_ipa,
>>>> + kvm_vcpu_get_hsr(vcpu))) {
>>> ... Looking further up in this function:
>>>> is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
>>>> if (unlikely(!is_iabt && kvm_vcpu_dabt_isextabt(vcpu))) {
>>>> kvm_inject_vabt(vcpu);
>>>> return 1;
>>>> }
>>> ... so external data aborts will have already been 'claimed' by kvm and dealt
>>> with, and we already have a helper for spotting external aborts. (sorry I didn't
>>> spot it earlier).
>>>
>>> We need to do the handle_guest_sea() before this code.
>>>
>>> kvm_inject_vabt() makes an SError interrupt pending for the guest. This makes a
>>> synchronous error asynchronous as the guest may have SError interrupts masked.
>>>
>>> I guess this was the best that could be done at the time of (4055710baca8
>>> "arm/arm64: KVM: Inject virtual abort when guest exits on external abort"), but
>>> in the light of this firmware-first handling, I'm not sure its the right thing
>>> to do.
>>>
>>> Is it possible for handle_guest_sea() to return whether it actually found any
>>> work to do? If there was none I think we should keep this kvm_inject_vabt() as
>>> it is the existing behaviour.
>> Yes, I'll move the handle_guest_sea() call above this. My testing didn't call
>> into that if statement for some reason...it made it to the handle_guest_sea()
>> call successfully.
> I guess you're not using data aborts for testing then.
>
>
>> If there is no work for the GHES code to do it will return and could still make
>> the kvm_inject_vabt() call. It will also return and do that same thing if the
>> error was not fatal in GHES...would that be an issue?
> We might inject a superfluous SError Interrupt in that case.
>
> For memory errors we may do the whole unmapping and signalling thing to handle
> the fault. For recoverable faults, QEMU can generate its own CPER records for
> the guest and do the work to notify the guest. Everything looks fine until the
> guest gets the extra SError interrupt.
>
> If there is firmware-first RAS data, we should skip the injected SError
> Interrupt as the host's RAS code should choose what to do. If this Synchronous
> External Abort was nothing to do with RAS, we should inject the SError interrupt
> as it's the existing behaviour, and not all platforms will have this Synchronous
> External Abort mechanism.
>
> x86's APEI NMI needs to know if the NMI was due to RAS, so we can probably
> borrow the same trick. ghes_notify_nmi() calls ghes_read_estatus() for each
> struct ghes. If they all return an error, there was no work to do.
>
>
> (I assume firmware will only generate one of these at a time, so there is no
> risk of one list-walker processing two entries, then the second finding nothing
> to do?)
>
Okay, I will add in this functionality to avoid injecting an SEI if
there is actually a GHES error populated.
Firmware that supports the new specs should only generate one of these
at a time, it will wait for the ack from kernel before sending a second
error (patch 1 of this series).
Thanks,
Tyler
>
>
>>>> + kvm_err("Failed to handle guest SEA, FSC: EC=%#x xFSC=%#lx
>>>> ESR_EL2=%#lx\n",
>>>> + kvm_vcpu_trap_get_class(vcpu),
>>>> + (unsigned long)kvm_vcpu_trap_get_fault(vcpu),
>>>> + (unsigned long)kvm_vcpu_get_hsr(vcpu));
>>>> + return -EFAULT;
>>>> + }
>>>> + } else if (fault_status != FSC_FAULT && fault_status != FSC_PERM &&
>>>> + fault_status != FSC_ACCESS) {
>>>> kvm_err("Unsupported FSC: EC=%#x xFSC=%#lx ESR_EL2=%#lx\n",
>>>> kvm_vcpu_trap_get_class(vcpu),
>>>> (unsigned long)kvm_vcpu_trap_get_fault(vcpu),
--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2017-03-10 18:15 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-06 20:44 [PATCH V12 00/10] Add UEFI 2.6 and ACPI 6.1 updates for RAS on ARM64 Tyler Baicar
2017-03-06 20:44 ` [PATCH V12 01/10] acpi: apei: read ack upon ghes record consumption Tyler Baicar
2017-03-06 20:44 ` [PATCH V12 02/10] ras: acpi/apei: cper: generic error data entry v3 per ACPI 6.1 Tyler Baicar
2017-03-06 20:44 ` [PATCH V12 03/10] efi: parse ARM processor error Tyler Baicar
2017-03-06 20:44 ` [PATCH V12 04/10] arm64: exception: handle Synchronous External Abort Tyler Baicar
2017-03-06 20:44 ` [PATCH V12 05/10] acpi: apei: handle SEA notification type for ARMv8 Tyler Baicar
[not found] ` <1488833103-21082-6-git-send-email-tbaicar-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-03-07 11:37 ` James Morse
2017-03-07 16:40 ` Baicar, Tyler
2017-03-17 16:43 ` James Morse
2017-03-21 19:19 ` Baicar, Tyler
2017-03-06 20:44 ` [PATCH V12 06/10] acpi: apei: panic OS with fatal error status block Tyler Baicar
2017-03-06 20:45 ` [PATCH V12 07/10] efi: print unrecognized CPER section Tyler Baicar
2017-03-06 21:05 ` Joe Perches
2017-03-07 16:39 ` Baicar, Tyler
2017-03-06 20:45 ` [PATCH V12 08/10] ras: acpi / apei: generate trace event for " Tyler Baicar
2017-03-06 20:45 ` [PATCH V12 09/10] trace, ras: add ARM processor error trace event Tyler Baicar
2017-03-09 9:41 ` Xie XiuQi
2017-03-10 18:23 ` Baicar, Tyler
[not found] ` <14545228-7ff1-b31c-1fa5-daacf89a44b9-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-03-13 2:31 ` Xie XiuQi
2017-03-13 9:00 ` Xie XiuQi
2017-03-13 13:58 ` Steven Rostedt
2017-03-14 9:35 ` Xie XiuQi
[not found] ` <58C60485.2070509-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-03-14 19:29 ` Baicar, Tyler
2017-03-06 20:45 ` [PATCH V12 10/10] arm/arm64: KVM: add guest SEA support Tyler Baicar
2017-03-07 11:48 ` James Morse
2017-03-07 17:58 ` Baicar, Tyler
2017-03-08 16:09 ` James Morse
2017-03-10 18:15 ` Baicar, Tyler [this message]
2017-03-07 11:37 ` [PATCH V12 00/10] Add UEFI 2.6 and ACPI 6.1 updates for RAS on ARM64 James Morse
2017-03-07 16:37 ` Baicar, Tyler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e2dee3d-afb3-72f6-a8f2-4fa090e87ee8@codeaurora.org \
--to=tbaicar@codeaurora.org \
--cc=akpm@linux-foundation.org \
--cc=astone@redhat.com \
--cc=bristot@redhat.com \
--cc=catalin.marinas@arm.com \
--cc=devel@acpica.org \
--cc=eun.taik.lee@samsung.com \
--cc=fu.wei@linaro.org \
--cc=hanjun.guo@linaro.org \
--cc=harba@codeaurora.org \
--cc=james.morse@arm.com \
--cc=joe@perches.com \
--cc=john.garry@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=labbott@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lv.zheng@intel.com \
--cc=marc.zyngier@arm.com \
--cc=matt@codeblueprint.co.uk \
--cc=nkaje@codeaurora.org \
--cc=paul.gortmaker@windriver.com \
--cc=pbonzini@redhat.com \
--cc=punit.agrawal@arm.com \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@intel.com \
--cc=rostedt@goodmis.org \
--cc=rruigrok@codeaurora.org \
--cc=sandeepa.s.prabhu@gmail.com \
--cc=shijie.huang@arm.com \
--cc=shiju.jose@huawei.com \
--cc=will.deacon@arm.com \
--cc=zjzhang@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).