Skip to content

QEMU uses CPU when Linux guest is idle #282088

@proski

Description

@proski

brew config AND brew doctor output OR brew gist-logs <formula> link

> brew config && brew doctor
HOMEBREW_VERSION: 5.1.11-29-gf7c3d09
ORIGIN: https://github.com/Homebrew/brew
HEAD: f7c3d09a3d5c602a3107ac685f0a6d6468af196c
Last commit: 4 hours ago
Branch: main
Core tap JSON: 11 May 21:47 UTC
Core cask tap JSON: 11 May 21:47 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /var/run/com.apple.launchd.obcLyTor5X/org.xquartz:0
HOMEBREW_DOWNLOAD_CONCURRENCY: 28
HOMEBREW_EDITOR: nvim
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 14
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 4.0.3 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.3/bin/ruby
CPU: 14-core 64-bit arm_brava
Clang: 21.0.0 build 2100
Git: 2.50.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.4.1-arm64
CLT: 26.5.0.0.1777544298
Xcode: N/A
Rosetta 2: false
Your system is ready to brew.

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.
  • My issue is not about a failure to build a formula from source.

What were you trying to do (and why)?

I upgraded qemu from 10.2.1 to 11.0.0 on MacBook Pro M4 and discovered that CPU consumption on the host was about 900% for a 12-core emulated Linux machine, even when the VM wasn't doing anything. The laptop battery was discharging quickly. I stopped using qemu from homebrew and installed qemu 10.1.5 from nixos-darwin, which solved the issue.

I found the upstream issue today:
https://gitlab.com/qemu-project/qemu/-/work_items/3433

And here's the fix referenced in the issue:
https://patchew.org/QEMU/20260423170229.64655-1-philmd@linaro.org/20260423170229.64655-14-philmd@linaro.org/

Considering that Apple machines are specifically affected, would it be possible to make a patched qemu release for homebrew?

I hope the upstream makes a release soon, but there has been none at this time.

What happened (include all command output)?

900% CPU use on the host for 12-core Linux guess that was idle.

What did you expect to happen?

Less than 10% CPU use for idle Linux VMs.

Step-by-step reproduction instructions (by running brew commands)

brew update qemu

qemu-system-aarch64 \
	-run-with user=daemon \
	-smp cpus=12,sockets=1,cores=12,threads=1 \
	-m 32768 \
	-machine virt,gic-version=3 -cpu host -accel hvf \
	-nodefaults -nographic -vga none -audio none \
	-device virtio-net-pci,netdev=net0 -netdev user,id=net0,hostfwd=tcp::2022-:22 \
	-device virtio-rng-pci \
	-device virtio-blk-pci,drive=vda \
	-drive if=pflash,format=raw,file.filename=edk2-aarch64-code.fd,file.locking=off,readonly=on \
	-drive if=pflash,file.filename=/var/lib/vm/efi_vars.qcow2 \
	-drive if=none,media=disk,id=vda,file.filename=/var/lib/vm/n1.qcow2,discard=unmap,detect-zeroes=unmap

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream issueAn upstream issue report is needed

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions