Re: Linux 4.9.6 ( Restore IO-APIC irq_chip retrigger callback , breaks my box )

From: Borislav Petkov
Date: Sun Feb 12 2017 - 19:38:37 EST


On Sun, Feb 12, 2017 at 11:21:13PM +0100, Gabriel C wrote:
> http://ftp.frugalware.org/pub/other/people/crazy/kernel/t/crash_initcall_debug.mp4
> http://ftp.frugalware.org/pub/other/people/crazy/kernel/t/crash_intcall_debug_ucode_off.mp4

Thanks and interesting. In both cases, mcheck_init_device() doesn't
return or we don't see the "initcall returned" message.

Ok, let's try a silly sprinkling of printks in that function and try to
pinpoint how far we manage to come.

Apply, build, boot and shoot video again :-)

Thanks.

---
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 8e9725c607ea..70268867cb33 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2565,37 +2565,57 @@ static __init int mcheck_init_device(void)
enum cpuhp_state hp_online;
int err;

+ pr_err("%s: entry\n", __func__);
+
if (!mce_available(&boot_cpu_data)) {
err = -EIO;
goto err_out;
}

+ pr_err("%s: mce_available\n", __func__);
+
if (!zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL)) {
err = -ENOMEM;
goto err_out;
}

+ pr_err("%s: zalloc_cpumask_var\n", __func__);
+
mce_init_banks();

+ pr_err("%s: mce_init_banks\n", __func__);
+
err = subsys_system_register(&mce_subsys, NULL);
if (err)
goto err_out_mem;

+ pr_err("%s: subsys_system_register\n", __func__);
+
err = cpuhp_setup_state(CPUHP_X86_MCE_DEAD, "x86/mce:dead", NULL,
mce_cpu_dead);
if (err)
goto err_out_mem;

+ pr_err("%s: x86/mce:dead\n", __func__);
+
err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/mce:online",
mce_cpu_online, mce_cpu_pre_down);
if (err < 0)
goto err_out_online;
+
+ pr_err("%s: x86/mce:online\n", __func__);
+
hp_online = err;

register_syscore_ops(&mce_syscore_ops);

+ pr_err("%s: register_syscore_ops\n", __func__);
+
/* register character device /dev/mcelog */
err = misc_register(&mce_chrdev_device);
+
+ pr_err("%s: misc_register, err: 0x%x\n", __func__, err);
+
if (err)
goto err_register;


--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.