CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
PATCH 1/1 CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
---
arch/x86/kernel/microcode_core.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
arch/x86/kernel/microcode_core.c +7 -1
@@ -483,7 +483,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)sysfs_remove_group (&sys_dev->kobj, &mc_attr_group);pr_debug ("CPU%d removed\n" , cpu);break ; -case CPU_DEAD : + +/* When a CPU goes offline, don't free up or invalidate the copy of +* the microcode in kernel memory, so that we can reuse it when the +* CPU comes back online without unnecessarily requesting the userspace +* for it again. +*/ +case CPU_UP_CANCELED_FROZEN :/* The CPU refused to come up during a system resume */ microcode_fini_cpu (cpu);
Quoted 11 lines · Srivatsa S. Bhat
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
Tested-by Borislav Petkov <[email protected]>Acked-by Borislav Petkov <[email protected]>Signed-off-by Srivatsa S. Bhat <[email protected]>
Good, thanks. Just a minor nitpick below.
Quoted 11 lines
---
arch/x86/kernel/microcode_core.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)arch/x86/kernel/microcode_core.c +0
-0@@ -483,7 +483,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)sysfs_remove_group (&sys_dev->kobj, &mc_attr_group);
arch/x86/kernel/microcode_core.c mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) · line 492
Quoted 10 lines
arch/x86/kernel/microcode_core.c +7
-1pr_debug ("CPU%d removed\n" , cpu);break ; -case CPU_DEAD : + +/* When a CPU goes offline, don't free up or invalidate the copy of +* the microcode in kernel memory, so that we can reuse it when the +* CPU comes back online without unnecessarily requesting the userspace +* for it again. +*/ +
Kernel comment style is in this format:
/*
* Blabla
* blublu
*/
@Ingo, can you please adjust it in-flight when applying?
Thanks.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
Quoted 39 lines · Borislav Petkov
Quoted 11 lines · Srivatsa S. Bhat
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
Tested-by Borislav Petkov <[email protected]>Acked-by Borislav Petkov <[email protected]>Signed-off-by Srivatsa S. Bhat <[email protected]>Good, thanks. Just a minor nitpick below.
Quoted 11 lines
---
arch/x86/kernel/microcode_core.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)arch/x86/kernel/microcode_core.c +0
-0@@ -483,7 +483,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)sysfs_remove_group (&sys_dev->kobj, &mc_attr_group);arch/x86/kernel/microcode_core.c mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) · line 492
Quoted 10 lines
arch/x86/kernel/microcode_core.c +7
-1pr_debug ("CPU%d removed\n" , cpu);break ; -case CPU_DEAD : + +/* When a CPU goes offline, don't free up or invalidate the copy of +* the microcode in kernel memory, so that we can reuse it when the +* CPU comes back online without unnecessarily requesting the userspace +* for it again. +*/ +Kernel comment style is in this format:
Quoted 5 lines
/*
* Blabla
* blublu
*/
Oh, ok.. Thank you for pointing it out.
Quoted 1 line
@Ingo, can you please adjust it in-flight when applying?
I'll post the patch with the correct comment style, if that would make things easier.
Signature · 4 lines
Regards, Srivatsa S. Bhat <[email protected]> Linux Technology Center, IBM India Systems and Technology Lab
PATCH RESEND 1/1 CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
---
arch/x86/kernel/microcode_core.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
arch/x86/kernel/microcode_core.c +8 -1
@@ -483,7 +483,14 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)sysfs_remove_group (&sys_dev->kobj, &mc_attr_group);pr_debug ("CPU%d removed\n" , cpu);break ; -case CPU_DEAD : + +/* +* When a CPU goes offline, don't free up or invalidate the copy of +* the microcode in kernel memory, so that we can reuse it when the +* CPU comes back online without unnecessarily requesting the userspace +* for it again. +*/ +case CPU_UP_CANCELED_FROZEN :/* The CPU refused to come up during a system resume */ microcode_fini_cpu (cpu);
Quoted 8 lines · Srivatsa S. Bhat
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
Quoted 4 lines
Tested-by Borislav Petkov <[email protected]>Acked-by Borislav Petkov <[email protected]>Signed-off-by Srivatsa S. Bhat <[email protected]>
Fine by me. I wonder who should take this?
Rafael
Quoted 29 lines
---
arch/x86/kernel/microcode_core.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)arch/x86/kernel/microcode_core.c +8
-1@@ -483,7 +483,14 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)sysfs_remove_group (&sys_dev->kobj, &mc_attr_group);pr_debug ("CPU%d removed\n" , cpu);break ; -case CPU_DEAD : + +/* +* When a CPU goes offline, don't free up or invalidate the copy of +* the microcode in kernel memory, so that we can reuse it when the +* CPU comes back online without unnecessarily requesting the userspace +* for it again. +*/ +case CPU_UP_CANCELED_FROZEN :/* The CPU refused to come up during a system resume */ microcode_fini_cpu (cpu);
Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines · Srivatsa S. Bhat
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
Quoted 6 lines
Quoted 4 lines
Tested-by Borislav Petkov <[email protected]>Acked-by Borislav Petkov <[email protected]>Signed-off-by Srivatsa S. Bhat <[email protected]>Fine by me. I wonder who should take this?
Ingo, most probably. ucode stuff goes in through -tip.
Signature · 8 lines
Regards/Gruss, Boris. Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
Rafael J. Wysocki
Acked-byQuoted 10 lines · Borislav Petkov
Quoted 9 lines · Rafael J. Wysocki
Quoted 8 lines · Srivatsa S. Bhat
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Tested-by Borislav Petkov <[email protected]>Acked-by Borislav Petkov <[email protected]>Signed-off-by Srivatsa S. Bhat <[email protected]>Fine by me. I wonder who should take this?
Ingo, most probably. ucode stuff goes in through -tip.
OK, so
Thanks,
Rafael
Quoted 8 lines · Srivatsa S. Bhat
Requesting the microcode from userspace *every time* when onlining CPUs (during a CPU hotplug operation) is unnecessary.
So, this patch ensures that once the kernel gets the microcode after booting, it is not freed nor invalidated when a CPU goes offline, so that it can be reused when that CPU comes back online, without requesting userspace for it again. As a result, the CPU hotplug operations become faster as well.
Quoted 4 lines
Tested-by Borislav Petkov <[email protected]>Acked-by Borislav Petkov <[email protected]>Signed-off-by Srivatsa S. Bhat <[email protected]>
Thanks,
Andreas
Quoted 26 lines
arch/x86/kernel/microcode_core.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)arch/x86/kernel/microcode_core.c +8
-1@@ -483,7 +483,14 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)sysfs_remove_group (&sys_dev->kobj, &mc_attr_group);pr_debug ("CPU%d removed\n" , cpu);break ; -case CPU_DEAD : + +/* +* When a CPU goes offline, don't free up or invalidate the copy of +* the microcode in kernel memory, so that we can reuse it when the +* CPU comes back online without unnecessarily requesting the userspace +* for it again. +*/ +case CPU_UP_CANCELED_FROZEN :/* The CPU refused to come up during a system resume */ microcode_fini_cpu (cpu);