[BUG] virt: geniezone: unimplemented GZVM_IRQFD_FLAG_RESAMPLE and dropped GZVM_IOEVENTFD MMIO notifications stall SMP Linux guests on mt6991
From: Chenyang Yu
Date: Fri Nov 27 2026 - 20:16:38 EST
Hi Yingshiuan, Ze-Yu, Liju, MediaTek GenieZone and Android/crosvm teams,
We are reporting two critical virtualization bugs in MediaTek's GenieZone
driver (drivers/virt/geniezone/) and EL2 hypervisor observed on production
mt6991 (Dimensity 9400) hardware running Android 16 / ACK 6.6.118 with AVF
crosvm and an unmodified Debian 13 ARM64 guest (Linux 6.12.118, 8 vCPUs).
Hardware & Software Versions:
- SoC / Device : MediaTek Dimensity 9400 (mt6991), OPPO Find X8 (PKB110)
- Android Build: Android 16 (API 36), PKB110_16.0.8.300(CN01)
- Host Kernel : 6.6.118-android15-8-gebdfad32d749-ab15099304-4k SMP PREEMPT
- VMM : Android 16 com.android.virt crosvm (ab13197479)
- Guest Kernel : Debian 6.12.118+deb13-cloud-arm64 (8 vCPUs, 4 GiB RAM)
========================================================================
Bug 1: GZVM_IRQFD_FLAG_RESAMPLE is accepted by gzvm_irqfd() but never
implemented, stalling level-triggered virtio-pci INTx queues
========================================================================
In drivers/virt/geniezone/gzvm_irqfd.c:
1. gzvm_irqfd() explicitly accepts GZVM_IRQFD_FLAG_RESAMPLE:
if (args->flags &
~(GZVM_IRQFD_FLAG_DEASSIGN | GZVM_IRQFD_FLAG_RESAMPLE))
return -EINVAL;
2. However, gzvm_irqfd_assign() completely ignores args->flags and
args->resamplefd. No resample eventfd_ctx is acquired, no
gzvm_irq_ack_notifier is registered, and gzvm_notify_acked_irq() is
not wired to guest VGIC EOI from EL2.
Impact on VMMs (crosvm):
Because GenieZone does not provide virtual GICv3 ITS (no MSI-X), crosvm
falls back to legacy PCI INTx (IRQ_TYPE_LEVEL_HIGH on GICv3 SPIs 36..41)
and registers GZVM_IRQFD with GZVM_IRQFD_FLAG_RESAMPLE. When register_irqfd
succeeds, crosvm assumes level resampling works (async_intr_status = false
in devices/src/virtio/interrupt.rs) and suppresses further irqfd triggers
whenever interrupt_status.fetch_or(mask) != 0, relying on resamplefd to
re-inject if interrupt_status != 0 upon guest EOI.
Whenever a host virtqueue completion races with the guest window between
reading/clearing the VirtIO PCI ISR byte and writing ICC_EOIR1_EL1,
interrupt_status transitions back to 1, no resample event ever arrives
after EOI, and all subsequent interrupts for that PCI device are
permanently suppressed.
Workaround confirmation:
Rewriting /pci/interrupt-map SPI trigger flags in the UEFI FDT from 0x4
(level-high) to 0x1 (edge-rising) prior to booting Linux completely
prevents this stall class.
Expected fix:
Either wire args->resamplefd end-to-end with EL2 VGIC EOI resampling (and
deassert the virtual SPI line prior to signaling resamplefd), or reject
GZVM_IRQFD_FLAG_RESAMPLE with -EINVAL until EL2 support is present (and
avoid pairing IRQ_TYPE_LEVEL_HIGH INTx with async_intr_status = false in
crosvm when resampling is unavailable).
(Note: while inspecting gzvm_vcpu.c and gzvm_irqchip_inject_irq(), we also
noticed gzvm_vcpu_wakeup_all() unconditionally wakes all GZVM_MAX_VCPUS
threads on every SPI injection and per-vCPU gzvm_vtimer expiry rather than
waking only the target vCPU(s), causing 7x redundant host context switches.)
========================================================================
Bug 2: Dropped GZVM_IOEVENTFD MMIO doorbell writes permanently wedge
VIRTIO_RING_F_EVENT_IDX virtqueues
========================================================================
Even with PCI SPIs patched to edge-triggered, guests intermittently hang
due to lost Guest-to-Host ioeventfd notifications when executing
vp_notify():
dmb oshst
strh w0, [x1] // 16-bit MMIO store to VirtIO-PCI Notify BAR
where crosvm registered the queue's notify address via GZVM_IOEVENTFD
with len = 0 (wildcard length/datamatch).
Case A - Live /proc/kcore proof on virtio-blk (guest IRQs enabled):
During normal multi-process file I/O over SSH, fdatasync/fsync/writeback
tasks hung in TASK_UNINTERRUPTIBLE (rq_qos_wait <- wbt_wait), while
hctx0..6 were idle (active = 0) and virtio-vsock (SSH) remained live.
/sys/kernel/debug/block/vda/hctx7/busy showed 2 requests stuck in_flight
(tag=54 READ, tag=55 WRITE) on vCPU 7.
Reading struct vring_virtqueue for virtio3 vq[7] live from /proc/kcore:
vring.num = 256
event (F_EVENT_IDX) = 1
num_added = 0
avail_idx_shadow = 561
vring.avail->idx = 561
vring.avail->used_event = 558
vring.used->idx = 558
vring.used->avail_event = 558
last_used_idx = 558
1. last_used_idx == used->idx == 558: the guest processed all completions
written by the host; no host->guest interrupt was lost.
2. used->avail_event == 558: the host [virtio_blk] worker last consumed
entry 557, published avail_event = 558, and slept on epoll_wait.
3. On submission 558 -> 559 (num_added = 1), virtqueue_kick_prepare()
computed (u16)(559 - 558 - 1) < 1 (true), cleared num_added = 0, and
executed vp_notify() (strh of 7 to GPA 0x2c01b01c) in normal task
context with guest IRQs enabled, advancing guest PC past strh. However,
the host eventfd was never signaled.
4. Subsequent submissions 559 -> 560 and 560 -> 561 observed
avail_event == 558, evaluated vring_need_event() == false, and did not
re-notify, leaving vq[7] permanently wedged.
Case B - 4-vCPU hard lockup on virtio-console hvc0 (guest IRQs disabled):
The same dropped GZVM_IOEVENTFD write hits virtio-console (hvc0, out_vq
GPA 0x2c003004) during boot log floods or interactive console echo.
Because Linux's put_chars() -> __send_to_port(..., in_nonblock=false)
submits 1 buffer at a time (needs_kick is unconditionally true) and spins
with local IRQs disabled at:
while (!virtqueue_get_buf(out_vq, &len) && !virtqueue_is_broken(out_vq))
cpu_relax();
while holding port->outvq_lock, a single lost 0x2c003004 kick locks up
4 vCPUs at 100% host stime (outvq_lock holder + hp->lock waiter + RCU
stall console_owner + hardlockup detector console_waiter), while host
[v_console] remains asleep in WaitContext::wait() (verified live: sending
RX input 15 minutes after the hang still woke [v_console] on in_avail_evt,
incrementing voluntary_ctxt_switches from 844 to 847, proving the worker
was not blocked on host pipe output and never received transmitq's
ioeventfd signal).
Suspected EL2 / gzvm_vcpu_run() boundary to audit:
In drivers/virt/geniezone/gzvm_vcpu.c:
while (!need_userspace && !signal_pending(current)) {
gzvm_arch_vcpu_run(vcpu, &exit_reason);
switch (exit_reason) {
case GZVM_EXIT_MMIO:
if (!gzvm_vcpu_handle_mmio(vcpu))
need_userspace = true;
break;
...
case GZVM_EXIT_IRQ:
case GZVM_EXIT_GZ:
break;
If gzvm_vcpu_handle_mmio() had returned false, need_userspace = true would
have exited to crosvm, where VirtioPciDevice::write_bar() has a userspace
fallback (evt.event.signal()). Because neither gzvm_ioevent_write() nor
the userspace fallback signaled the eventfd while guest ELR_EL1 advanced
past strh w0, [x1], please audit EL2's Stage-2 MMIO abort handling under
concurrent physical IRQ / MT_HVC_GZVM_IRQ_LINE exits to ensure an in-flight
MMIO trap that has already incremented ELR_EL1 cannot have its exit_reason
overwritten by GZVM_EXIT_IRQ / GZVM_EXIT_GZ before EL1 processes
GZVM_EXIT_MMIO.
Best regards,
Chenyang Yu