[<prev] [next>] [day] [month] [year] [list]
Message-ID: <DE8DF0795D48FD4CA783C40EC82923351FFB5F@SHSMSX101.ccr.corp.intel.com>
Date: Thu, 31 May 2012 17:32:18 +0000
From: "Liu, Jinsong" <jinsong.liu@...el.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
CC: Borislav Petkov <bp@...64.org>, "Luck, Tony" <tony.luck@...el.com>,
"'xen-devel@...ts.xensource.com'" <xen-devel@...ts.xensource.com>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/3] X86, MCE, AMD: Adjust initcall sequence for xen
>From bd14e0b1f0bf4586d03cc1fc810606d2ef2c1076 Mon Sep 17 00:00:00 2001
From: Liu, Jinsong <jinsong.liu@...el.com>
Date: Fri, 1 Jun 2012 08:30:21 +0800
Subject: [PATCH 2/3] X86, MCE, AMD: Adjust initcall sequence for xen
there are 3 funcs which need to be _initcalled in a logic sequence:
1. xen_late_init_mcelog
2. mcheck_init_device
3. threshold_init_device
xen_late_init_mcelog must register xen_mce_chrdev_device before
native mce_chrdev_device registration if running under xen platform;
mcheck_init_device should be inited before threshold_init_device to
initialize mce_device, otherwise a NULL ptr dereference will cause panic.
so we use following _initcalls
1. device_initcall(xen_late_init_mcelog);
2. device_initcall_sync(mcheck_init_device);
3. late_initcall(threshold_init_device);
when running under xen, the initcall order is 1,2,3;
on baremetal, we skip 1 and we do only 2 and 3.
Reported-by: Borislav Petkov <bp@...64.org>
Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Acked-and-tested-by: Borislav Petkov <borislav.petkov@....com>
Signed-off-by: Liu, Jinsong <jinsong.liu@...el.com>
---
arch/x86/kernel/cpu/mcheck/mce_amd.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index f4873a6..be52744 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -777,4 +777,24 @@ static __init int threshold_init_device(void)
return 0;
}
-device_initcall(threshold_init_device);
+/*
+ * there are 3 funcs which need to be _initcalled in a logic sequence:
+ * 1. xen_late_init_mcelog
+ * 2. mcheck_init_device
+ * 3. threshold_init_device
+ *
+ * xen_late_init_mcelog must register xen_mce_chrdev_device before
+ * native mce_chrdev_device registration if running under xen platform;
+ *
+ * mcheck_init_device should be inited before threshold_init_device to
+ * initialize mce_device, otherwise a NULL ptr dereference will cause panic.
+ *
+ * so we use following _initcalls
+ * 1. device_initcall(xen_late_init_mcelog);
+ * 2. device_initcall_sync(mcheck_init_device);
+ * 3. late_initcall(threshold_init_device);
+ *
+ * when running under xen, the initcall order is 1,2,3;
+ * on baremetal, we skip 1 and we do only 2 and 3.
+ */
+late_initcall(threshold_init_device);
--
1.7.1
Download attachment "0002-X86-MCE-AMD-Adjust-initcall-sequence-for-xen.patch" of type "application/octet-stream" (2379 bytes)
Powered by blists - more mailing lists