hailo_pci 4.20.0 DKMS driver triggers ~120 find_vma kernel WARNs during model configure on RPi 5 (kernel 6.12.x)

Environment

  • Hardware: Raspberry Pi 5 (16GB), Hailo-8 AI Accelerator (M.2 HAT+, PCIe Gen 3 x1)

  • OS: Raspberry Pi OS Bookworm (Debian 12), custom image with read-only root (rpi-image-gen image-rota)

  • Kernel: 6.12.62+rpt-rpi-2712

  • HailoRT: 4.20.0

  • hailo_pci: DKMS 4.20.0 (srcversion BD5E76800A08DB052331F58)

  • Firmware: 4.20.0

Problem

During model configuration (VDevice.configure()), the hailo_pci DKMS driver triggers approximately 120 kernel WARN stack traces originating from find_vma():

CPU: 0 UID: 0 PID: 3212 Comm: python3 Tainted: G  W  O  6.12.62+rpt-rpi-2712
Hardware name: Raspberry Pi 5 Model B Rev 1.1 (DT)
pc : find_vma+0x6c/0x80
lr : hailo_vdma_buffer_map+0x144/0x618 [hailo_pci]
Call trace:
  find_vma+0x6c/0x80
  hailo_vdma_buffer_map+0x144/0x618 [hailo_pci]
  hailo_vdma_buffer_map_ioctl+0xdc/0x358 [hailo_pci]
  hailo_vdma_ioctl+0x1d4/0x268 [hailo_pci]
  hailo_pcie_fops_unlockedioctl+0x178/0x7d8 [hailo_pci]

In Linux 6.12.x, find_vma() includes a VM_WARN_ON_ONCE-style assertion that checks whether the caller holds mmap_lock. The hailo_vdma_buffer_map function appears to call find_vma() without acquiring this lock, producing a WARN for each DMA buffer mapping.

Impact

The warnings themselves are non-fatal — models configure and inference works correctly. However, each WARN prints a full stack trace (~2 KB) to the kernel console. On systems where the primary console is a serial port (115200 baud), 120 stack traces are printed synchronously, blocking the configure call for ~13 seconds. This exceeds the HailoRT gRPC client timeout (~10 seconds), causing HAILO_RPC_FAILED (77) when using multi-process service mode.

Workaround: Setting loglevel=3 in the kernel command line suppresses WARN-level messages from the console, reducing configure time from ~13s to ~1.2s.

Reproduction

from hailo_platform import VDevice, HEF, ConfigureParams, HailoStreamInterface, HailoSchedulingAlgorithm

params = VDevice.create_params()
params.scheduling_algorithm = HailoSchedulingAlgorithm.ROUND_ROBIN
params.group_id = "SHARED"
params.multi_process_service = False

vd = VDevice(params)
hef = HEF("/path/to/model.hef")
cp = ConfigureParams.create_from_hef(hef, interface=HailoStreamInterface.PCIe)
ng = vd.configure(hef, cp) # ~120 WARNs in dmesg

Check with: `dmesg | grep -c hailo_vdma_buffer_map`

Expected behavior

hailo_vdma_buffer_map should acquire mmap_read_lock before calling find_vma(), avoiding the kernel WARN on Linux 6.12+.

Hi @user1028 ,

Thanks for the detailed report. We appreciate it.

Thanks,