public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@suse.de>
To: "Chen, Gong" <gong.chen@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, tony.luck@intel.com
Subject: Re: [PATCH 1/4 Rebase] x86, MCE: Provide a lock-less memory pool to save error record
Date: Wed, 20 May 2015 12:36:10 +0200	[thread overview]
Message-ID: <20150520103610.GC3645@pd.tnic> (raw)
In-Reply-To: <1432150538-3120-2-git-send-email-gong.chen@linux.intel.com>

On Wed, May 20, 2015 at 03:35:35PM -0400, Chen, Gong wrote:
> printk is not safe to use in MCE context. Add a lockless memory
> allocator pool to save error records in MCE context. Issual of those
> records will be delayed to a context safe to do printk. This idea is
> inspired by APEI/GHES driver.
> 
> We're very conservative and allocate only two pages for it but since
> we're going to use those pages throughout the system's lifetime, we
> allocate them statically to avoid early boot time allocation woes.
> 
> Signed-off-by: Chen, Gong <gong.chen@linux.intel.com>
> Link: http://lkml.kernel.org/r/1407830375-11087-1-git-send-email-gong.chen@linux.intel.com
> [Boris: rewrite. ]
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
>  arch/x86/Kconfig                          |   1 +
>  arch/x86/include/uapi/asm/mce.h           |   3 +-
>  arch/x86/kernel/cpu/mcheck/Makefile       |   2 +-
>  arch/x86/kernel/cpu/mcheck/mce-genpool.c  | 102 ++++++++++++++++++++++++++++++
>  arch/x86/kernel/cpu/mcheck/mce-internal.h |  12 ++++
>  arch/x86/kernel/cpu/mcheck/mce.c          |   8 ++-
>  6 files changed, 125 insertions(+), 3 deletions(-)
>  create mode 100644 arch/x86/kernel/cpu/mcheck/mce-genpool.c

Applied, thanks...

> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index e535533d5ab8..ba91777a7ad8 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -115,7 +115,7 @@ static void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs);
>   * CPU/chipset specific EDAC code can register a notifier call here to print
>   * MCE errors in a human-readable form.
>   */
> -static ATOMIC_NOTIFIER_HEAD(x86_mce_decoder_chain);
> +ATOMIC_NOTIFIER_HEAD(x86_mce_decoder_chain);
>  
>  /* Do initial initialization of a struct mce */
>  void mce_setup(struct mce *m)
> @@ -1688,6 +1688,12 @@ void mcheck_cpu_init(struct cpuinfo_x86 *c)
>  	if (mca_cfg.disabled)
>  		return;
>  
> +	if (mce_genpool_init()) {
> +		mca_cfg.disabled = true;
> +		pr_emerg("Couldn't allocate MCE records pool!\n");
> +		return;
> +	}
> +
>  	if (__mcheck_cpu_ancient_init(c))
>  		return;

... and moved this pool initialization right before we assign
machine_check_vector so that we don't do it unnecessarily if we return
earlier due to missing MCA features/MCA not enabled.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

  reply	other threads:[~2015-05-20 10:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20 19:35 MCE ring buffer management (Rebase) Chen, Gong
2015-05-20 19:35 ` [PATCH 1/4 Rebase] x86, MCE: Provide a lock-less memory pool to save error record Chen, Gong
2015-05-20 10:36   ` Borislav Petkov [this message]
2015-05-22 21:06     ` Chen, Gong
2015-05-22  8:17       ` Borislav Petkov
2015-05-20 19:35 ` [PATCH 2/4 Rebase] x86, MCE: Don't use percpu for MCE workqueue/irq_work Chen, Gong
2015-05-20 19:35 ` [PATCH 3/4 Rebase] x86, MCE: Remove mce_ring for SRAO error Chen, Gong
2015-05-20 19:35 ` [PATCH 4/4 Rebase] x86, MCE: Avoid potential deadlock in MCE context Chen, Gong
2015-05-20  9:28   ` Borislav Petkov
2015-05-22 21:12     ` Chen, Gong
2015-05-22  9:09       ` Borislav Petkov
2015-06-08 13:41         ` Borislav Petkov
2015-06-08 20:03           ` Luck, Tony
2015-06-08 20:26             ` Borislav Petkov
2015-06-11  8:27               ` Borislav Petkov

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=20150520103610.GC3645@pd.tnic \
    --to=bp@suse.de \
    --cc=gong.chen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    /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