Timecounter HPET frequency 19200000 Hz quality 950
Systems with Intel Apollo Lake processors with F-1 (A) stepping (CPUID 506CA) may hang at the Timecounter "HPET" frequency 19200000 Hz quality 950 point when FreeBSD 13 boots. This is caused by an error in the MONITOR/MWAIT functions in the processor. To solve this problem, you can either disable the MONITOR/MWAIT functions in the BIOS or use the FreeBSD boot parameter set machdep.idle_mwait=0 to disable these functions. Future FreeBSD versions will generally disable these functions for these processors, so the problem will no longer occur there.
Affected systems
Affected are systems with:
- Intel Apollo Lake CPUs with CPUID 506CA (Stepping F-1)
- FreeBSD 13 and systems based on FreeBSD (e.g. OPNsense)
Problem
The FreeBSD 13 boot process hangs at the following point:
- Timecounter "HPET" frequency 19200000 Hz quality 950
Here is an excerpt of an affected system (tested with OPNsense 23.1-rc1):
[...] FreeBSD 13.1-RELEASE-p5 stable/23.1-n250368-9ba5919b1b1 SMP amd64 [...] FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303) VT(efifb): resolution 800x600 CPU: Intel(R) Celeron(R) CPU J3455 @ 1.50GHz (1497.60-MHz K8-class CPU) Origin="GenuineIntel" Id=0x506ca Family=0x6 Model=0x5c Stepping=10 [...] hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff irq 8 on acpi0 Timecounter "HPET" frequency 19200000 Hz quality 950
Root cause
The cause of the problem is the CPU Errata APL30 - A Store Instruction May Not Wake up MWAIT. The MONITOR/MWAIT instruction pair normally allows a logical processor to wait in a sleep state until a store occurs in a defined memory address range. Because of this bug, saves to the defined address range MWAIT may not cause execution to resume.[1] As a result, FreeBSD stops at the point Timecounter "HPET" frequency 19200000 Hz quality 950 during startup on affected systems.
Solution
To solve the boot problem, the MONITOR/MWAIT functions are disabled. This can be solved either via the BIOS, via a boot parameter or via a patch in the operating system.
BIOS
If the BIOS offers an option to disable the MONITOR/MWAIT functions, these functions can be disabled there. The system then starts without getting stuck at Timecounter "HPET" frequency 19200000 Hz quality 950[2]
Boot parameter set machdep.idle_mwait=0
The boot parameter set machdep.idle_mwait=0 disables the use of MONITOR/MWAIT. This causes the system to boot reliably:
Type '?' for a list of commands, 'help' for more detailed help. OK set machdep.idle_mwait=0 OK boot [...] FreeBSD 13.1-RELEASE-p5 stable/23.1-n250368-9ba5919b1b1 SMP amd64 FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303) VT(efifb): resolution 800x600 CPU: Intel(R) Celeron(R) CPU J3455 @ 1.50GHz (1497.60-MHz K8-class CPU) Origin="GenuineIntel" Id=0x506ca Family=0x6 Model=0x5c Stepping=10 [...] hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff irq 8 on acpi0 Timecounter "HPET" frequency 19200000 Hz quality 950 Event timer "HPET" frequency 19200000 Hz quality 550 Event timer "HPET1" frequency 19200000 Hz quality 440 Event timer "HPET2" frequency 19200000 Hz quality 440 Event timer "HPET3" frequency 19200000 Hz quality 440 Event timer "HPET4" frequency 19200000 Hz quality 440 Timecounter "ACPI-fast" frequency 3579545 Hz quality 900 acpi_timer0: <32-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0 pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0 pci0: <ACPI PCI bus> on pcib0 [...] igb1: link state changed to UP
Boot parameter set machdep.disable_msix_migration=1
Alternatively, the boot parameter set machdep.disable_msix_migration=1 causes the system to boot completely. Interrupts are then executed on the core itself, the MWAIT function then wakes up again. We recommend however the boot parameter set machdep.idle_mwait=0, as MONITOR/MWAIT should generally not be used on these processors.
Using newer FreeBSD version
Newer FreeBSD versions disable the use of MONITOR/MWAIT not only for the older CPU stepping 506C9, but also for the newer stepping 506CA[3] or 506C*.[4] Future FreeBSD will therefore not have this problem.
We have opened an issue at OPNsense, so that the problem can be fixed with an upcoming OPNsense update as well.[5]
Further Information
- workaround intel apollo lake errata (mail-index.netbsd.org, 01.07.2018)
- https://github.com/freebsd/freebsd-src/commit/122405c9034b624dd6771d578ef2467aa96cc145
- x86 instruction listings - Added with other cross-vendor extensions (en.wikipedia.org) While the MONITOR and MWAIT instructions were introduced at the same time as SSE3, they have their own CPUID flag that needs to be checked separately from the SSE3 CPUID flag (e.g. Athlon64 X2 and VIA C7 supported SSE3 but not MONITOR.)
- x86 Instruction Set Reference - MWAIT - Monitor Wait (mudongliang.github.io)
References
- ↑ 1.0 1.1 Intel Pentium and Celeron Processor N- and J- Series (www.intel.com) Page 25: APL30 - A Store Instruction May Not Wake up MWAIT
- ↑ PfSense on Zotac Zbox CI327 (jselec.nl, 27.07.2018) Boot hangs showing the following line: Timecounter “HPET” frequency 19200000 Hz quality 950 - You can solve this by disabling in Bios: /Features/CPU Configuration/Monitor M-Wait -> disabled
- ↑ x86: Add another cpuid for Apollo Lake errata APL30 (freebsd-src, 09. 08.2022)
- ↑ x86: ignore stepping for APL30 errata (freebsd-src, 12.01.2023)
- ↑ Apollo Lake J3455 CPUID 506CA hangs on boot - APL30 MWAIT issue (github.com/opnsense/src/issues, 01/25/2023)
Author: Werner Fischer Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.
|