Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
early and late microcode loading does not work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ConiKost
Developer
Developer


Joined: 11 Jan 2005
Posts: 1370

PostPosted: Wed Jan 08, 2025 12:05 am    Post subject: early and late microcode loading does not work Reply with quote

I am having troble to get my intel microcode updated. I am out of ideas, what could go wrong.

CPU: Xeon E3-1275v6
Kernel: 6.12.8

Default microcode from BIOS seems:
Code:
[   17.182429] microcode: Current revision: 0x000000f8


Needed options are enabled:
Code:
CONFIG_EXTRA_FIRMWARE="i915/kbl_dmc_ver1_04.bin i915/kbl_guc_70.1.1.bin i915/kbl_huc_4.0.0.bin intel-ucode/06-9e-09 intel-ucode/06-9e-0a intel-ucode/06-9e-0b intel-ucode/06-9e-0c intel-ucode/06-9e-0d"
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware"
CONFIG_MICROCODE=y
CONFIG_MICROCODE_LATE_LOADING=y


According to kernel documentation, loading early microcode via including it in kernel should work: The Linux Microcode Loader (23.4. Builtin microcode).

Correct files are also present:
Code:
$ ls -la /lib/firmware/intel-ucode
-rw-r--r-- 1 root root 108544  7. Jan 18:22 06-9e-09
-rw-r--r-- 1 root root 105472  7. Jan 18:22 06-9e-0a
-rw-r--r-- 1 root root 106496  7. Jan 18:22 06-9e-0b
-rw-r--r-- 1 root root 106496  7. Jan 18:22 06-9e-0c
-rw-r--r-- 1 root root 106496  7. Jan 18:22 06-9e-0d


According to iucode_tool, files are correct:
Code:
$ iucode_tool -lS /lib/firmware/intel-ucode
iucode_tool: system has processor(s) with signature 0x000906e9
microcode bundle 1: /lib/firmware/intel-ucode/06-9e-0d
microcode bundle 2: /lib/firmware/intel-ucode/06-9e-0a
microcode bundle 3: /lib/firmware/intel-ucode/06-9e-09
microcode bundle 4: /lib/firmware/intel-ucode/06-9e-0b
microcode bundle 5: /lib/firmware/intel-ucode/06-9e-0c
selected microcodes:
  003/001: sig 0x000906e9, pf_mask 0x2a, 2023-09-28, rev 0x00f8, size 108544
  002/001: sig 0x000906ea, pf_mask 0x22, 2024-02-01, rev 0x00f8, size 105472
  004/001: sig 0x000906eb, pf_mask 0x02, 2024-02-01, rev 0x00f6, size 106496
  005/001: sig 0x000906ec, pf_mask 0x22, 2024-02-01, rev 0x00f8, size 106496
  001/001: sig 0x000906ed, pf_mask 0x22, 2024-02-05, rev 0x0100, size 106496


Yet it does not work. I am not seing any message in "dmesg" which could say, that microcode has been early updated. Even "cat /proc/cpuinfo" confirms, that only stock microcode is enabled.

While discouraged by upsteam, I also wanted to test loading "late" microcode. This also fails for me.

Code:
$ ls -la /sys/devices/system/cpu/microcode/reload
--w------- 1 root root 4096  8. Jan 01:03 /sys/devices/system/cpu/microcode/reload

$ echo 1 > /sys/devices/system/cpu/microcode/reload
echo: write error: no such file or directory


But 'dmesg' producde a single log output:
Code:
[ 1789.362419] Loading firmware: intel-ucode/06-9e-09


The file is clearly there. So what I am missing here? IMHO all is correct according documentation and should work.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5292
Location: Bavaria

PostPosted: Wed Jan 08, 2025 12:53 am    Post subject: Reply with quote

ConiKost,

You will get a message for a newer microcode only if the microcode your UEFI (BIOS) provide is older than the microcode file you gave the kernel. In your case f8 is the actual version for 06-9e-09 ->
https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/commit/41af34500598418150aa298bb04e7edacc547897
Code:
KBL-G/H/S/X/E3 | B0       | 06-9e-09/2a | 000000f4 | 000000f8 | Core Gen7; Xeon E3 v6

(complete list: https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/blob/main/releasenote.md )

So, you have to wait for a newer version and then you should see this (from my machine):
Code:
[    9.323217] microcode: Current revision: 0x0000012b
[    9.323219] microcode: Updated early from: 0x00000113

