* [PATCH] x86/microcode: Remove useless code after early microcode support added
@ 2019-04-01 8:46 Zhenzhong Duan
2019-04-02 15:35 ` Borislav Petkov
0 siblings, 1 reply; 3+ messages in thread
From: Zhenzhong Duan @ 2019-04-01 8:46 UTC (permalink / raw)
To: linux-kernel
Cc: x86, Zhenzhong Duan, Borislav Petkov, Thomas Gleixner,
Ingo Molnar, H. Peter Anvin, Srinivas Eeda
After early microcode update was added, microcode couldn't be configured
as a module, microcode update happens at early bootup and cpu hotplug
stage. This made the microcode update code in module loading stage
useless.
This patch remove the useless code.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Srinivas Eeda <srinivas.eeda@oracle.com>
---
arch/x86/kernel/cpu/microcode/core.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 5260185..7f05bcb 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -710,10 +710,6 @@ static enum ucode_state microcode_init_cpu(int cpu, bool refresh_fw)
if (collect_cpu_info(cpu))
return UCODE_ERROR;
- /* --dimm. Trigger a delayed update? */
- if (system_state != SYSTEM_RUNNING)
- return UCODE_NFOUND;
-
ustate = microcode_ops->request_microcode_fw(cpu, µcode_pdev->dev, refresh_fw);
if (ustate == UCODE_NEW) {
pr_debug("CPU%d updated upon init\n", cpu);
@@ -738,21 +734,14 @@ static enum ucode_state microcode_update_cpu(int cpu)
static int mc_device_add(struct device *dev, struct subsys_interface *sif)
{
- int err, cpu = dev->id;
+ int cpu = dev->id;
if (!cpu_online(cpu))
return 0;
pr_debug("CPU%d added\n", cpu);
- err = sysfs_create_group(&dev->kobj, &mc_attr_group);
- if (err)
- return err;
-
- if (microcode_init_cpu(cpu, true) == UCODE_ERROR)
- return -EINVAL;
-
- return err;
+ return sysfs_create_group(&dev->kobj, &mc_attr_group);
}
static void mc_device_remove(struct device *dev, struct subsys_interface *sif)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/microcode: Remove useless code after early microcode support added
2019-04-01 8:46 [PATCH] x86/microcode: Remove useless code after early microcode support added Zhenzhong Duan
@ 2019-04-02 15:35 ` Borislav Petkov
[not found] ` <4c12556d-9663-5cc9-bf0a-b2032110b0cb@oracle.com>
0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2019-04-02 15:35 UTC (permalink / raw)
To: Zhenzhong Duan
Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
Srinivas Eeda
On Mon, Apr 01, 2019 at 04:46:52PM +0800, Zhenzhong Duan wrote:
> After early microcode update was added, microcode couldn't be configured
No, early loading doesn't have anything to do with it - the driver was
made built-in only.
> as a module, microcode update happens at early bootup and cpu hotplug
> stage. This made the microcode update code in module loading stage
> useless.
>
> This patch
Avoid having "This patch" or "This commit" in the commit message. It is
tautologically useless.
Also, do
$ git grep 'This patch' Documentation/process
for more details.
> remove the useless code.
Well, not useless.
1. Apply your patch, boot kernel without an initrd so that it doesn't
apply early microcode.
2. Load late microcode:
# echo 1 > /sys/devices/system/cpu/microcode/reload
[ 66.430052] microcode: CPU0: new patch_level=0x05000029
[ 66.430352] x86/CPU: CPU features have changed after loading microcode, but might not take effect.
[ 66.430620] microcode: Reload completed, microcode revision: 0x5000029
3.
# grep microcode /proc/cpuinfo
microcode : 0x5000029
microcode : 0x5000028 <--- !!!
Whoops. CPU1 didn't get updated.
So I'd suggest leaving this code alone and concentrating on fixing real
bugs. Unless it is causing other issues.
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/microcode: Remove useless code after early microcode support added
[not found] ` <4c12556d-9663-5cc9-bf0a-b2032110b0cb@oracle.com>
@ 2019-04-03 8:18 ` Borislav Petkov
0 siblings, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2019-04-03 8:18 UTC (permalink / raw)
To: Zhenzhong Duan
Cc: linux-kernel, x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
Srinivas Eeda
On Wed, Apr 03, 2019 at 03:40:24PM +0800, Zhenzhong Duan wrote:
> I remember microcode could be module before early loading was added.
You've remembered it wrongly, it is the other way around:
9a2bc335f100 ("x86/microcode: Unmodularize the microcode driver")
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-03 8:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-01 8:46 [PATCH] x86/microcode: Remove useless code after early microcode support added Zhenzhong Duan
2019-04-02 15:35 ` Borislav Petkov
[not found] ` <4c12556d-9663-5cc9-bf0a-b2032110b0cb@oracle.com>
2019-04-03 8:18 ` Borislav Petkov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.