Re: 14.0-RELEASE-p6 High acpi_task_* CPU utilization

From: Steve Bernacki <steve_at_copacetic.net>
Date: Thu, 28 Mar 2024 19:29:01 UTC
Some additional information: I booted into Linux and noted similar 
behavior. I was able to identify that the cause of the consumed CPU us 
due to tens of thousands of interrupts being thrown every second:

# grep -Ev "^[ ]*0" /sys/firmware/acpi/interrupts/gpe??; sleep 1; echo 
""; grep -Ev "^[ ]*0" /sys/firmware/acpi/interrupt
s/gpe??
/sys/firmware/acpi/interrupts/gpe0F: 7932735     STS enabled unmasked
/sys/firmware/acpi/interrupts/gpe2C: 7932751  EN STS enabled unmasked
/sys/firmware/acpi/interrupts/gpe39: 7932147  EN STS enabled unmasked

/sys/firmware/acpi/interrupts/gpe0F: 7940917     STS enabled unmasked
/sys/firmware/acpi/interrupts/gpe2C: 7940918  EN STS enabled unmasked
/sys/firmware/acpi/interrupts/gpe39: 7940307     STS enabled unmasked

Under Linux, I was able to mask these interrupts [1], and CPU 
utilization dropped to zero:

# echo "mask" > /sys/firmware/acpi/interrupts/gpe0F
# echo "mask" > /sys/firmware/acpi/interrupts/gpe2C
# echo "mask" > /sys/firmware/acpi/interrupts/gpe39

Booting back into FreeBSD, I was able to confirm that acpi0 is throwing 
the interrupts:

steve@fw2:~ $ vmstat -i
interrupt                          total       rate
irq1: atkbd0                           2          0
irq9: acpi0                       652619       5426
irq39: sdhci_pci0                     13          0
cpu0:timer                        131000       1089
cpu1:timer                         95780        796
cpu2:timer                        109171        908
cpu3:timer                        105658        878
irq128: hdac0                         10          0
irq129: ahci0                       1698         14
irq130: re0                          869          7
irq132: xhci0                        156          1
irq133: iwm0                          22          0
Total                            1096998       9120

I'm going to report this to the system manufacturer, but I don't have 
high hopes that they'll fix the BIOS. Is there a way under FreeBSD to 
mask/disable these noisy interrupts? I did some searching but could not 
find the FreeBSD equivalent of masking in Linux.

Thanks
Steve

[1] 
https://unix.stackexchange.com/questions/588018/kworker-thread-kacpid-notify-kacpid-hogging-60-70-of-cpu

On 3/28/2024 11:20 AM, Steve Bernacki wrote:
> Hello,
>
> I've just installed FreeBSD 14.0-RELEASE-p6 (GENERIC) on a AWOW Mini 
> PC [1]. Completely idle, top(1) reports unusually high system CPU usage:
>
>   CPU:  0.0% user,  0.0% nice, 27.7% system,  0.0% interrupt, 72.3% idle
>
> Running top -SH reveals that the CPU time is being consumed by kernel 
> acpi_tasks:
>
>   PID USERNAME    PRI NICE   SIZE    RES STATE    C   TIME    WCPU 
> COMMAND
>    11 root        187 ki31     0B    64K CPU0     0  29:22  97.15% 
> idle{idle: cpu0}
>    11 root        187 ki31     0B    64K RUN      2  22:05  74.21% 
> idle{idle: cpu2}
>    11 root        187 ki31     0B    64K CPU3     3  22:11  73.37% 
> idle{idle: cpu3}
>    11 root        187 ki31     0B    64K RUN      1  21:59  70.21% 
> idle{idle: cpu1}
>     0 root          8    -     0B  1456K -        0   8:08  29.74% 
> kernel{acpi_task_1}
>     0 root          8    -     0B  1456K CPU3     3   8:30  28.67% 
> kernel{acpi_task_2}
>     0 root          8    -     0B  1456K CPU1     1   8:31  26.09% 
> kernel{acpi_task_0}
>
> The BIOS configurables for this system are pretty sparse; I'm not able 
> to see or adjust any ACPI settings. Relevant (I hope) snippets from 
> dmesg below:
>
> ======
> CPU: Intel(R) Celeron(R) CPU N3450 @ 1.10GHz (1094.62-MHz K8-class CPU)
>   Origin="GenuineIntel"  Id=0x506c9  Family=0x6  Model=0x5c Stepping=9
> Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> 
>
> Features2=0x4ff8ebb7<SSE3,PCLMULQDQ,DTES64,DS_CPL,VMX,EST,TM2,SSSE3,SDBG,CX16,xTPR,PDCM,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,RDRAND> 
>
>   AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
>   AMD Features2=0x101<LAHF,Prefetch>
>   Structured Extended 
> Features=0x2294e283<FSGSBASE,TSCADJ,SMEP,ERMS,NFPUSG,MPX,PQE,RDSEED,SMAP,CLFLUSHOPT,PROCTRACE,SHA>
>   XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
>   VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID,VID,PostIntr
>   TSC: P-state invariant, performance statistics
> real memory  = 6442450944 (6144 MB)
> avail memory = 5978120192 (5701 MB)
> Event timer "LAPIC" quality 600
> ACPI APIC Table: <INTEL  EDK2    >
> [snip]
> smbios0: <System Management BIOS> at iomem 0xf05e0-0xf05fe
> smbios0: Version: 3.0, BCD Revision: 3.0
> aesni0: <AES-CBC,AES-CCM,AES-GCM,AES-ICM,AES-XTS,SHA1,SHA256>
> acpi0: <ALASKA A M I >
> acpi0: Power Button (fixed)
> unknown: I/O range not supported
> ACPI Error: No handler for Region [ECF2] (0xfffff800038c2680) 
> [EmbeddedControl] (20221020/evregion-292)
> ACPI Error: Region EmbeddedControl (ID=3) has no handler 
> (20221020/exfldio-428)
> ACPI Error: Aborting method \134_SB.PCI0.SBRG.H_EC.BAT0._STA due to 
> previous error (AE_NOT_EXIST) (20221020/psparse-689)
> cpu0: <ACPI CPU> on acpi0
> attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
> [snip]
> Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
> acpi_timer0: <32-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
> acpi_ec0: <Embedded Controller: GPE 0x2c> port 0x62,0x66 on acpi0
> pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
> pci0: <ACPI PCI bus> on pcib0
> ======
>
> Relevant kenv output:
>
> ======
> acpi.oem="ALASKA"
> acpi.revision="2"
> acpi.rsdp="0x000f05b0"
> acpi.rsdt="0x793a5030"
> acpi.xsdt="0x00000000793a50c0"
> acpi.xsdt_length="36"
> acpi_dsdt_load="NO"
> acpi_dsdt_name="/boot/acpi_dsdt.aml"
> acpi_dsdt_type="acpi_dsdt"
> acpi_video_load="NO"
> hint.acpi_throttle.0.disabled="1"
> smbios.bios.reldate="09/30/2022"
> smbios.bios.revision="4.6"
> smbios.bios.vendor="American Megatrends Inc."
> smbios.bios.version="4.06"
> smbios.chassis.type="Mini PC"
> smbios.memory.enabled="6291456"
> smbios.planar.maker="AWOW Technology Co., Ltd."
> smbios.planar.product="PC BOX"
> smbios.system.product="AK34"
> ======
>
> The few search results for similar issues I've found suggest trying to 
> disable ACPI altogether, which just results in the kernel immediately 
> panicking when booting.
>
> Any suggestions on how I can troubleshoot this further?
>
> Thank you
> Steve
>
> [1] https://www.amazon.com/gp/product/B0B4RMLCH7/?th=1
>
>
>