qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio: improve virtqueue mapping error messages
@ 2025-09-23 12:46 Alessandro Ratti
  2025-09-23 12:46 ` Alessandro Ratti
  0 siblings, 1 reply; 8+ messages in thread
From: Alessandro Ratti @ 2025-09-23 12:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: alessandro.ratti, armbru, berrange, alex.bennee, mst


Hi all,

Following up on the previous discussion in this thread [1], I'm submitting a
cleaned-up version of the patch to improve error messages in
virtio_init_region_cache() when virtqueue ring mapping fails.

This version introduces a helper (virtio_get_pretty_dev_name()) that returns
either:

 - the device ID, if explicitly set by the user (e.g. -device ...,id=foo)
 - or the QOM path from qdev_get_dev_path(dev) otherwise

This improves the clarity of error messages, especially when debugging
misconfigured guests or setups with multiple virtio devices.

## Example 1: PCI device (fallback to QOM path returns PCI ID)

~/qemu/build$ ./qemu-system-x86_64 \ 
    -enable-kvm \ 
    -m 512 \ 
    -drive if=virtio,file=/tmp/some.img,format=raw
qemu-system-x86_64: Failed to map descriptor ring for device 0000:00:04.0: invalid guest physical address or corrupted queue setup

## Example 2: Non-PCI virtio-mmio device (QOM path fallback)

~/qemu/build$ ./qemu-system-aarch64 -M virt -cpu cortex-a57 -m 512 -nographic \
    -append "console=ttyAMA0" \
    -drive if=none,file=/tmp/some.img,format=raw,id=hd0 \
    -device virtio-blk-device,drive=hd0 \
    -kernel /tmp/vmlinuz-5.15.0-qcomlt-arm64

qemu-system-aarch64: Failed to map descriptor ring for device virtio-mmio@000000000a003e00: invalid guest physical address or corrupted queue setup\ 

## Example 3: Explicit device ID (dev->id path)

~/qemu/build$ ./qemu-system-aarch64 -M virt -cpu cortex-a57 -m 512 -nographic \
    -append "console=ttyAMA0" \
    -drive if=none,file=/tmp/some.img,format=raw,id=hd0 \
    -device virtio-blk-device,drive=hd0,id=foo \
    -kernel /tmp/vmlinuz-5.15.0-qcomlt-arm64

qemu-system-aarch64: Failed to map available ring for device foo: possible queue misconfiguration or overlapping memory region

As discussed, I considered using qdev_get_human_name() but it often returns
opaque paths like 

   /machine/peripheral-anon/device[0]/virtio-backend 

Which are less informative in user-facing logs compared to PCI IDs or
user-specified names.

The messages have been adjusted to be more descriptive and scoped to improving
this specific area of diagnostics. I hope this aligns with the direction
discussed — but of course, I’m open to further suggestions if something still
feels off.

Thank you for your time and consideration.

Best regards,
Alessandro Ratti

[1]: https://lore.kernel.org/qemu-devel/20250915100701.224156-1-alessandro@0x65c.net/


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-09-24  9:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 12:46 [PATCH] virtio: improve virtqueue mapping error messages Alessandro Ratti
2025-09-23 12:46 ` Alessandro Ratti
2025-09-23 15:09   ` [PATCH v2] " Alessandro Ratti
2025-09-23 15:09     ` Alessandro Ratti
2025-09-23 16:17       ` Daniel P. Berrangé
2025-09-24  9:14         ` [PATCH v3] " Alessandro Ratti
2025-09-24  9:14           ` Alessandro Ratti
2025-09-24  9:34             ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).