Received: by 10.192.165.156 with SMTP id m28csp258153imm; Tue, 17 Apr 2018 09:39:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx48yPlDRrRaAci8ZGNIZou6Z5B9RlAx4SuBxgkk1606SHpqZlBYMDchd1mJaLFuxVX9ZqHfW X-Received: by 2002:a17:902:848e:: with SMTP id c14-v6mr2662623plo.95.1523983142409; Tue, 17 Apr 2018 09:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523983142; cv=none; d=google.com; s=arc-20160816; b=Y/fDacp0xc7MXqdNFvxHsuXz5Q4scqSoXrrlPi7wDBzobJIhTmMEf6zYUGviEsDNme oBoucMP/e6QnsDbbNPK2VtzFQwjVygyvOaHoEK7ySKBYmOZEX6MT7+JrWFe+cl/mq0fJ v9Z//Dx/826+Y9AUZ1utPT8RFaNOFchVlnUzkCKf/iluySy1pLqLaC07TDa4oNY02o/Z p1DzGCIOTrgYwNy4+4W2Al2sKQspyRDye8AGCsAZzUH5Jo9Ntb11JENf4gk6DTFoFiSf +6PIFAGc6nFJ7TOga2b8WLETxYxc048g4eNxjHtSIhffpgZpraF22J0wQVMePAsVfec9 6YPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OtZWjni0tua+Fqgg5cNw/stv83UDTz5ZyGWP+m+GDDM=; b=NULJLsrCtuT8aPXpCHj0BV0gWYQUpvvZN7tfqZ3WH7H+nEOVloLLNzAH31QP1K2sx+ TnYRtxLKLUjtovupG7+iyMclXDxB1LHow1bs/UlCTVsOe7Wa/2UbzEMzNXMXZHjkXQFo 0M1kgJi3+xyE740vvt54jSDloxKajbThZXMsVLGDCYruiuiTec5n2LWmc1h41XwBBVhp 3heeD8BfQpjNm1J6HdPIPqFPZ3zPRLKxX/ujBlCZT0MR5zU8cjK4Y3/ZD1qtSFR2xG8U QEJI/nrGlRTvq54QUct5ysVEiCrIjwuN4dZxrBj4CAd10M6YajKH5SqhN1AI1OHUfjhw FC7A== 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 p15si4215011pgv.393.2018.04.17.09.38.47; Tue, 17 Apr 2018 09:39:02 -0700 (PDT) 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 S1755218AbeDQQhQ (ORCPT + 99 others); Tue, 17 Apr 2018 12:37:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35028 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755118AbeDQQHI (ORCPT ); Tue, 17 Apr 2018 12:07:08 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A46B9C98; Tue, 17 Apr 2018 16:07:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yazen Ghannam , Borislav Petkov , Borislav Petkov , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Tony Luck , linux-edac , Ingo Molnar Subject: [PATCH 4.14 39/49] x86/mce/AMD: Get address from already initialized block Date: Tue, 17 Apr 2018 17:59:18 +0200 Message-Id: <20180417155716.895432903@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155715.032245882@linuxfoundation.org> References: <20180417155715.032245882@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yazen Ghannam commit 27bd59502702fe51d9eb00450a75b727ec6bfcb4 upstream. The block address is saved after the block is initialized when threshold_init_device() is called. Use the saved block address, if available, rather than trying to rediscover it. This will avoid a call trace, when resuming from suspend, due to the rdmsr_safe_on_cpu() call in get_block_address(). The rdmsr_safe_on_cpu() call issues an IPI but we're running with interrupts disabled. This triggers: WARNING: CPU: 0 PID: 11523 at kernel/smp.c:291 smp_call_function_single+0xdc/0xe0 Signed-off-by: Yazen Ghannam Signed-off-by: Borislav Petkov Cc: # 4.14.x Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tony Luck Cc: linux-edac Link: http://lkml.kernel.org/r/20180221101900.10326-8-bp@alien8.de Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/mcheck/mce_amd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -434,6 +434,21 @@ static u32 get_block_address(unsigned in { u32 addr = 0, offset = 0; + if ((bank >= mca_cfg.banks) || (block >= NR_BLOCKS)) + return addr; + + /* Get address from already initialized block. */ + if (per_cpu(threshold_banks, cpu)) { + struct threshold_bank *bankp = per_cpu(threshold_banks, cpu)[bank]; + + if (bankp && bankp->blocks) { + struct threshold_block *blockp = &bankp->blocks[block]; + + if (blockp) + return blockp->address; + } + } + if (mce_flags.smca) { if (smca_get_bank_type(bank) == SMCA_RESERVED) return addr;