Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2292935imm; Thu, 7 Jun 2018 08:18:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK5MfKIVYxE8vI6PbyG5wNrwqht23KcCVyfOuZYv9YMTA3ZQn6EhV8iDTsM05DgotSypZHT X-Received: by 2002:a62:d653:: with SMTP id r80-v6mr2192782pfg.54.1528384689887; Thu, 07 Jun 2018 08:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528384689; cv=none; d=google.com; s=arc-20160816; b=J0KAz/j/7WyC/AclRggoMrtLv74L5oAeK45ZGCDrGjmAxCefSn+koQ8QVBs+WGzNt2 e2e9WMFfB2LpvEIwoE8d2A35xkuj+2NfBAs1J3sVPDn845qFThzC1Ea79JMTrmomQ/eG ldPrrMWpObTknITyQ4cTSqx+s4t/Qo/H5huvsH3sO/9RAHnPYAylER/u+whEvzvxvHfB XTCqeV4u4HAm048B77srIjEmn2XDuhqcbhA2XWY6zQEjHKC2fDmbWPOiYLv9v/F1zAhA FR23kz65UtKBbTa2J6ruDDTFMJ1CEpRxdZ7nENytymqWe4gwsLCBMK6d0UdnqbM2DZLF gNuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=6RAay2OapvtKlgt9N9WoY+k3KLuF6lvrN0p9N1Vy8l0=; b=vupJSzcaookqTEvPfokl5RhVD2hBlGxjX/lYGPBIcte1EgGUktO1fDRXD+7jjVRQOg K9vgovNiI9o2VJuNmTiaRPhTePmVsl5YW85qZ0NTJruQLpHKHMZ0DsKRoXmbZJ4cckyi oZyI0N9HppNMuPzMarOkAVE6yLt/Wrf76vRaUbfkswOZeXln7qAP9706RyhMbSw/LQ0M M/jEzJJJyEbaVMVXvwHE8fuzsKseLX2TmEd2/PXP+Fo3HkDzzXPARiX3SwWe5l0hNM3P uYjNmyE/3UJYFwzOpeu8bhCrA3qGMS/E1cbtMBQltQMSooAtO21u7Yx7TYqqmAqa5NGA UZ3w== 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 z14-v6si12746671pgr.4.2018.06.07.08.17.54; Thu, 07 Jun 2018 08:18:09 -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 S935580AbeFGPQv (ORCPT + 99 others); Thu, 7 Jun 2018 11:16:51 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41358 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935010AbeFGPAs (ORCPT ); Thu, 7 Jun 2018 11:00:48 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbQ-0005dI-HW; Thu, 07 Jun 2018 15:09:25 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvbC-0003Cj-6C; Thu, 07 Jun 2018 15:09:10 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Yazen Ghannam" , "Borislav Petkov" , "linux-edac" , "Thomas Gleixner" , "Tony Luck" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 335/410] x86/MCE: Save microcode revision in machine check records In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Tony Luck commit fa94d0c6e0f3431523f5701084d799c77c7d4a4f upstream. Updating microcode used to be relatively rare. Now that it has become more common we should save the microcode version in a machine check record to make sure that those people looking at the error have this important information bundled with the rest of the logged information. [ Borislav: Simplify a bit. ] Signed-off-by: Tony Luck Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Cc: Yazen Ghannam Cc: linux-edac Link: http://lkml.kernel.org/r/20180301233449.24311-1-tony.luck@intel.com [bwh: Backported to 3.2: - Add other new fields to struct mce, to match upstream UAPI - Adjust context] Signed-off-by: Ben Hutchings --- --- a/arch/x86/include/uapi/asm/mce.h +++ b/arch/x86/include/uapi/asm/mce.h @@ -25,6 +25,10 @@ struct mce { __u32 socketid; /* CPU socket ID */ __u32 apicid; /* CPU initial apic ID */ __u64 mcgcap; /* MCGCAP MSR: machine check capabilities of CPU */ + __u64 synd; /* MCA_SYND MSR: only valid on SMCA systems */ + __u64 ipid; /* MCA_IPID MSR: only valid on SMCA systems */ + __u64 ppin; /* Protected Processor Inventory Number */ + __u32 microcode;/* Microcode revision */ }; #define MCE_GET_RECORD_LEN _IOR('M', 1, int) --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -135,6 +135,8 @@ void mce_setup(struct mce *m) m->socketid = cpu_data(m->extcpu).phys_proc_id; m->apicid = cpu_data(m->extcpu).initial_apicid; rdmsrl(MSR_IA32_MCG_CAP, m->mcgcap); + + m->microcode = boot_cpu_data.microcode; } DEFINE_PER_CPU(struct mce, injectm); @@ -282,7 +284,7 @@ static void print_mce(struct mce *m) */ pr_emerg(HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x microcode %x\n", m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid, - cpu_data(m->extcpu).microcode); + m->microcode); /* * Print out human-readable details about the MCE error,