From: Linus Torvalds <torvalds@linux-foundation.org>
To: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>,
Christian Brauner <christian@brauner.io>,
David Laight <David.Laight@aculab.com>,
Matthew Wilcox <willy@infradead.org>,
Jeff Layton <jlayton@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
linux-mm@kvack.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 07/13] iov_iter: Make copy_from_iter() always handle MCE
Date: Wed, 13 Sep 2023 12:43:43 -0700 [thread overview]
Message-ID: <CAHk-=wiULvMMcdf36JU3daqnTG2KqtJwm788k6fR4bJo7LvAiw@mail.gmail.com> (raw)
In-Reply-To: <20230913165648.2570623-8-dhowells@redhat.com>
On Wed, 13 Sept 2023 at 09:57, David Howells <dhowells@redhat.com> wrote:
>
> Make copy_from_iter() always catch an MCE and return a short copy and make
> the coredump code rely on that. This requires arch support in the form of
> a memcpy_mc() function that returns the length copied.
What?
This patch seems to miss the point of the machine check copy entirely.
You create that completely random memcpy_mc() function, that has
nothing to do with our existing copy_mc_to_kernel(), and you claim
that the issue is that it should return the length copied.
Which is not the issue at all.
Several x86 chips will HANG due to internal CPU corruption if you use
the string instructions for copying data when a machine check
exception happens (possibly only due to memory poisoning with some
non-volatile RAM thing).
Are these chips buggy? Yes.
Is the Intel machine check architecture nasty and bad? Yes, Christ yes.
Can these machines hang if user space does repeat string instructions
to said memory? Afaik, very much yes again. They are buggy.
I _think_ this only happens with the non-volatile storage stuff (thus
the dax / pmem / etc angle), and I hope we can put it behind us some
day.
But that doesn't mean that you can take our existing
copy_mc_to_kernel() code that tries to work around this and replace it
with something completely different that definitely does *not* work
around it.
See the comment in arch/x86/lib/copy_mc_64.S:
* copy_mc_fragile - copy memory with indication if an exception /
fault happened
*
* The 'fragile' version is opted into by platform quirks and takes
* pains to avoid unrecoverable corner cases like 'fast-string'
* instruction sequences, and consuming poison across a cacheline
* boundary. The non-fragile version is equivalent to memcpy()
* regardless of CPU machine-check-recovery capability.
and yes, it's disgusting, and no, I've never seen a machine that does
this, since it's all "enterprise hardware", and I don't want to touch
that shite with a ten-foot pole.
Should I go on another rant about how "enterprise" means "over-priced
garbage, but with a paper trail of how bad it is, so that you can
point fingers at somebody else"?
That's true both when applied to software and to hardware, I'm afraid.
So if we get rid of that horrendous "copy_mc_fragile", then pretty
much THE WHOLE POINT of the stupid MC copy goes away, and we should
just get rid of it all entirely.
Which might be a good idea, but is absolutely *not* something that
should be done randomly as part of some iov_iter rewrite series.
I'll dance on the grave of that *horrible* machine check copy code,
but when I see this as part of iov_iter cleanup, I can only say "No.
Not this way".
> [?] Is it better to kill the thread in the event of an MCE occurring?
Oh, the thread will be dead already. In fact, if I understand the
problem correctly, the whole f$^!ng machine will be dead and need to
be power-cycled.
Linus
next prev parent reply other threads:[~2023-09-13 19:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 16:56 [PATCH v4 00/13] iov_iter: Convert the iterator macros into inline funcs David Howells
2023-09-13 16:56 ` [PATCH v4 01/13] iov_iter: Add a benchmarking kunit test David Howells
2023-09-14 6:04 ` Johannes Thumshirn
2023-09-13 16:56 ` [PATCH v4 02/13] iov_iter: Renumber ITER_* constants David Howells
2023-09-13 16:56 ` [PATCH v4 03/13] iov_iter: Derive user-backedness from the iterator type David Howells
2023-09-13 16:56 ` [PATCH v4 04/13] iov_iter: Convert iterate*() to inline funcs David Howells
2023-09-13 16:56 ` [PATCH v4 05/13] iov: Move iterator functions to a header file David Howells
2023-09-14 9:06 ` David Laight
2023-09-15 9:38 ` David Howells
2023-09-13 16:56 ` [PATCH v4 06/13] iov_iter: Add a kernel-type iterator-only iteration function David Howells
2023-09-13 16:56 ` [PATCH v4 07/13] iov_iter: Make copy_from_iter() always handle MCE David Howells
2023-09-13 19:43 ` Linus Torvalds [this message]
2023-09-13 16:56 ` [PATCH v4 08/13] iov_iter: Remove the copy_mc flag and associated functions David Howells
2023-09-13 16:56 ` [PATCH v4 09/13] iov_iter, net: Move csum_and_copy_to/from_iter() to net/ David Howells
2023-09-13 16:56 ` [PATCH v4 10/13] iov_iter, net: Fold in csum_and_memcpy() David Howells
2023-09-13 16:56 ` [PATCH v4 11/13] iov_iter, net: Merge csum_and_copy_from_iter{,_full}() together David Howells
2023-09-13 16:56 ` [PATCH v4 12/13] iov_iter, net: Move hash_and_copy_to_iter() to net/ David Howells
2023-09-13 16:56 ` [PATCH v4 13/13] iov_iter: Create a fake device to allow iov_iter testing/benchmarking David Howells
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='CAHk-=wiULvMMcdf36JU3daqnTG2KqtJwm788k6fR4bJo7LvAiw@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=David.Laight@aculab.com \
--cc=axboe@kernel.dk \
--cc=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=hch@lst.de \
--cc=jlayton@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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