Re: [PATCH] x86/microcode: Refactor Intel microcode loading

From: Jann Horn
Date: Thu Apr 04 2019 - 18:55:10 EST


On Thu, Apr 4, 2019 at 6:47 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Thu, Apr 04, 2019 at 06:31:37PM +0200, Jann Horn wrote:
> > Uuuh. I *definitely* tested this. I ran this yesterday evening on my
> > home machine, on top of commit
> > 14c741de93861749dfb60b4964028541f5c506ca from Linus' tree, plus two
> > cherry-picked fixes for drm/ttm. I specifically made sure that I had
> > the old microcode version before reloading these ways and I had the
> > new version after reloading. And the verbose dmesg logs also looked
> > okay.
>
> How did you check the microcode revision before and after? /proc/cpuinfo?
>
> Because that old method doesn't say anything in dmesg if there's no
> debugging output, only the iucode_tool says something like the below if
> you enable verbose output:
>
> # iucode-tool -v --kernel=/dev/cpu/microcode /lib/firmware/intel-ucode/06-3a-09
> iucode-tool: processed 1 valid microcode(s), 1 signature(s), 1 unique signature(s)
> iucode-tool: selected 1 microcode(s), 1 signature(s)
> iucode-tool: Uploading selected microcodes to: /dev/cpu/microcode
> iucode-tool: /dev/cpu/microcode: 1 microcode entries uploaded, 13312 bytes

Ah, dammit. I'm re-testing it now, and as you said, the microcode
isn't actually loading. I was testing with
arch/x86/kernel/cpu/{core,intel}.c added to
/sys/kernel/debug/dynamic_debug/control, I guess I must have decided
that it worked when I saw this:

[ 159.485550] microcode: CPU0 found a matching microcode update with
version 0x25 (current=0x19)
[ 159.485588] microcode: CPU1 found a matching microcode update with
version 0x25 (current=0x19)
[ 159.485615] microcode: CPU2 found a matching microcode update with
version 0x25 (current=0x19)
[ 159.485640] microcode: CPU3 found a matching microcode update with
version 0x25 (current=0x19)
[ 159.485664] microcode: CPU4 found a matching microcode update with
version 0x25 (current=0x19)
[ 159.485689] microcode: CPU5 found a matching microcode update with
version 0x25 (current=0x19)
[ 159.485713] microcode: CPU6 found a matching microcode update with
version 0x25 (current=0x19)
[ 159.485731] microcode: CPU7 found a matching microcode update with
version 0x25 (current=0x19)

I thought I had checked /sys/devices/system/cpu/cpu0/microcode/version
afterwards. But apparently I didn't. Bleh. Sorry about that.