xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] initcall sequence adjust for 3 funcs
@ 2012-05-31 12:59 Liu, Jinsong
  2012-05-31 13:53 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Liu, Jinsong @ 2012-05-31 12:59 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, Borislav Petkov
  Cc: Luck, Tony, 'xen-devel@lists.xensource.com',
	'linux-kernel@vger.kernel.org'

[-- Attachment #1: Type: text/plain, Size: 2370 bytes --]

>From eb5ff1bef5dd3116fa2624b594b853e9334ccbce Mon Sep 17 00:00:00 2001
From: root <root@ljsromley.bj.intel.com>
Date: Fri, 1 Jun 2012 03:56:25 +0800
Subject: [PATCH 2/2] initcall sequence adjust for 3 funcs

there are 3 funcs 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 need register xen_mce_chrdev_device before
native mce_chrdev_device registeration if running under xen platform;

mcheck_init_device should be inited before threshold_init_device to
initialize mce_device, otherwise a NULL pointer would occur and 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 platform, 1,2,3 would take effect;
when running under baremetal, 2,3 would take effect;

Reported-by: Borislav Petkov <bp@amd64.org>
Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.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..6647858 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 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 need register xen_mce_chrdev_device before
+ * native mce_chrdev_device registeration if running under xen platform;
+ *
+ * mcheck_init_device should be inited before threshold_init_device to
+ * initialize mce_device, otherwise a NULL pointer would occur and 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 platform, 1,2,3 would take effect;
+ * when running under baremetal, 2,3 would take effect;
+ */
+late_initcall(threshold_init_device);
-- 
1.7.1

[-- Attachment #2: 0002-initcall-sequence-adjust-for-3-funcs.patch --]
[-- Type: application/octet-stream, Size: 2307 bytes --]

From eb5ff1bef5dd3116fa2624b594b853e9334ccbce Mon Sep 17 00:00:00 2001
From: root <root@ljsromley.bj.intel.com>
Date: Fri, 1 Jun 2012 03:56:25 +0800
Subject: [PATCH 2/2] initcall sequence adjust for 3 funcs

there are 3 funcs 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 need register xen_mce_chrdev_device before
native mce_chrdev_device registeration if running under xen platform;

mcheck_init_device should be inited before threshold_init_device to
initialize mce_device, otherwise a NULL pointer would occur and 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 platform, 1,2,3 would take effect;
when running under baremetal, 2,3 would take effect;

Reported-by: Borislav Petkov <bp@amd64.org>
Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.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..6647858 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 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 need register xen_mce_chrdev_device before
+ * native mce_chrdev_device registeration if running under xen platform;
+ *
+ * mcheck_init_device should be inited before threshold_init_device to
+ * initialize mce_device, otherwise a NULL pointer would occur and 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 platform, 1,2,3 would take effect;
+ * when running under baremetal, 2,3 would take effect;
+ */
+late_initcall(threshold_init_device);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-31 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-31 12:59 [PATCH 2/2] initcall sequence adjust for 3 funcs Liu, Jinsong
2012-05-31 13:53 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).