2014-10-01 05:26:14

by Chen Yucong

[permalink] [raw]
Subject: Re: [PATCH] x86, MCE, AMD: save IA32_MCi_STATUS before machine_check_poll() resets it

On Tue, 2014-09-30 at 12:09 +0200, Borislav Petkov wrote:
>
> Now let me repeat my question: how are you testing your patches?
>
There are no any hardware facilities that can help me to inject some
MCE errors. So I have to modify the kernel source code for testing my
patches.

My method is based on the `mce-injection' that is better suited to
Intel processors. So I have replaced rdmsrl/wrmsrl/rdmsr_safe with
mce_rdmsrl/mce_wrmsrl/mce_rdmsr_safe in mce_amd.c. But I use a new
kernel module for error injection instead of writing /dev/mcelog.

For more detailed information about testing, you can refer the
attachments.

thx!
cyc


Attachments:
amd-mce-injection.patch (5.17 kB)
amd_inject.c (1.58 kB)
Download all attachments

2014-10-01 10:10:31

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH] x86, MCE, AMD: save IA32_MCi_STATUS before machine_check_poll() resets it

On Wed, Oct 01, 2014 at 01:26:04PM +0800, Chen Yucong wrote:
> On Tue, 2014-09-30 at 12:09 +0200, Borislav Petkov wrote:
> >
> > Now let me repeat my question: how are you testing your patches?
> >
> There are no any hardware facilities that can help me to inject some
> MCE errors. So I have to modify the kernel source code for testing my
> patches.
>
> My method is based on the `mce-injection' that is better suited to
> Intel processors. So I have replaced rdmsrl/wrmsrl/rdmsr_safe with
> mce_rdmsrl/mce_wrmsrl/mce_rdmsr_safe in mce_amd.c. But I use a new
> kernel module for error injection instead of writing /dev/mcelog.
>
> For more detailed information about testing, you can refer the
> attachments.

Right, so you modprobe/rmmod when you inject, I see.

We actually have some functionality to test the decoding of MCEs, take a
look at drivers/edac/mce_amd_inj.c. I have patches somewhere which allow
it to raise real MCEs but didn't have the need to merge them yet - I
could try to dust them off...

I also have a patch converting this module to debugfs as sysfs is not
the right fs it should be using for injecting. Then it might be easy to
extend it to inject all kinds of errors into MCA... Also maybe do both
real injection into the hardware (dangerous) and do the fake thing which
mce-inject does. Oh well.

Thanks.

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine.
--