lkml.org 
[lkml]   [2014]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/3] acpi, apei, ghes: Make NMI error notification to be GHES architecture extension.
On Tue, Jun 24, 2014 at 01:41:34PM +0200, Tomasz Nowicki wrote:
> Currently APEI depends on x86 architecture. It is because of NMI hardware
> error notification of GHES which is currently supported by x86 only.
> However, many other APEI features can be still used perfectly by other
> architectures.
>
> This commit adds two symbols:
> 1. HAVE_ACPI_APEI for those archs which support APEI.
> 2. HAVE_ACPI_APEI_NMI which is used for NMI code isolation in ghes.c
> file. NMI related data and functions are grouped so they can be wrapped
> inside one #ifdef section. Appropriate function stubs are provided for
> !NMI case.
>
> Note there is no functional changes for x86 due to hard selected
> HAVE_ACPI_APEI and HAVE_ACPI_APEI_NMI symbols.
>
> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
> ---
> arch/x86/Kconfig | 2 +
> drivers/acpi/apei/Kconfig | 8 ++-
> drivers/acpi/apei/ghes.c | 149 +++++++++++++++++++++++++++++----------------
> include/linux/nmi.h | 4 ++
> 4 files changed, 110 insertions(+), 53 deletions(-)
>

...

> @@ -894,11 +892,71 @@ static unsigned long ghes_esource_prealloc_size(
> return prealloc_size;
> }
>
> +static void ghes_estatus_pool_shrink(unsigned long len)
> +{
> + ghes_estatus_pool_size_request -= PAGE_ALIGN(len);
> +}
> +
> +static void ghes_nmi_add(struct ghes *ghes)
> +{
> + unsigned long len;
> +
> + len = ghes_esource_prealloc_size(ghes->generic);
> + ghes_estatus_pool_expand(len);
> + mutex_lock(&ghes_list_mutex);
> + if (list_empty(&ghes_nmi))
> + register_nmi_handler(NMI_LOCAL, ghes_notify_nmi, 0, "ghes");
> + list_add_rcu(&ghes->list, &ghes_nmi);
> + mutex_unlock(&ghes_list_mutex);
> +}
> +
> +static void ghes_nmi_remove(struct ghes *ghes)
> +{
> + unsigned long len;
> +
> + mutex_lock(&ghes_list_mutex);
> + list_del_rcu(&ghes->list);
> + if (list_empty(&ghes_nmi))
> + unregister_nmi_handler(NMI_LOCAL, "ghes");
> + mutex_unlock(&ghes_list_mutex);
> + /*
> + * To synchronize with NMI handler, ghes can only be
> + * freed after NMI handler finishes.
> + */
> + synchronize_rcu();
> + len = ghes_esource_prealloc_size(ghes->generic);
> + ghes_estatus_pool_shrink(len);
> +}
> +
> +static void ghes_nmi_init_cxt(void)
> +{
> + init_irq_work(&ghes_proc_irq_work, ghes_proc_in_irq);
> +}
> +#else

Markers please to know to which CONFIG_ symbol this #else refers to:

#else /* CONFIG_HAVE_ACPI_APEI_NMI */

> +static inline void ghes_nmi_add(struct ghes *ghes)
> +{
> + pr_err(GHES_PFX "ID: %d, trying to add NMI notification which is not supported!\n",
> + ghes->generic->header.source_id);
> + BUG();
> +}
> +
> +static inline void ghes_nmi_remove(struct ghes *ghes)
> +{
> + pr_err(GHES_PFX "ID: %d, trying to remove NMI notification which is not supported!\n",
> + ghes->generic->header.source_id);
> + BUG();
> +}
> +
> +static inline void ghes_nmi_init_cxt(void)
> +{
> +}
> +#endif

Ditto.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--


\
 
 \ /
  Last update: 2014-07-02 15:01    [W:0.878 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site