Skip to contentSkip to conversation

x86, microcode: unregister syscore_ops after microcode unloaded

PATCH In review Xiaotian Feng 2 participants 3 messages Mar 29, 2011 – Mar 30, 2011 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, microcode: unregister syscore_ops after microcode unloaded

Currently, microcode doesn't unregister syscore_ops after it's unloaded. So if we modprobe then rmmod microcode, the stale microcode syscore_ops info will stay on syscore_ops_list. Later when we're trying to reboot/halt/shutdown the machine, kernel will panic on syscore_shutdown(). With the patch applied, I can reboot/halt/shutdown my machine successfully.

Cc Tigran Aivazian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
---
 arch/x86/kernel/microcode_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/microcode_core.c +1 -0
index 5ed0ab5..f924280 100644
@@ -550,6 +550,7 @@ static void __exit microcode_exit(void)
 	microcode_dev_exit();
 
 	unregister_hotcpu_notifier(&mc_cpu_notifier);
+	unregister_syscore_ops(&mc_syscore_ops);
 
 	get_online_cpus();
 	mutex_lock(&microcode_mutex);
Signature · 1 line
1.7.1
#1 lore raw

[tip:x86/urgent] x86, microcode: Unregister syscore_ops after microcode unloaded

Commit-ID:  4ac5fc6a3e4d90120f292526bcaa5ee182a7411b
Gitweb:     http://git.kernel.org/tip/4ac5fc6a3e4d90120f292526bcaa5ee182a7411b
Author:     Xiaotian Feng <[email protected]>
AuthorDate: Tue, 29 Mar 2011 16:34:32 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 29 Mar 2011 11:12:04 +0200

x86, microcode: Unregister syscore_ops after microcode unloaded

Currently, microcode doesn't unregister syscore_ops after it's unloaded. So if we modprobe then rmmod microcode, the stale microcode syscore_ops info will stay on syscore_ops_list.

Later when we're trying to reboot/halt/shutdown the machine, kernel will panic on syscore_shutdown().

With the patch applied, I can reboot/halt/shutdown my machine successfully.

Cc Tigran Aivazian <[email protected]>
Cc Rafael J. Wysocki <[email protected]>

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/microcode_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/microcode_core.c +1 -0
index 5ed0ab5..f924280 100644
@@ -550,6 +550,7 @@ static void __exit microcode_exit(void)
 	microcode_dev_exit();
 
 	unregister_hotcpu_notifier(&mc_cpu_notifier);
+	unregister_syscore_ops(&mc_syscore_ops);
 
 	get_online_cpus();
 	mutex_lock(&microcode_mutex);
Acked-by on v1 1/1
#2 lore raw
In reply to Xiaotian Feng
Quoted 11 lines · Xiaotian Feng

Currently, microcode doesn't unregister syscore_ops after it's unloaded. So if we modprobe then rmmod microcode, the stale microcode syscore_ops info will stay on syscore_ops_list. Later when we're trying to reboot/halt/shutdown the machine, kernel will panic on syscore_shutdown(). With the patch applied, I can reboot/halt/shutdown my machine successfully.

Cc Tigran Aivazian <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Quoted 17 lines
---
 arch/x86/kernel/microcode_core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/microcode_core.c +1 -0
index 5ed0ab5..f924280 100644
@@ -550,6 +550,7 @@ static void __exit microcode_exit(void)
 	microcode_dev_exit();
 
 	unregister_hotcpu_notifier(&mc_cpu_notifier);
+	unregister_syscore_ops(&mc_syscore_ops);
 
 	get_online_cpus();
 	mutex_lock(&microcode_mutex);