Received: by 10.223.176.5 with SMTP id f5csp2024371wra; Thu, 8 Feb 2018 07:17:07 -0800 (PST) X-Google-Smtp-Source: AH8x2268uWVkbd7a+aO0JZuJ/2cfof9Z5OcpnegAIB/CnE6ooDyPPL447Gic7p7i7g33ExrjGbIX X-Received: by 10.99.176.69 with SMTP id z5mr779663pgo.74.1518103026901; Thu, 08 Feb 2018 07:17:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518103026; cv=none; d=google.com; s=arc-20160816; b=tjG5n05a/d8zo8sGhbT3vPikMDZStaYIU9atsABljs3MWNdyXS94LOVNdYr0FViUOv xPB57knYdvdqIKVm+2RYnUFZN4iQCxa7RWtLM2qFLUkIBFtrk8qsfHhIhW+dNY/gClKo AEmsKj7fw1bBjk27sbgQGL9Jyb7AJuGo6xAnhOtvOPlOnWo5+bfghGgPWqRKme2qwCQh NrOo2dOMCM4UtXN536jTdxldDOBzI1dwRzU7OGQZqei7LAGcNz+ChTQdaUfnqlTJpWrq 3K6MIVGQy9k4/Z6K1tgwUZSOw0xk2xWn4onC5yir6Cviy9hjG/LFJJ9ieYfn5TCkbMag MBvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=UOQAVNKPvVvBYOnGXA5lXITChodsZO8COr+FP3sWHBg=; b=XdC2woC6jGyd069+hl5akjzioN/UK2el/hrCZy4PntBCZUj+nryqqg6Cai3MJ3CAeA y7Fathr80Z2MQqYS6rSVLl8+EvUWSq9OAOAW+6LysleHarhR28ypIs4p47Dnl8WubrFF rwkMWWGSBE9J2o/lQFq5helpRLsXgqT9ZoYTzimqCsMpY3wft9XkaA3zxywfAEo2yoG+ UeEjMormqIV/UUdh96g/auSXmHDdIhMfpNN70XfHsxWaZpAlRefFmiRxL14DHFNaxE7G mk6F+JtVzbWSMF/uL9awM//JGFttS+fOqQeJ3ITcrolZ798G2x4DzpnKhmF2wXE1CptR Z7aA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r29si117943pfj.102.2018.02.08.07.16.51; Thu, 08 Feb 2018 07:17:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752117AbeBHPP3 (ORCPT + 99 others); Thu, 8 Feb 2018 10:15:29 -0500 Received: from mail.skyhub.de ([5.9.137.197]:49538 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963AbeBHPP2 (ORCPT ); Thu, 8 Feb 2018 10:15:28 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Um_PBq2P7-pK; Thu, 8 Feb 2018 16:15:26 +0100 (CET) Received: from pd.tnic (p200300EC2BCCF10078C005B42741A0DC.dip0.t-ipconnect.de [IPv6:2003:ec:2bcc:f100:78c0:5b4:2741:a0dc]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 935841EC0104; Thu, 8 Feb 2018 16:15:26 +0100 (CET) Date: Thu, 8 Feb 2018 16:15:07 +0100 From: Borislav Petkov To: Yazen Ghannam Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, bp@suse.de, tony.luck@intel.com, x86@kernel.org Subject: Re: [PATCH 2/3] x86/MCE/AMD, EDAC/mce_amd: Enumerate Reserved SMCA bank type Message-ID: <20180208151507.GE7964@pd.tnic> References: <20180201184813.82253-1-Yazen.Ghannam@amd.com> <20180201184813.82253-2-Yazen.Ghannam@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180201184813.82253-2-Yazen.Ghannam@amd.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 01, 2018 at 12:48:12PM -0600, Yazen Ghannam wrote: > From: Yazen Ghannam > > Currently, bank 4 is reserved on Fam17h, so we chose not to initialize > bank 4 in the smca_banks array. This means that when we check if a bank > is initialized, like during boot or resume, we will see that bank 4 is > not initialized and try to initialize it. This may cause a call trace, > when resuming from suspend, due to *on_cpu() calls in the init path. Please be more specific: the rdmsr_*_on_cpu() calls issue an IPI but we're running with interrupts disabled, which triggers: WARNING: CPU: 0 PID: 11523 at kernel/smp.c:291 smp_call_function_single+0xdc/0xe0 > Reserved banks will be read-as-zero, so their MCA_IPID register will be > zero. So, like the smca_banks array, the threshold_banks array will not > have an entry for a reserved bank since all its MCA_MISC* registers will > be zero. > > Enumerate a "Reserved" bank type that matches on a HWID_MCATYPE of 0,0. > > Use the "Reserved" type when checking if a bank is reserved. It's > possible that other bank numbers may be reserved on future systems. > > Don't try to find the block address on reserved banks. > > Cc: # 4.14.x > Signed-off-by: Yazen Ghannam > --- > arch/x86/include/asm/mce.h | 1 + > arch/x86/kernel/cpu/mcheck/mce_amd.c | 7 +++++++ > drivers/edac/mce_amd.c | 11 +++++++---- > 3 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h > index 96ea4b5ba658..340070415c2c 100644 > --- a/arch/x86/include/asm/mce.h > +++ b/arch/x86/include/asm/mce.h > @@ -346,6 +346,7 @@ enum smca_bank_types { > SMCA_IF, /* Instruction Fetch */ > SMCA_L2_CACHE, /* L2 Cache */ > SMCA_DE, /* Decoder Unit */ > + SMCA_RESERVED, /* Reserved */ > SMCA_EX, /* Execution Unit */ > SMCA_FP, /* Floating Point */ > SMCA_L3_CACHE, /* L3 Cache */ > diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c > index 4e16afc0794d..bf53b4549a17 100644 > --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c > +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c > @@ -82,6 +82,7 @@ static struct smca_bank_name smca_names[] = { > [SMCA_IF] = { "insn_fetch", "Instruction Fetch Unit" }, > [SMCA_L2_CACHE] = { "l2_cache", "L2 Cache" }, > [SMCA_DE] = { "decode_unit", "Decode Unit" }, > + [SMCA_RESERVED] = { "reserved", "Reserved" }, > [SMCA_EX] = { "execution_unit", "Execution Unit" }, > [SMCA_FP] = { "floating_point", "Floating Point Unit" }, > [SMCA_L3_CACHE] = { "l3_cache", "L3 Cache" }, > @@ -127,6 +128,9 @@ static enum smca_bank_types smca_get_bank_type(unsigned int bank) > static struct smca_hwid smca_hwid_mcatypes[] = { > /* { bank_type, hwid_mcatype, xec_bitmap } */ > > + /* Reserved type */ > + { SMCA_RESERVED, HWID_MCATYPE(0x00, 0x0), 0x0 }, > + > /* ZN Core (HWID=0xB0) MCA types */ > { SMCA_LS, HWID_MCATYPE(0xB0, 0x0), 0x1FFFEF }, > { SMCA_IF, HWID_MCATYPE(0xB0, 0x1), 0x3FFF }, > @@ -433,6 +437,9 @@ static u32 get_block_address(unsigned int cpu, u32 current_addr, u32 low, u32 hi > u32 addr = 0, offset = 0; > > if (mce_flags.smca) { As a last patch in the series: please carve the code in this if-statement into a smca_get_block_address() helper. And it doesn't need the stable tag as it is only a cleanup. Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.