All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Ingo Molnar <mingo@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Lutomirski <luto@amacapital.net>,
	linux-nvdimm <linux-nvdimm@ml01.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Robert <elliott@hpe.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	X86 ML <x86@kernel.org>
Subject: Re: [PATCH v8 3/3] x86, mce: Add __mcsafe_copy()
Date: Fri, 29 Jan 2016 16:35:35 -0800	[thread overview]
Message-ID: <CA+8MBbKdH8v=gkTqzxpPRX9-jBEobU9XaEfZh=4cOXDjPE9fBA@mail.gmail.com> (raw)
In-Reply-To: <20160114043956.GA8496@pd.tnic>

On Wed, Jan 13, 2016 at 8:39 PM, Borislav Petkov <bp@alien8.de> 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


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;
                pr_emerg("Couldn't allocate MCE records pool!\n");

WARNING: multiple messages have this Message-ID (diff)
From: Tony Luck <tony.luck@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Ingo Molnar <mingo@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Andy Lutomirski <luto@amacapital.net>,
	linux-nvdimm <linux-nvdimm@ml01.01.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Robert <elliott@hpe.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	X86 ML <x86@kernel.org>
Subject: Re: [PATCH v8 3/3] x86, mce: Add __mcsafe_copy()
Date: Fri, 29 Jan 2016 16:35:35 -0800	[thread overview]
Message-ID: <CA+8MBbKdH8v=gkTqzxpPRX9-jBEobU9XaEfZh=4cOXDjPE9fBA@mail.gmail.com> (raw)
In-Reply-To: <20160114043956.GA8496@pd.tnic>

On Wed, Jan 13, 2016 at 8:39 PM, Borislav Petkov <bp@alien8.de> 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


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;
                pr_emerg("Couldn't allocate MCE records pool!\n");

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-01-30  0:35 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-09  0:04 [PATCH v8 0/3] Machine check recovery when kernel accesses poison Tony Luck
2016-01-09  0:04 ` Tony Luck
2015-12-31 19:40 ` [PATCH v8 2/3] x86, mce: Check for faults tagged in EXTABLE_CLASS_FAULT exception table entries Tony Luck
2015-12-31 19:40   ` Tony Luck
2016-01-08 20:49 ` [PATCH v8 1/3] x86: Expand exception table to allow new handling options Tony Luck
2016-01-08 20:49   ` Tony Luck
2016-01-09  1:52   ` Andy Lutomirski
2016-01-09  1:52     ` Andy Lutomirski
2016-01-09  3:39     ` Brian Gerst
2016-01-09  3:39       ` Brian Gerst
2016-01-09  4:31       ` Brian Gerst
2016-01-09  4:31         ` Brian Gerst
2016-01-09  6:36         ` Andy Lutomirski
2016-01-09  6:36           ` Andy Lutomirski
2016-01-11 23:09           ` Brian Gerst
2016-01-11 23:09             ` Brian Gerst
2016-01-11 23:22             ` Andy Lutomirski
2016-01-11 23:22               ` Andy Lutomirski
2016-01-11 23:48             ` Luck, Tony
2016-01-11 23:48               ` Luck, Tony
2016-01-09 17:45     ` Tony Luck
2016-01-09 17:45       ` Tony Luck
2016-01-09 18:00       ` Andy Lutomirski
2016-01-09 18:00         ` Andy Lutomirski
2016-01-09 19:51         ` Tony Luck
2016-01-09 19:51           ` Tony Luck
2016-01-09 22:32           ` Andy Lutomirski
2016-01-09 22:32             ` Andy Lutomirski
2016-01-10  1:15             ` Tony Luck
2016-01-10  1:15               ` Tony Luck
2016-01-11  0:25     ` Luck, Tony
2016-01-11  0:25       ` Luck, Tony
2016-01-08 21:18 ` [PATCH v8 3/3] x86, mce: Add __mcsafe_copy() Tony Luck
2016-01-08 21:18   ` Tony Luck
2016-01-09  1:49   ` Andy Lutomirski
2016-01-09  1:49     ` Andy Lutomirski
2016-01-09 17:48     ` Tony Luck
2016-01-09 17:48       ` Tony Luck
2016-01-09 17:57       ` Andy Lutomirski
2016-01-09 17:57         ` Andy Lutomirski
2016-01-09 19:39         ` Tony Luck
2016-01-09 19:39           ` Tony Luck
2016-01-09 22:15           ` Dan Williams
2016-01-09 22:15             ` Dan Williams
2016-01-09 22:33             ` Andy Lutomirski
2016-01-09 22:33               ` Andy Lutomirski
2016-01-10  0:23               ` Dan Williams
2016-01-10  0:23                 ` Dan Williams
2016-01-10  1:40                 ` Tony Luck
2016-01-10  1:40                   ` Tony Luck
2016-01-10 11:26                   ` Borislav Petkov
2016-01-10 11:26                     ` Borislav Petkov
2016-01-11 10:44                     ` Ingo Molnar
2016-01-11 10:44                       ` Ingo Molnar
2016-01-13 23:22                       ` Tony Luck
2016-01-13 23:22                         ` Tony Luck
2016-01-14  4:39                         ` Borislav Petkov
2016-01-14  4:39                           ` Borislav Petkov
2016-01-30  0:35                           ` Tony Luck [this message]
2016-01-30  0:35                             ` Tony Luck
2016-01-30 10:28                             ` Borislav Petkov
2016-01-30 10:28                               ` Borislav Petkov
2016-02-01 23:10                               ` Tony Luck
2016-02-01 23:10                                 ` Tony Luck
2016-02-01 23:16                                 ` Dan Williams
2016-02-01 23:16                                   ` Dan Williams
2016-01-12  0:26     ` Luck, Tony
2016-01-12  0:26       ` Luck, Tony
2016-01-12  0:30       ` Andy Lutomirski
2016-01-12  0:30         ` Andy Lutomirski
2016-01-12  0:37       ` Andy Lutomirski
2016-01-12  0:37         ` Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+8MBbKdH8v=gkTqzxpPRX9-jBEobU9XaEfZh=4cOXDjPE9fBA@mail.gmail.com' \
    --to=tony.luck@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=elliott@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.