Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1266804
| From | "Luck, Tony" <tony.luck@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 0/3] Machine check recovery when kernel accesses poison |
| Date | 2015-11-10 23:00 +0100 |
| Message-ID | <qtp7k-2b1-3@gated-at.bofh.it> (permalink) |
| References | <qsZFT-1HI-9@gated-at.bofh.it> <qtfhD-4pX-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Nov 10, 2015 at 12:21:01PM +0100, Borislav Petkov wrote:
> Just a general, why-do-we-do-this, question: on big systems, the memory
> occupied by the kernel is a very small percentage compared to whole RAM,
> right? And yet we want to recover from there too? Not, say, kexec...
I need to add more to the motivation part of this. The people who want
this are playing with NVDIMMs as storage. So think of many GBytes of
non-volatile memory on the source end of the memcpy(). People are used
to disk errors just giving them a -EIO error. They'll be unhappy if an
NVDIMM error crashes the machine.
> > Note that I also fudge the return value. I'd like in the future
> > to be able to write a "mcsafe_copy_from_user()" function that
> > would be annotated both for page faults, to return a count of
> > bytes uncopied, or an indication that there was a machine check.
> > Hence the BIT(63) bit. Internal feedback suggested we'd need
> > some IS_ERR() like macros to help users decode what happened
> > to take the right action. But this is "RFC" to see if people
> > have better ideas on how to handle this.
>
> Hmm, shouldn't this be using MF_ACTION_REQUIRED or even maybe a new MF_
> flag which is converted into a BUS_MCEERR_AR si_code and thus current
> gets a signal?
>
> Only setting bit 63 looks a bit flaky to me...
It will be up to the caller to figure out what action to take. In
the NVDIMM filessytem scenario outlined above the result may be -EIO
for a data block ... something more drastic if we were reading metadata.
When I get around to writing mcsafe_copy_from_user() the code might
end up like:
some_syscall_e_g_write(void __user *buf, size_t cnt)
{
u64 ret;
ret = mcsafe_copy_from_user(kbuf, buf, cnt);
if (ret & BIT(63)) {
do some machine check thing ... e.g.
send a SIGBUS to this process and return -EINTR
This is where we use the address (after converting
back to a user virtual address).
} else if (ret) {
user gave us a bad buffer: return -EFAULT
} else {
success!!!
}
}
Which all looks quite ugly in long-hand ... I'm hoping that with
some pretty macros we can make it pretty.
-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 0/3] Machine check recovery when kernel accesses poison Tony Luck <tony.luck@intel.com> - 2015-11-09 19:50 +0100
[PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas Tony Luck <tony.luck@intel.com> - 2015-11-09 19:50 +0100
Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas Borislav Petkov <bp@alien8.de> - 2015-11-10 12:30 +0100
Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas "Luck, Tony" <tony.luck@intel.com> - 2015-11-10 23:20 +0100
Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas Borislav Petkov <bp@alien8.de> - 2015-11-11 12:10 +0100
Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas Andy Lutomirski <luto@kernel.org> - 2015-11-12 05:30 +0100
Re: [PATCH 2/3] x86, ras: Extend machine check recovery code to annotated ring0 areas "Luck, Tony" <tony.luck@intel.com> - 2015-11-12 21:00 +0100
[PATCH 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Tony Luck <tony.luck@intel.com> - 2015-11-09 19:50 +0100
Re: [PATCH 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks Ingo Molnar <mingo@kernel.org> - 2015-11-12 09:00 +0100
Re: [PATCH 3/3] x86, ras: Add mcsafe_memcpy() function to recover from machine checks "Luck, Tony" <tony.luck@intel.com> - 2015-11-12 21:10 +0100
Re: [RFC PATCH 0/3] Machine check recovery when kernel accesses poison Borislav Petkov <bp@alien8.de> - 2015-11-10 12:30 +0100
Re: [RFC PATCH 0/3] Machine check recovery when kernel accesses poison "Luck, Tony" <tony.luck@intel.com> - 2015-11-10 23:00 +0100
Re: [RFC PATCH 0/3] Machine check recovery when kernel accesses poison Borislav Petkov <bp@alien8.de> - 2015-11-11 21:50 +0100
Re: [RFC PATCH 0/3] Machine check recovery when kernel accesses poison "Luck, Tony" <tony.luck@intel.com> - 2015-11-11 22:50 +0100
Re: [RFC PATCH 0/3] Machine check recovery when kernel accesses poison Borislav Petkov <bp@alien8.de> - 2015-11-11 23:30 +0100
RE: [RFC PATCH 0/3] Machine check recovery when kernel accesses poison "Luck, Tony" <tony.luck@intel.com> - 2015-11-11 23:40 +0100
csiph-web