From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 05/11] arm64: KVM/mm: Move SEA handling behind a single 'claim' interface
Date: Wed, 28 Mar 2018 17:30:07 +0100 [thread overview]
Message-ID: <b9f16902-1aed-bcbb-3e13-d852c766baef@arm.com> (raw)
In-Reply-To: <08744114-27c0-dc8c-0943-df3dcb80f4a6@arm.com>
Hi Marc,
On 26/03/18 18:49, Marc Zyngier wrote:
> On 22/03/18 18:14, James Morse wrote:
>> To ensure APEI always takes the same locks when processing a notification
>> we need the nmi-like callers to always call APEI in_nmi(). Add a helper
>> to do the work and claim the notification.
>>
>> When KVM or the arch code takes an exception that might be a RAS
>> notification, it asks the APEI firmware-first code whether it wants
>> to claim the exception. We can then go on to see if (a future)
>> kernel-first mechanism wants to claim the notification, before
>> falling through to the existing default behaviour.
>>
>> The NOTIFY_SEA code was merged before we had multiple, possibly
>> interacting, NMI-like notifications and the need to consider kernel
>> first in the future. Make the 'claiming' behaviour explicit.
>>
>> As we're restructuring the APEI code to allow multiple NMI-like
>> notifications, any notification that might interrupt interrupts-masked
>> code must always be wrapped in nmi_enter()/nmi_exit(). This allows APEI
>> to use in_nmi() to choose between the raw/regular spinlock routines.
>>
>> We mask SError over this window to prevent an asynchronous RAS error
>> arriving and tripping 'nmi_enter()'s BUG_ON(in_nmi()).
>> diff --git a/arch/arm64/include/asm/kvm_ras.h b/arch/arm64/include/asm/kvm_ras.h
>> index 5f72b07b7912..9d52bc333110 100644
>> --- a/arch/arm64/include/asm/kvm_ras.h
>> +++ b/arch/arm64/include/asm/kvm_ras.h
>> @@ -4,8 +4,26 @@
>> #ifndef __ARM64_KVM_RAS_H__
>> #define __ARM64_KVM_RAS_H__
>>
>> +#include <linux/acpi.h>
>> +#include <linux/errno.h>
>> #include <linux/types.h>
>>
>> -int kvm_handle_guest_sea(phys_addr_t addr, unsigned int esr);
>> +#include <asm/acpi.h>
>> +
>> +/*
>> + * Was this synchronous external abort a RAS notification?
>> + * Returns '0' for errors handled by some RAS subsystem, or -ENOENT.
>> + *
>> + * Call with irqs unmaksed.
Self-Nit: unmasked.
>> + */
>> +static inline int kvm_handle_guest_sea(phys_addr_t addr, unsigned int esr)
>> +{
>> + int ret = -ENOENT;
>> +
>> + if (IS_ENABLED(CONFIG_ACPI_APEI_SEA))
>> + ret = apei_claim_sea(NULL);
>
> Nit: it is a bit odd to see this "IS_ENABLED(CONFIG_ACPI_APEI_SEA)"
> check both in this function and in the only other function this calls
> (apei_claim_sea). Could this somehow be improved by having a dummy
> apei_claim_sea if CONFIG_ACPI_APEI doesn't exist?
Good point. Your suggestion also avoids more #ifdefs in the C file, which is
what I was trying to avoid.
>> +
>> + return ret;
>> +}
>>
>> #endif /* __ARM64_KVM_RAS_H__ */
> Otherwise:
>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Thanks!
James
next prev parent reply other threads:[~2018-03-28 16:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 18:14 [PATCH v2 00/11] APEI in_nmi() rework and arm64 SDEI wire-up James Morse
2018-03-22 18:14 ` [PATCH v2 01/11] ACPI / APEI: Move the estatus queue code up, and under its own ifdef James Morse
2018-03-22 18:14 ` [PATCH v2 02/11] ACPI / APEI: Generalise the estatus queue's add/remove and notify code James Morse
2018-03-22 18:14 ` [PATCH v2 03/11] ACPI / APEI: Switch NOTIFY_SEA to use the estatus queue James Morse
2018-03-22 18:14 ` [PATCH v2 04/11] KVM: arm/arm64: Add kvm_ras.h to collect kvm specific RAS plumbing James Morse
2018-03-26 15:11 ` Marc Zyngier
2018-03-22 18:14 ` [PATCH v2 05/11] arm64: KVM/mm: Move SEA handling behind a single 'claim' interface James Morse
2018-03-26 17:49 ` Marc Zyngier
2018-03-28 16:30 ` James Morse [this message]
2018-03-22 18:14 ` [PATCH v2 06/11] ACPI / APEI: Make the nmi_fixmap_idx per-ghes to allow multiple in_nmi() users James Morse
2018-03-22 18:14 ` [PATCH v2 07/11] ACPI / APEI: Split fixmap pages for arm64 NMI-like notifications James Morse
2018-03-22 18:14 ` [PATCH v2 08/11] firmware: arm_sdei: Add ACPI GHES registration helper James Morse
2018-03-25 1:41 ` kbuild test robot
2018-03-28 16:33 ` James Morse
2018-03-22 18:14 ` [PATCH v2 09/11] ACPI / APEI: Add support for the SDEI GHES Notification type James Morse
2018-03-22 18:14 ` [PATCH v2 10/11] mm/memory-failure: increase queued recovery work's priority James Morse
2018-03-22 18:14 ` [PATCH v2 11/11] arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work James Morse
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=b9f16902-1aed-bcbb-3e13-d852c766baef@arm.com \
--to=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).