From patchwork Sat Jan 30 00:35:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Luck X-Patchwork-Id: 8169091 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 43796BEEE5 for ; Sat, 30 Jan 2016 00:35:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7365A20361 for ; Sat, 30 Jan 2016 00:35:39 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9DFF72017D for ; Sat, 30 Jan 2016 00:35:38 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 91EF51A249E; Fri, 29 Jan 2016 16:35:38 -0800 (PST) X-Original-To: linux-nvdimm@ml01.01.org Delivered-To: linux-nvdimm@ml01.01.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 464801A249E for ; Fri, 29 Jan 2016 16:35:37 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id l66so206045wml.2 for ; Fri, 29 Jan 2016 16:35:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=n6rsSbb2Iv/ai/XzK4HJ7Nvafgwd9BJ5CXpsZX8wHaw=; b=m7JcMMGeHKDJu0exkLP3ivySpiRo1kVUmXqqM5O8+vmCAdiyg9/I8174lVP25ZLWPd 7K65Plqyzw/pqwguZcYvv4dm8XYf8TTZ8A3OxYPDR9n3Ml6YsAM0SDPUIkuP4wqkMEUi EBlcxXvGJegoxVy2duIkK1GKbIMZmXwGrm/+c79QQ+pMSsmsLoCfv1QryvZOXPkvkxEO neYPN+nCZJWWwKLJqUun6k2ELZrucU444DtBNGxubIUuIWoN5puSrLys+bqtBLq3HprX zzpeQuSVVqpheGhOmC9QOw+1PZMm5YCFEs9tDjxJhOUUgXm2kpPF46U6S3xfMy+TNzBy V8Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=n6rsSbb2Iv/ai/XzK4HJ7Nvafgwd9BJ5CXpsZX8wHaw=; b=dTMKdDlEXfdWn8KTIs5sCYzBT/wj5rLNSZEqcxLmeXItCLkQ1loaEjEEbyA6AlDJyF BsbPlMmXnsiQHRJEhe1YcWeEhfRyjsxw8FQa7nE5SKUy7DurbjTa0+3gKorj8aLwXzI2 wcX/S0DKUOp6Km+8/K3Txj1pKMDdCPm1punyYBb/kUHWP8HaJHiSDRFiIS3kfmhErwfn almgiRUPmpx0in/ZOlFrqeNBgv5wgY4AKUiXB97oitDiHOzDvWVBSum5iEECxb/4NCi2 mcZqe7Tk5Z1QQHy4OwrxaddUS01MD7OGyTXd0F5k5OX25/08mOHzUEkfnVccP1f4P3iC GOpg== X-Gm-Message-State: AG10YOQOUfNVTzkjFcjhskw31YbT/kHe4mFkVJeOuKmvgGUIU23lRzIrS/yOwvk+qb+3/3UutO8m+29ao8aAJw== MIME-Version: 1.0 X-Received: by 10.194.161.166 with SMTP id xt6mr12269642wjb.98.1454114135882; Fri, 29 Jan 2016 16:35:35 -0800 (PST) Received: by 10.194.30.234 with HTTP; Fri, 29 Jan 2016 16:35:35 -0800 (PST) In-Reply-To: <20160114043956.GA8496@pd.tnic> References: <20160110112635.GC22896@pd.tnic> <20160111104425.GA29448@gmail.com> <20160114043956.GA8496@pd.tnic> Date: Fri, 29 Jan 2016 16:35:35 -0800 Message-ID: Subject: Re: [PATCH v8 3/3] x86, mce: Add __mcsafe_copy() From: Tony Luck To: Borislav Petkov Cc: linux-nvdimm , X86 ML , "linux-kernel@vger.kernel.org" , Ingo Molnar , "linux-mm@kvack.org" , Andrew Morton , Andy Lutomirski X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jan 13, 2016 at 8:39 PM, Borislav Petkov wrote: > On Wed, Jan 13, 2016 at 03:22:58PM -0800, Tony Luck wrote: >> Are there some examples of synthetic CPUID bits? > > X86_FEATURE_ALWAYS is one. The others got renamed into X86_BUG_* ones, > the remaining mechanism is the same, though. So something like this [gmail will line wrap, but should still be legible] Then Dan will be able to use: if (cpu_has(c, X86_FEATURE_MCRECOVERY)) to decide whether to use the (slightly slower, but recovery capable) __mcsafe_copy() or just pick the fastest memcpy() instead. -Tony pr_emerg("Couldn't allocate MCE records pool!\n"); diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 7ad8c9464297..621e05103633 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -106,6 +106,7 @@ #define X86_FEATURE_APERFMPERF ( 3*32+28) /* APERFMPERF */ #define X86_FEATURE_EAGER_FPU ( 3*32+29) /* "eagerfpu" Non lazy FPU restore */ #define X86_FEATURE_NONSTOP_TSC_S3 ( 3*32+30) /* TSC doesn't stop in S3 state */ +#define X86_FEATURE_MCRECOVERY ( 3*32+31) /* cpu has recoverable machine checks */ /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ #define X86_FEATURE_XMM3 ( 4*32+ 0) /* "pni" SSE-3 */ diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index a006f4cd792b..b8980d767240 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -1694,6 +1694,14 @@ void mcheck_cpu_init(struct cpuinfo_x86 *c) return; } + /* + * MCG_CAP.MCG_SER_P is necessary but not sufficient to know + * whether this processor will actually generate recoverable + * machine checks. Check to see if this is an E7 model Xeon. + */ + if (mca_cfg.ser && !strncmp(c->x86_model_id, "Intel(R) Xeon(R) CPU E7-", 24)) + set_cpu_cap(c, X86_FEATURE_MCRECOVERY); + if (mce_gen_pool_init()) { mca_cfg.disabled = true;