From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752851AbbETKgQ (ORCPT ); Wed, 20 May 2015 06:36:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33972 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752598AbbETKgN (ORCPT ); Wed, 20 May 2015 06:36:13 -0400 Date: Wed, 20 May 2015 12:36:10 +0200 From: Borislav Petkov To: "Chen, Gong" 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 Message-ID: <20150520103610.GC3645@pd.tnic> References: <1432150538-3120-1-git-send-email-gong.chen@linux.intel.com> <1432150538-3120-2-git-send-email-gong.chen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1432150538-3120-2-git-send-email-gong.chen@linux.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Link: http://lkml.kernel.org/r/1407830375-11087-1-git-send-email-gong.chen@linux.intel.com > [Boris: rewrite. ] > Signed-off-by: Borislav Petkov > --- > 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. --