sysutils/devcpu-data: Update AMD microcode.
ClosedPublic

Authored by sbruno on May 22 2018, 5:24 PM.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
sbruno created this revision.May 22 2018, 5:24 PM

On my FX-8150, previous update was:

May 21 07:05:16 lab microcode_update[1093]: /usr/local/share/cpucontrol/microcode_amd_fam15h.bin: updating cpu /dev/cpuctl0 to revision 0x600063d... done.

With this update:

May 22 11:23:29 lab microcode_update[38938]: /usr/local/share/cpucontrol/microcode_amd_fam15h.bin: updating cpu /dev/cpuctl0 to revision 0x600063e... done.

∴sudo service microcode_update restart
Updating CPU Microcode...
Done.

I see nothing on the console.

markj added a comment.May 22 2018, 9:46 PM

I see nothing in /var/log/messages when attempting to apply the update to:

CPU: AMD A10-8700P Radeon R6, 10 Compute Cores 4C+6G (1796.66-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x660f01  Family=0x15  Model=0x60  Stepping=1

Haven't dug into it yet.

jmd added a comment.May 23 2018, 2:08 AM

On a AMD Threadripper 1900X I see "microcode updating..." and output of the CPU information. On a Carrizo APU, I see "microcode updating..." and "done", nothing else. How to check it DTRT?

In D15523#327855, @jmd wrote:

On a AMD Threadripper 1900X I see "microcode updating..." and output of the CPU information. On a Carrizo APU, I see "microcode updating..." and "done", nothing else. How to check it DTRT?

If it did anything, its logged to /var/log/messages. Search for "microcode_update"

May 22 11:23:29 lab microcode_update[38938]: /usr/local/share/cpucontrol/microcode_amd_fam15h.bin: updating cpu /dev/cpuctl0 to revision 0x600063e... done.
May 22 11:23:30 lab kernel: CPU: AMD FX(tm)-8150 Eight-Core Processor            (3599.97-MHz K8-class CPU)
May 22 11:23:30 lab kernel:   Origin="AuthenticAMD"  Id=0x600f12  Family=0x15  Model=0x1  Stepping=2
May 22 11:23:30 lab kernel:   Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
May 22 11:23:30 lab kernel:   Features2=0x1e98220b<SSE3,PCLMULQDQ,MON,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,AESNI,XSAVE,OSXSAVE,AVX>
May 22 11:23:30 lab kernel:   AMD Features=0x2e500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM>
May 22 11:23:30 lab kernel:   AMD Features2=0x1c9bfff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,XOP,SKINIT,WDT,LWP,FMA4,NodeId,Topology,PCXC,PNXC>
May 22 11:23:30 lab kernel:   SVM: NP,NRIP,VClean,AFlush,DAssist,NAsids=65536
May 22 11:23:30 lab kernel:   TSC: P-state invariant, performance statistics
emaste added a comment.EditedMay 23 2018, 2:34 PM

You can also try x86info -a | grep Microcode before/after to confirm. In my case on an old FX-6100 I see Microcode patch level: 0x6000613 before and Microcode patch level: 0x600063d after (using the current devcpu-data package, not this patch).

On my AMD Ryzen Threadripper 1950X I see Microcode patch level: 0x8001127 before and after trying the microcode in this review (i.e., the new microcode_amd_fam17h.bin either does not contain microcode for Threadripper, or is not getting applied).

On my AMD Ryzen Threadripper 1950X I see Microcode patch level: 0x8001127 before and after trying the microcode in this review (i.e., the new microcode_amd_fam17h.bin either does not contain microcode for Threadripper, or is not getting applied).

I have yet to get a report of any "17h" machine ever updating. This concerns me a bit.

Trying out some debugging here. Can someone apply this patch
https://people.freebsd.org/~sbruno/cpucontrol.diff.txt

And send me the results of something like the following? I put the amd microcode files in a seperate dir and *removed* the devcpu-data port as cpucontrol will *always* look at /usr/local/share/cpucontrol if it exists.

http://dpaste.com/2EFKJRS

markj added a comment.May 24 2018, 8:51 PM

Trying out some debugging here. Can someone apply this patch
https://people.freebsd.org/~sbruno/cpucontrol.diff.txt

And send me the results of something like the following?

I get the same output, i.e., "CPU is not found in the equivalence table" for all files.

sbruno updated this revision to Diff 42991.May 25 2018, 3:30 PM

Update to catch linux-firmware commit 7518922bd5b98b137af7aaf3c836f5a498e91609

  • Processor Revision ID 0x00610f01 was accidently not included in the previous submitted microcode container file.
  • Update the Version for family 15h microcode .bin file

Trying out some debugging here. Can someone apply this patch
https://people.freebsd.org/~sbruno/cpucontrol.diff.txt

And send me the results of something like the following?

I get the same output, i.e., "CPU is not found in the equivalence table" for all files.

Can you post the detection output for your CPU? I assume you have a 17h here, but I'm not sure. Something like this would be interesting to see.

amd10h.c:151 cpucontrol: checking /tmp/amd/microcode_amd_fam17h.bin for update.
amd10h.c:220 cpucontrol: equiv_id: 6012
amd10h.c:256 cpucontrol: firmware processort_rev_id 8012, equiv_id 6012
amd10h.c:145 cpucontrol: amd10h_update: found cpu family 0xf model 0x1 stepping 0x2 extfamily 0x6 extmodel 0.
amd10h.c:146 cpucontrol: microcode revision 0x600063e
amd10h.c:151 cpucontrol: checking /tmp/amd/microcode_amd.bin for update.
amd10h.c:225 cpucontrol: CPU is not found in the equivalence table

Hrm. I guess this *is* working, at least for the EPYC I have at work.

With previous microcode files:

cpucontrol: found cpu family 0xf model 0x1 stepping 0x2 extfamily 0x8 extmodel 0.
cpucontrol: microcode revision 0x8001227
cpucontrol: checking /usr/local/share/cpucontrol/microcode_amd_fam17h.bin.orig for update.
cpucontrol: equiv_id: 8012
cpucontrol: patch_id 8001213, revision 8001227

With new microcode files:

cpucontrol: found cpu family 0xf model 0x1 stepping 0x2 extfamily 0x8 extmodel 0.
cpucontrol: microcode revision 0x8001227
cpucontrol: checking /usr/local/share/cpucontrol/microcode_amd_fam17h.bin for update.
cpucontrol: equiv_id: 8012
cpucontrol: patch_id 8001227, revision 8001227

I sure wish I could fine someone running a 17h that actually applies this update. :-(

cem added a comment.EditedMay 25 2018, 4:41 PM

cpucontrol print on multiple input files could be a lot more clear :(. I disambiguated it by copying fam17h to its own directory:

$ mkdir tmp
$ cp -a work/stage/usr/local/share/cpucontrol/microcode_amd_fam17h.bin tmp
$ sudo cpucontrol -vvv -n -d ./tmp -u /dev/cpuctl0
amd10h_probe: family: 0x17
cpucontrol: skipping ./tmp/.: is a directory
cpucontrol: skipping ./tmp/..: is a directory
amd10h_update: signature: 0x800f11
cpucontrol: found cpu family 0xf model 0x1 stepping 0x1 extfamily 0x8 extmodel 0.
cpucontrol: microcode revision 0x8001129
amd10h_update: installed_cpu: 0x600f20
amd10h_update: installed_cpu: 0x610f01
amd10h_update: installed_cpu: 0x700f01
amd10h_update: installed_cpu: 0x800f12
amd10h_update: installed_cpu: 0x800f11
cpucontrol: equiv_id: 8011
$ echo $?
0

Nothing in /var/log/messages. Patch level is 0x8001129 per x86info.

This is on TR (fam 17h). Does that help? :-)

In D15523#328831, @cem wrote:

cpucontrol print on multiple input files could be a lot more clear :(. I disambiguated it by copying fam17h to its own directory:

$ mkdir tmp
$ cp -a work/stage/usr/local/share/cpucontrol/microcode_amd_fam17h.bin tmp
$ sudo cpucontrol -vvv -n -d ./tmp -u /dev/cpuctl0
amd10h_probe: family: 0x17
cpucontrol: skipping ./tmp/.: is a directory
cpucontrol: skipping ./tmp/..: is a directory
amd10h_update: signature: 0x800f11
cpucontrol: found cpu family 0xf model 0x1 stepping 0x1 extfamily 0x8 extmodel 0.
cpucontrol: microcode revision 0x8001129
amd10h_update: installed_cpu: 0x600f20
amd10h_update: installed_cpu: 0x610f01
amd10h_update: installed_cpu: 0x700f01
amd10h_update: installed_cpu: 0x800f12
amd10h_update: installed_cpu: 0x800f11
cpucontrol: equiv_id: 8011
$ echo $?
0

Nothing in /var/log/messages. Patch level is 0x8001129 per x86info.

This is on TR (fam 17h). Does that help? :-)

Hrm... Can you run it with my diff for more debugging goodness? https://people.freebsd.org/~sbruno/cpucontrol.diff.txt

cem added a comment.EditedMay 25 2018, 5:19 PM

Hrm... Can you run it with my diff for more debugging goodness? https://people.freebsd.org/~sbruno/cpucontrol.diff.txt

Sure.

$ sudo -E $(make -V .OBJDIR)/cpucontrol.full -vvv -n -d ./tmp -u /dev/cpuctl0
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/cpucontrol.c:414 cpucontrol.full: skipping ./tmp/.: is a directory
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/cpucontrol.c:414 cpucontrol.full: skipping ./tmp/..: is a directory
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:145 cpucontrol.full: amd10h_update: found cpu family 0xf model 0x1 stepping 0x1 extfamily 0x8 extmodel 0.
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:146 cpucontrol.full: microcode revision 0x8001129
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:151 cpucontrol.full: checking ./tmp/microcode_amd_fam17h.bin for update.
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:220 cpucontrol.full: equiv_id: 8011
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:256 cpucontrol.full: firmware processort_rev_id 8012, equiv_id 8011

Nothing in /var/log/messages.

Given "firmware processort_rev_id 8012, equiv_id 8011," I think this "fam17h" firmware is only for Epyc. IIRC that was true of the earlier Meltdown/Spectre microcodes too. They expect consumer CPUs to get this update via BIOS, I think?

My spider sense is tingling as well.

amd10h_probe: family: 0x17
cpucontrol: skipping ./tmp/.: is a directory
cpucontrol: skipping ./tmp/..: is a directory
amd10h_update: signature: 0x800f11
cpucontrol: found cpu family 0xf model 0x1 stepping 0x1 extfamily 0x8 extmodel 0.

cpucontrol's probe finds family 0x17 ...

Can you instead try D155745

In D15523#328866, @cem wrote:

Hrm... Can you run it with my diff for more debugging goodness? https://people.freebsd.org/~sbruno/cpucontrol.diff.txt

Sure.

$ sudo -E $(make -V .OBJDIR)/cpucontrol.full -vvv -n -d ./tmp -u /dev/cpuctl0
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/cpucontrol.c:414 cpucontrol.full: skipping ./tmp/.: is a directory
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/cpucontrol.c:414 cpucontrol.full: skipping ./tmp/..: is a directory
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:145 cpucontrol.full: amd10h_update: found cpu family 0xf model 0x1 stepping 0x1 extfamily 0x8 extmodel 0.
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:146 cpucontrol.full: microcode revision 0x8001129
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:151 cpucontrol.full: checking ./tmp/microcode_amd_fam17h.bin for update.
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:220 cpucontrol.full: equiv_id: 8011
/usr/home/conrad/src/freebsd/usr.sbin/cpucontrol/amd10h.c:256 cpucontrol.full: firmware processort_rev_id 8012, equiv_id 8011

Nothing in /var/log/messages.

Given "firmware processort_rev_id 8012, equiv_id 8011," I think this "fam17h" firmware is only for Epyc. IIRC that was true of the earlier Meltdown/Spectre microcodes too. They expect consumer CPUs to get this update via BIOS, I think?

Seems reasonable to me. Thanks for digging in.

markj added a comment.May 25 2018, 7:57 PM

Trying out some debugging here. Can someone apply this patch
https://people.freebsd.org/~sbruno/cpucontrol.diff.txt

And send me the results of something like the following?

I get the same output, i.e., "CPU is not found in the equivalence table" for all files.

Can you post the detection output for your CPU? I assume you have a 17h here, but I'm not sure.

No, 15h. Using the latest diffs here and in D15574, I get:

cpucontrol: found cpu family 0x15 model 0 stepping 0x1 extfamily 0x6 extmodel 0x6.
cpucontrol: microcode revision 0x6006110
cpucontrol: checking //tmp/amd/microcode_amd.bin for update.
cpucontrol: CPU is not found in the equivalence table
cpucontrol: found cpu family 0x15 model 0 stepping 0x1 extfamily 0x6 extmodel 0x6.
cpucontrol: microcode revision 0x6006110
cpucontrol: checking //tmp/amd/microcode_amd_fam15h.bin for update.
cpucontrol: CPU is not found in the equivalence table
cpucontrol: found cpu family 0x15 model 0 stepping 0x1 extfamily 0x6 extmodel 0x6.
cpucontrol: microcode revision 0x6006110
cpucontrol: checking //tmp/amd/microcode_amd_fam16h.bin for update.
cpucontrol: CPU is not found in the equivalence table
cpucontrol: found cpu family 0x15 model 0 stepping 0x1 extfamily 0x6 extmodel 0x6.
cpucontrol: microcode revision 0x6006110
cpucontrol: checking //tmp/amd/microcode_amd_fam17h.bin for update.
cpucontrol: CPU is not found in the equivalence table
This revision was not accepted when it landed; it landed in state Needs Review.May 28 2018, 5:08 PM
Closed by commit rP471058: sysutils/devcpu-data (authored by sbruno, committed by ). · Explain Why
This revision was automatically updated to reflect the committed changes.