From: Markus Armbruster <armbru@redhat.com>
To: Alessandro Ratti <alessandro@0x65c.net>
Cc: "Markus Armbruster" <armbru@redhat.com>,
qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
"Daniel P. Berrangé" <berrange@redhat.com>,
philmd@linaro.org
Subject: Re: [PATCH v2] virtio: Add function name to error messages
Date: Tue, 23 Sep 2025 15:33:56 +0200 [thread overview]
Message-ID: <87y0q58f97.fsf@pond.sub.org> (raw)
In-Reply-To: <CAKiXHKfQYKRu6MDCJdgiAhv2rxj8hnvQE+GXQsxtnK5R7F5d5g@mail.gmail.com> (Alessandro Ratti's message of "Tue, 23 Sep 2025 11:42:44 +0200")
Alessandro Ratti <alessandro@0x65c.net> writes:
> On Mon, 22 Sept 2025 at 16:23, Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Alessandro Ratti <alessandro.ratti@gmail.com> writes:
>>
>> > Hi Markus, Alex, Daniel,
>> >
>> > Thanks again for the thoughtful feedback and for helping me see the bigger
>> > picture. I now fully agree that adding function names to error messages (via
>> > __func__) doesn't really address the core issue, and I appreciate the
>> > push to rethink how error reporting can better serve both users and developers.
>> >
>> > I've taken a first stab at improving one of the messages in
>> > virtio_init_region_cache(), following your suggestions.
>> >
>> > Here's the updated call:
[...]
>> > With this change, the error output now reads:
>> >
>> > qemu-system-x86_64: Failed to map used ring for device
>> > 0000:00:04.0 - possible guest misconfiguration or insufficient memory
>> >
>> > This feels like a clear improvement — it gives context (what failed),
>> > identifies the device, and hints at likely causes.
>>
>> It's *much* better!
>>
>> Developers will appreciate "Failed to map used ring for device". By
>> itself it would still be gobbledygook for users, but together with the
>> "possible guest misconfiguration or insufficient memory" clue it's fine.
>>
>> Perhaps we can still improve on "device 0000:00:04.0". The device's ID
>> is a good way to identify it to the user, because it's chosen by the
>> user, and unique (among devices). Sadly, devices without ID exist. We
>> fall back to canonical QOM path in places. Have a look at
>> qdev_get_human_name() to see whether it works here.
>
> I experimented with qdev_get_human_name(), but it usually returns paths like:
>
> /machine/peripheral-anon/device[0]/virtio-backend
>
> …which seems less user-friendly than the PCI address provided by
> qdev_get_dev_path().
> For now, I'm sticking to using the device ID when set (e.g. via -device…,id=foo)
> and falling back to qdev_get_dev_path() otherwise — which provides predictable
> output for both PCI and non-PCI devices.
Note that qdev_get_dev_path() may return null. You need another
fallback.
For what it's worth, "qdev ID or QOM path" is how users specify devices
in QMP.
[...]
prev parent reply other threads:[~2025-09-23 13:35 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 10:01 [PATCH] virtio: Add function name to error messages Alessandro Ratti
2025-09-15 10:01 ` Alessandro Ratti
2025-09-15 10:35 ` Alex Bennée
2025-09-15 16:19 ` Alessandro Ratti
2025-09-15 16:19 ` [PATCH v2] " Alessandro Ratti
2025-09-22 9:33 ` Alessandro Ratti
2025-09-22 9:33 ` Alessandro Ratti
2025-09-22 10:37 ` Alex Bennée
2025-09-22 10:37 ` Markus Armbruster
2025-09-22 10:47 ` Daniel P. Berrangé
2025-09-22 11:06 ` Alex Bennée
2025-09-22 12:29 ` Markus Armbruster
2025-09-22 13:37 ` Alessandro Ratti
2025-09-22 14:23 ` Markus Armbruster
2025-09-23 9:42 ` Alessandro Ratti
2025-09-23 13:33 ` Markus Armbruster [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y0q58f97.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=alessandro@0x65c.net \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.