From: tip-bot for Prarit Bhargava <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, bp@suse.de, tony.luck@intel.com,
linux-kernel@vger.kernel.org, hpa@zytor.com, prarit@redhat.com,
mingo@kernel.org
Subject: [tip:x86/urgent] x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
Date: Sun, 2 Sep 2018 05:15:50 -0700 [thread overview]
Message-ID: <tip-370a132bb2227ff76278f98370e0e701d86ff752@git.kernel.org> (raw)
In-Reply-To: <20180731112739.32338-1-prarit@redhat.com>
Commit-ID: 370a132bb2227ff76278f98370e0e701d86ff752
Gitweb: https://git.kernel.org/tip/370a132bb2227ff76278f98370e0e701d86ff752
Author: Prarit Bhargava <prarit@redhat.com>
AuthorDate: Tue, 31 Jul 2018 07:27:39 -0400
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 2 Sep 2018 14:10:54 +0200
x86/microcode: Make sure boot_cpu_data.microcode is up-to-date
When preparing an MCE record for logging, boot_cpu_data.microcode is used
to read out the microcode revision on the box.
However, on systems where late microcode update has happened, the microcode
revision output in a MCE log record is wrong because
boot_cpu_data.microcode is not updated when the microcode gets updated.
But, the microcode revision saved in boot_cpu_data's microcode member
should be kept up-to-date, regardless, for consistency.
Make it so.
Fixes: fa94d0c6e0f3 ("x86/MCE: Save microcode revision in machine check records")
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: sironi@amazon.de
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20180731112739.32338-1-prarit@redhat.com
---
arch/x86/kernel/cpu/microcode/amd.c | 4 ++++
arch/x86/kernel/cpu/microcode/intel.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 0624957aa068..602f17134103 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -537,6 +537,10 @@ static enum ucode_state apply_microcode_amd(int cpu)
uci->cpu_sig.rev = mc_amd->hdr.patch_id;
c->microcode = mc_amd->hdr.patch_id;
+ /* Update boot_cpu_data's revision too, if we're on the BSP: */
+ if (c->cpu_index == boot_cpu_data.cpu_index)
+ boot_cpu_data.microcode = mc_amd->hdr.patch_id;
+
return UCODE_UPDATED;
}
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 97ccf4c3b45b..256d336cbc04 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -851,6 +851,10 @@ static enum ucode_state apply_microcode_intel(int cpu)
uci->cpu_sig.rev = rev;
c->microcode = rev;
+ /* Update boot_cpu_data's revision too, if we're on the BSP: */
+ if (c->cpu_index == boot_cpu_data.cpu_index)
+ boot_cpu_data.microcode = rev;
+
return UCODE_UPDATED;
}
prev parent reply other threads:[~2018-09-02 12:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 11:30 [PATCH] x86/MCE: Get microcode revision from cpu_info instead of boot_cpu_data Filippo Sironi
2018-06-01 12:19 ` Borislav Petkov
2018-06-01 12:32 ` Sironi, Filippo
2018-06-01 12:40 ` Borislav Petkov
2018-07-30 17:49 ` [PATCH] arch/x86: Fix boot_cpu_data.microcode version output Prarit Bhargava
2018-07-30 17:53 ` Prarit Bhargava
2018-07-31 4:02 ` Borislav Petkov
2018-07-31 11:27 ` [PATCH v2] " Prarit Bhargava
2018-07-31 11:46 ` Sironi, Filippo
2018-07-31 13:00 ` Borislav Petkov
2018-07-31 15:31 ` Sironi, Filippo
2018-08-01 15:43 ` Borislav Petkov
2018-08-01 15:44 ` [PATCH 1/2] x86/microcode: Make sure boot_cpu_data.microcode is up-to-date Borislav Petkov
2018-08-01 15:45 ` [PATCH 2/2] x86/microcode: Update the new microcode revision unconditionally Borislav Petkov
2018-08-01 15:55 ` [PATCH v2] arch/x86: Fix boot_cpu_data.microcode version output Prarit Bhargava
2018-09-02 12:15 ` tip-bot for Prarit Bhargava [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-370a132bb2227ff76278f98370e0e701d86ff752@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=prarit@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome