Re: [PATCH 3/3] EDAC: carve out AMD MCE decoding logic

Ingo Molnar
2009-10-02T13:40:09Z

* Borislav Petkov <borislav.petkov@amd.com> wrote:

> +static void (*orig_mce_callback)(struct mce *m);
>
> void amd_report_gart_errors(bool v)
> {
> @@ -427,9 +428,25 @@ static int __init mce_amd_init(void)
> * We can decode MCEs for Opteron and later CPUs:
> */
> if ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) &&
> - (boot_cpu_data.x86 >= 0xf))
> + (boot_cpu_data.x86 >= 0xf)) {
> + /* safe the default decode mce callback */
> + orig_mce_callback = x86_mce_decode_callback;
> +
> x86_mce_decode_callback = amd_decode_mce;
> + }
>
> return 0;
> }
> early_initcall(mce_amd_init);
> +
> +#ifdef MODULE
> +static void __exit mce_amd_exit(void)
> +{
> + x86_mce_decode_callback = orig_mce_callback;
> +}

I suspect this is fine currently because no two EDAC modules should be
active at the same time. A followup cleanup patch would be nice
nevertheless that uses a notifier chain here with proper
register/unregister locking.

Ingo