From: Sohil Mehta <sohil.mehta@intel.com>
To: Borislav Petkov <bp@kernel.org>, X86 ML <x86@kernel.org>
Cc: "Chang S. Bae" <chang.seok.bae@intel.com>,
LKML <linux-kernel@vger.kernel.org>,
"Borislav Petkov (AMD)" <bp@alien8.de>
Subject: Re: [PATCH -v1 2/2] x86/microcode: Add microcode loader debugging functionality
Date: Wed, 20 Aug 2025 22:19:11 -0700 [thread overview]
Message-ID: <2cd370e9-6fd8-4aed-8fe8-c8526a1ab97f@intel.com> (raw)
In-Reply-To: <20250820135043.19048-3-bp@kernel.org>
On 8/20/2025 6:50 AM, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
>
> Instead of adding ad-hoc debugging glue to the microcode loader each
> time I need it, add debugging functionality which is not built by
> default and when built-in, off by default so that it can only be enabled
> explicitly on the command line.
>
I didn't realize this last time. It's supposed to be compile-time
disabled and runtime disabled by default (which makes sense).
> +static u32 get_patch_level(void)
> +{
> + u32 rev, dummy __always_unused;
> +
> + if (IS_ENABLED(CONFIG_MICROCODE_DBG)) {
Does this need to be (IS_ENABLED(CONFIG_MICROCODE_DBG) && dbg)?
The base_rev description says:
base_rev=X - with <X> with format: <u32>
Set the base microcode revision of each thread when in
debug mode.
IIUC, the base_rev handling is also supposed to be runtime disabled by
default, right?
You can probably directly check for "if (dbg)" but that would remove the
compile time code optimization.
> + int cpu = smp_processor_id();
> +
> + if (!microcode_rev[cpu]) {
> + if (!base_rev)
> + base_rev = cpuid_to_ucode_rev(bsp_cpuid_1_eax);
> +
> + microcode_rev[cpu] = base_rev;
> +
> + ucode_dbg("CPU%d, base_rev: 0x%x\n", cpu, base_rev);
> + }
> +
> + return microcode_rev[cpu];
> + }
> +
> + native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
> +
> + return rev;
> +}
> +
...
> @@ -619,8 +657,14 @@ static bool __apply_microcode_amd(struct microcode_amd *mc, u32 *cur_rev,
> invlpg(p_addr_end);
> }
>
> + if (IS_ENABLED(CONFIG_MICROCODE_DBG))
> + microcode_rev[smp_processor_id()] = mc->hdr.patch_id;
> +
Ditto.
> /* verify patch application was successful */
> *cur_rev = get_patch_level();
...
The rest of the changes look fine to me.
next prev parent reply other threads:[~2025-08-21 5:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 13:50 [PATCH -v1 0/2] x86/microcode: Add debugging glue Borislav Petkov
2025-08-20 13:50 ` [PATCH -v1 1/2] x86/microcode: Add microcode= cmdline parsing Borislav Petkov
2025-08-21 5:03 ` Sohil Mehta
2025-08-21 5:15 ` Chang S. Bae
2025-09-02 8:45 ` kernel test robot
2025-09-04 11:37 ` Borislav Petkov
2025-09-04 23:29 ` Nathan Chancellor
2025-09-05 10:40 ` Borislav Petkov
2025-09-05 13:17 ` Ryusuke Konishi
2025-09-05 19:27 ` Nathan Chancellor
2025-09-05 10:30 ` [tip: x86/microcode] " tip-bot2 for Borislav Petkov (AMD)
2025-08-20 13:50 ` [PATCH -v1 2/2] x86/microcode: Add microcode loader debugging functionality Borislav Petkov
2025-08-20 15:35 ` Nikolay Borisov
2025-08-20 15:56 ` Borislav Petkov
2025-08-21 5:19 ` Sohil Mehta [this message]
2025-08-29 9:45 ` Borislav Petkov
2025-08-29 23:25 ` Sohil Mehta
2025-08-30 9:25 ` Borislav Petkov
2025-09-05 10:30 ` [tip: x86/microcode] " tip-bot2 for Borislav Petkov (AMD)
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=2cd370e9-6fd8-4aed-8fe8-c8526a1ab97f@intel.com \
--to=sohil.mehta@intel.com \
--cc=bp@alien8.de \
--cc=bp@kernel.org \
--cc=chang.seok.bae@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/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 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.