From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755251AbdEHRlN (ORCPT ); Mon, 8 May 2017 13:41:13 -0400 Received: from mail.skyhub.de ([5.9.137.197]:55522 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750869AbdEHRlK (ORCPT ); Mon, 8 May 2017 13:41:10 -0400 Date: Mon, 8 May 2017 19:40:58 +0200 From: Borislav Petkov To: Tyler Baicar Cc: christoffer.dall@linaro.org, marc.zyngier@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, matt@codeblueprint.co.uk, robert.moore@intel.com, lv.zheng@intel.com, nkaje@codeaurora.org, zjzhang@codeaurora.org, mark.rutland@arm.com, james.morse@arm.com, akpm@linux-foundation.org, eun.taik.lee@samsung.com, sandeepa.s.prabhu@gmail.com, labbott@redhat.com, shijie.huang@arm.com, rruigrok@codeaurora.org, paul.gortmaker@windriver.com, tn@semihalf.com, fu.wei@linaro.org, rostedt@goodmis.org, bristot@redhat.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-efi@vger.kernel.org, devel@acpica.org, Suzuki.Poulose@arm.com, punit.agrawal@arm.com, astone@redhat.com, harba@codeaurora.org, hanjun.guo@linaro.org, john.garry@huawei.com, shiju.jose@huawei.com, joe@perches.com, rafael@kernel.org, tony.luck@intel.com, gengdongjiu@huawei.com, xiexiuqi@huawei.com Subject: Re: [PATCH V15 11/11] arm/arm64: KVM: add guest SEA support Message-ID: <20170508174058.5hbujeblxq5z6iwa@pd.tnic> References: <1492556723-9189-1-git-send-email-tbaicar@codeaurora.org> <1492556723-9189-12-git-send-email-tbaicar@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1492556723-9189-12-git-send-email-tbaicar@codeaurora.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 18, 2017 at 05:05:23PM -0600, 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. > > When an SEA occurs in the guest kernel, the guest exits and is > routed to kvm_handle_guest_abort(). Prior to this patch, a print > message of an unsupported FSC would be printed and nothing else > would happen. With this patch, the code gets routed to the APEI > handling of SEAs in the host kernel to report the SEA information. > > Signed-off-by: Tyler Baicar > Acked-by: Catalin Marinas > Acked-by: Marc Zyngier > Acked-by: Christoffer Dall ... > diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c > index 582a972..fd11855 100644 > --- a/arch/arm/kvm/mmu.c > +++ b/arch/arm/kvm/mmu.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > > #include "trace.h" > > @@ -1418,6 +1419,24 @@ static void handle_access_fault(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa) > kvm_set_pfn_accessed(pfn); > } > > +static bool is_abort_sea(unsigned long fault_status) { ERROR: open brace '{' following function declarations go on the next line #107: FILE: arch/arm/kvm/mmu.c:1422: +static bool is_abort_sea(unsigned long fault_status) { ... > @@ -611,6 +612,24 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs) > }; > > /* > + * Handle Synchronous External Aborts that occur in a guest kernel. > + * > + * The return value will be zero if the SEA was successfully handled > + * and non-zero if there was an error processing the error or there was > + * no error to process. > + */ > +int handle_guest_sea(phys_addr_t addr, unsigned int esr) > +{ > + int ret = -ENOENT; > + > + if (IS_ENABLED(CONFIG_ACPI_APEI_SEA)) { > + ret = ghes_notify_sea(); > + } WARNING: braces {} are not necessary for single statement blocks #239: FILE: arch/arm64/mm/fault.c:625: + if (IS_ENABLED(CONFIG_ACPI_APEI_SEA)) { + ret = ghes_notify_sea(); + } > + > + return ret; > +} > + > +/* > * Dispatch a data abort to the relevant handler. > */ > asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr, > diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c > index 612deb3..d286248 100644 > --- a/drivers/acpi/apei/ghes.c > +++ b/drivers/acpi/apei/ghes.c > @@ -812,17 +812,18 @@ static int ghes_notify_sci(struct notifier_block *this, > #ifdef CONFIG_ACPI_APEI_SEA > static LIST_HEAD(ghes_sea); > > -void ghes_notify_sea(void) > +int ghes_notify_sea(void) > { > struct ghes *ghes; > + int ret = -ENOENT; > > - /* > - * synchronize_rcu() will wait for nmi_exit(), so no need to > - * rcu_read_lock(). > - */ > + rcu_read_lock(); > list_for_each_entry_rcu(ghes, &ghes_sea, list) { > - ghes_proc(ghes); > + if(!ghes_proc(ghes)) > + ret = 0; What is the idea here: the first time ghes_proc() returns 0, ret is set to 0 and all errors after it will be practically ignored. Looks like it needs more love. Also: ERROR: space required before the open parenthesis '(' #271: FILE: drivers/acpi/apei/ghes.c:822: + if(!ghes_proc(ghes)) Please integrate scripts/checkpatch.pl in your patch creation workflow. Some of the warnings/errors *actually* make sense. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.