Be aware that the old message at timestamp 0.0000 does not exist anymore (see the Update in: https://forums.gentoo.org/viewtopic-t-1065464.html)

(I had the same "problem" here: https://forums.gentoo.org/viewtopic-t-1163795.html )
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
ConiKost
Developer
Developer


Joined: 11 Jan 2005
Posts: 1370

PostPosted: Wed Jan 08, 2025 7:04 am    Post subject: Reply with quote

pietinger wrote:
You will get a message for a newer microcode only if the microcode your UEFI (BIOS) provide is older than the microcode file you gave the kernel. In your case f8 is the actual version for 06-9e-09 ->
https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/commit/41af34500598418150aa298bb04e7edacc547897
Code:
KBL-G/H/S/X/E3 | B0       | 06-9e-09/2a | 000000f4 | 000000f8 | Core Gen7; Xeon E3 v6

(complete list: https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/blob/main/releasenote.md )

So, you have to wait for a newer version and then you should see this (from my machine):


Are you really sure, that this is correct? I have my doubts. But before I explain, I have a question: Do all the same CPU models should always get the same current microcode?

I have a different system, which means not the same mainboard, but the same CPU. But not running Gentoo, but instead Arch Linux.
CPU: E3-1275v6
Mainboard: Fujitsu D3417-B2

Code:
[    6.919330] microcode: Current revision: 0x000000fa
[    6.919333] microcode: Updated early from: 0x000000ca


You can see, that even the initial microcode 0xca is older than 0xf8 on my other mainboard but updated to 0xfa.

And it is the same cpu:
Code:
$ cat /proc/cpuinfo|grep name
model name      : Intel(R) Xeon(R) CPU E3-1275 v6 @ 3.80GHz

$ cat /proc/cpuinfo|grep microcode
microcode       : 0xfa


So how can be explained that? Based on that I would also expect, that 000000f8 is also being updated to 000000fa?
The system, where it's not updated is a Supermicro X11SSi-LN4F, but same cpu.

Code:
$ cat /proc/cpuinfo|grep name
model name      : Intel(R) Xeon(R) CPU E3-1275 v6 @ 3.80GHz

$ cat /proc/cpuinfo|grep microcode
microcode       : 0xf8


pietinger wrote:

Code:
[    9.323217] microcode: Current revision: 0x0000012b
[    9.323219] microcode: Updated early from: 0x00000113

Be aware that the old message at timestamp 0.0000 does not exist anymore (see the Update in: https://forums.gentoo.org/viewtopic-t-1065464.html)


Yes, I know.

--------

Update: I just checked newest sys-firmware/intel-microcode-20241112_p20241103. This includes 000000fa.

Code:
$ iucode_tool -lS /lib/firmware/intel-ucode
iucode_tool: system has processor(s) with signature 0x000906e9
microcode bundle 1: /lib/firmware/intel-ucode/06-9e-0d
microcode bundle 2: /lib/firmware/intel-ucode/06-9e-0a
microcode bundle 3: /lib/firmware/intel-ucode/06-9e-09
microcode bundle 4: /lib/firmware/intel-ucode/06-9e-0b
microcode bundle 5: /lib/firmware/intel-ucode/06-9e-0c
selected microcodes:
  003/001: sig 0x000906e9, pf_mask 0x2a, 2024-03-07, rev 0x00fa, size 106496
  002/001: sig 0x000906ea, pf_mask 0x22, 2024-02-01, rev 0x00f8, size 105472
  004/001: sig 0x000906eb, pf_mask 0x02, 2024-02-01, rev 0x00f6, size 106496
  005/001: sig 0x000906ec, pf_mask 0x22, 2024-02-01, rev 0x00f8, size 106496
  001/001: sig 0x000906ed, pf_mask 0x22, 2024-02-05, rev 0x0100, size 106496


But it's not being loaded. As reported, no early and not late. No update message during early and same error message for late loading.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5292
Location: Bavaria

PostPosted: Wed Jan 08, 2025 12:28 pm    Post subject: Reply with quote

ConiKost wrote:
Are you really sure, that this is correct? I have my doubts. But before I explain, I have a question: Do all the same CPU models should always get the same current microcode?

Yes, the - exact - same CPU models use the same microcode ... but a CPU can have different steppings. What happens if you make the following query for all “identical” CPUs:
Code:
# dmesg | grep stepping

Is it really the same ..-..-09 (stepping) for your other CPU?

(You get the same information also with "lscpu" and "cat /proc/cpuinfo"; but here it is in decimal and NOT in hexadecimal; from my station:
Code:
[    4.376483] smpboot: CPU0: 13th Gen Intel(R) Core(TM) i9-13900K (family: 0x6, model: 0xb7, stepping: 0x1)
<=>
cpu family      : 6
model           : 183
stepping        : 1

=> 183dec == b7hex

and therefore I have/use:

CONFIG_EXTRA_FIRMWARE="intel-ucode/06-b7-01 i915/adls_dmc_ver2_01.bin rtl_nic/rtl8125b-2.fw i915/tgl_guc_70.bin i915/tgl_huc.bin"


BTW: You need only ONE microcode file in your CONFIG_EXTRA_FIRMWARE ;-)

... and I really dont't recommend "late loading". 8)

.. and I am not a fan of "iucode_tool" ... because it confuse people :lol:
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5292
Location: Bavaria

PostPosted: Wed Jan 08, 2025 1:38 pm    Post subject: Reply with quote

I have checked it again: The last update for THIS CPU (-09) was on 20240312 (from previously f4) to f8. Since then there have only been updates for the other CPUs (-0a,-0b,0c and -0d) on 20240813 ... but there are also unofficial updates ... maybe ARCH uses them?
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
ConiKost
Developer
Developer


Joined: 11 Jan 2005
Posts: 1370

PostPosted: Wed Jan 08, 2025 1:47 pm    Post subject: Reply with quote

pietinger wrote:
Yes, the - exact - same CPU models use the same microcode ... but a CPU can have different steppings. What happens if you make the following query for all “identical” CPUs:
Code:
# dmesg | grep stepping



Well, so 0xfa should be the latest Microcode for my CPU.

pietinger wrote:

Is it really the same ..-..-09 (stepping) for your other CPU?


Yes, I just checked. Both machines are stepping 9.

pietinger wrote:

(You get the same information also with "lscpu" and "cat /proc/cpuinfo"; but here it is in decimal and NOT in hexadecimal; from my station:
[code][ 4.376483] smpboot: CPU0: 13th Gen Intel(R) Core(TM) i9-13900K (family: 0x6, model: 0xb7, stepping: 0x1)
<=>
cpu family : 6
model : 183
stepping : 1

=> 183dec == b7hex


I can't say, why your is other. But your CPU is much newer than my Xeon (Kaby Lake 7th Gen).

pietinger wrote:

BTW: You need only ONE microcode file in your CONFIG_EXTRA_FIRMWARE ;-)


Thats a good hint, thank you!


pietinger wrote:
... and I really dont't recommend "late loading". 8)

.. and I am not a fan of "iucode_tool" ... because it confuse people :lol:


I know. It was meant as last resort for testing. Still: Why does it not work? At least I would expect, that this works.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3843
Location: Rasi, Finland

PostPosted: Wed Jan 08, 2025 3:00 pm    Post subject: Reply with quote

Side note:
    CONFIG_MICROCODE_LATE_LOADING is (being?) deprecated, since it has some issues.

_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5292
Location: Bavaria

PostPosted: Wed Jan 08, 2025 3:01 pm    Post subject: Reply with quote

ConiKost wrote:
I know. It was meant as last resort for testing. Still: Why does it not work? At least I would expect, that this works.

Have you checked the file /lib/firmware/intel-ucode/06-9e-09 from ARCH with our Gentoo for equality?

If yes,

Now comes a very “simple” question - I would like to say in advance that there are two ways to do an (early) microcode update:
1. as a “built-in” file “in” the kernel, or
2. as a file located in an initramfs (if you have a kernel with initramfs).

If you use (1), you MUST of course also recompile the kernel, SO that the microcode file is also copied “IN” the kernel (yes, I know it's a PE file).

With (2) “only” the initramfs has to be rebuilt == the microcode file has to be copied into the initramfs, and not the complete kernel.

The file /lib/firmware/intel-ucode/06-9e-09 itself is never loaded directly (during early loading).
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5292
Location: Bavaria

PostPosted: Wed Jan 08, 2025 3:13 pm    Post subject: Reply with quote

I thought about it again ... and because the mainboard is a Supermicro ... do you perhaps have an option in the BIOS that “protects” the CPU ... from an update? (I'm not familiar with these mainboards; but that's the last possibility I can (logically) see; because your kernel options are really correct).
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3843
Location: Rasi, Finland

PostPosted: Wed Jan 08, 2025 4:14 pm    Post subject: Reply with quote

pietinger wrote:
With (2) “only” the initramfs has to be rebuilt == the microcode file has to be copied into the initramfs, and not the complete kernel.
Side note 2:
    For kernel being able to load microcode early from initramfs image, the image needs to be uncompressed. That why it's common to have microcode as a separate cpio image or simply concatenated along with (compressed) main initramfs image like the following:
    Code:
    cat ucode.img initramfs.img.gz > combined.img
      I have actually tested this and it works.

_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
ConiKost
Developer
Developer


Joined: 11 Jan 2005
Posts: 1370

PostPosted: Wed Jan 08, 2025 11:29 pm    Post subject: Reply with quote

Zucca wrote:
Side note:
    CONFIG_MICROCODE_LATE_LOADING is (being?) deprecated, since it has some issues.


Sure, config option is enabled in kernel and the interface is there. Anyway, it's not the goal I want to achieve, only testing.

pietinger wrote:

Have you checked the file /lib/firmware/intel-ucode/06-9e-09 from ARCH with our Gentoo for equality?


Yes, checked by hashsum, same file.


pietinger wrote:

If yes,

Now comes a very “simple” question - I would like to say in advance that there are two ways to do an (early) microcode update:
1. as a “built-in” file “in” the kernel, or
2. as a file located in an initramfs (if you have a kernel with initramfs).

If you use (1), you MUST of course also recompile the kernel, SO that the microcode file is also copied “IN” the kernel (yes, I know it's a PE file).


Yes, I am aware of this. I compiled everytime the kernel new. So I can rule out this.

pietinger wrote:

With (2) “only” the initramfs has to be rebuilt == the microcode file has to be copied into the initramfs, and not the complete kernel.


Also aware of this. Since I do have my own initeramfs (cpio uncompressed!), I also tried to append together with intel-uc.bin, but no luck.

pietinger wrote:

The file /lib/firmware/intel-ucode/06-9e-09 itself is never loaded directly (during early loading).


Yes. This is only taken by CONFIG_EXTRA_FIRMWARE during kernel compilation.

pietinger wrote:
I thought about it again ... and because the mainboard is a Supermicro ... do you perhaps have an option in the BIOS that “protects” the CPU ... from an update? (I'm not familiar with these mainboards; but that's the last possibility I can (logically) see; because your kernel options are really correct).


No, there is no such option to prevent microcode updates "in memory". Only UEFI/BIOS updates itself, but this option is disabled.

Zucca wrote:
Side note 2:
    For kernel being able to load microcode early from initramfs image, the image needs to be uncompressed. That why it's common to have microcode as a separate cpio image or simply concatenated along with (compressed) main initramfs image like the following:
    Code:
    cat ucode.img initramfs.img.gz > combined.img
      I have actually tested this and it works.


Thats why I am out of ideas. I also did tested this, but it just does not work. My cpio initramfs is uncompressed build into the kernel. Before doing that, ucode.img is included into that, like in your example.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5292
Location: Bavaria

PostPosted: Thu Jan 09, 2025 12:16 am    Post subject: Reply with quote

Hmm ... what happens if you boot with our GentooLiveCD?

... and do a "dmesg | grep microcode". Is there a message like we want?

If not, the same questions: What happens if you boot with (the newest) UbuntuLiveCD? ... ?


I just had a crazy idea/question ... you said you have ALSO an initramfs WITH the microcode-file - together with the BUILT-IN microcode-file ... how does the system react, if there are two (identical) microcode-files available? What happens if you clear the EXTRA_FIRMWARE (only microcode; no firmware for other hardware) (and recompile the kernel) and use only the microcode from your initramfs? What happens if you provide the microcode the other way around?
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
ConiKost
Developer
Developer


Joined: 11 Jan 2005
Posts: 1370

PostPosted: Thu Jan 09, 2025 5:04 pm    Post subject: Reply with quote

Supermicro was so kind to provide me an updated beta BIOS, which contains the newest 0xfa microcode :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum