From: Borislav Petkov <bp@alien8.de>
To: Tony Luck <tony.luck@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Lutomirski <luto@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
elliott@hpe.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-nvdimm@ml01.01.org, x86@kernel.org
Subject: Re: [PATCHV4 3/3] x86, ras: Add __mcsafe_copy() function to recover from machine checks
Date: Thu, 24 Dec 2015 22:46:32 +0100 [thread overview]
Message-ID: <20151224214632.GF4128@pd.tnic> (raw)
In-Reply-To: <a27752f2ac16e47b1a365c5c3cc870bd87ff0366.1450990481.git.tony.luck@intel.com>
On Tue, Dec 15, 2015 at 05:30:49PM -0800, Tony Luck wrote:
> Using __copy_user_nocache() as inspiration create a memory copy
> routine for use by kernel code with annotations to allow for
> recovery from machine checks.
>
> Notes:
> 1) We align the source address rather than the destination. This
> means we never have to deal with a memory read that spans two
> cache lines ... so we can provide a precise indication of
> where the error occurred without having to re-execute at
> a byte-by-byte level to find the exact spot like the original
> did.
> 2) We 'or' BIT(63) into the return because this is the first
> in a series of machine check safe functions. Some will copy
> from user addresses, so may need to indicate an invalid user
> address instead of a machine check.
> 3) This code doesn't play any cache games. Future functions can
> use non-temporal loads/stores to meet needs of different callers.
> 4) Provide helpful macros to decode the return value.
>
> Signed-off-by: Tony Luck <tony.luck@intel.com>
> ---
> arch/x86/include/asm/string_64.h | 8 +++
> arch/x86/kernel/x8664_ksyms_64.c | 4 ++
> arch/x86/lib/memcpy_64.S | 133 +++++++++++++++++++++++++++++++++++++++
> 3 files changed, 145 insertions(+)
...
> + lea (%rdx,%rcx,8),%rdx
> + jmp 100f
> +40:
> + mov %ecx,%edx
> +100:
> + sfence
> + mov %edx,%eax
> + bts $63,%rax
> + ret
Huh, bit 63 is still alive?
Didn't we just talk about having different return values depending on
whether a fault or an MCE happened *instead* of setting that bit?
You have two "RET" points in that function, why not return a different
value from each?
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
next prev parent reply other threads:[~2015-12-24 21:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-24 20:54 [PATCHV4 0/3] Machine check recovery when kernel accesses poison Tony Luck
2015-12-16 1:29 ` [PATCHV4 1/3] x86, ras: Add new infrastructure for machine check fixup tables Tony Luck
2015-12-16 1:29 ` [PATCHV4 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas Tony Luck
2015-12-16 1:30 ` [PATCHV4 3/3] x86, ras: Add __mcsafe_copy() function to recover from machine checks Tony Luck
2015-12-24 21:46 ` Borislav Petkov [this message]
2015-12-16 1:30 ` [PATCHV5 " Tony Luck
2015-12-25 11:49 ` Borislav Petkov
2015-12-25 20:05 ` Luck, Tony
2015-12-26 10:32 ` Borislav Petkov
2015-12-26 14:54 ` Andy Lutomirski
2015-12-27 2:08 ` Tony Luck
2015-12-27 2:15 ` Andy Lutomirski
2015-12-27 2:16 ` Andy Lutomirski
2015-12-27 6:57 ` Tony Luck
2015-12-27 10:09 ` Borislav Petkov
2015-12-27 12:19 ` Andy Lutomirski
2015-12-27 13:17 ` Boris Petkov
2015-12-27 13:25 ` Andy Lutomirski
2015-12-27 13:33 ` Borislav Petkov
2015-12-27 13:40 ` Andy Lutomirski
2015-12-27 19:04 ` Dan Williams
2015-12-27 12:18 ` Andy Lutomirski
2015-12-30 23:32 ` Tony Luck
2015-12-31 20:30 ` Tony Luck
2015-12-31 21:22 ` Andy Lutomirski
2016-01-01 22:19 ` Tony Luck
2016-01-03 3:40 ` 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=20151224214632.GF4128@pd.tnic \
--to=bp@alien8.de \
--cc=akpm@linux-foundation.org \
--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@kernel.org \
--cc=mingo@kernel.org \
--cc=tony.luck@intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).