All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
	 Alessandro Ratti <alessandro@0x65c.net>,
	 alessandro.ratti@gmail.com,  philmd@linaro.org,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v2] virtio: Add function name to error messages
Date: Mon, 22 Sep 2025 12:06:00 +0100	[thread overview]
Message-ID: <87wm5qoig7.fsf@draig.linaro.org> (raw)
In-Reply-To: <aNEpVhkZ2r5e2Z9X@redhat.com> ("Daniel P. Berrangé"'s message of "Mon, 22 Sep 2025 11:47:50 +0100")

Daniel P. Berrangé <berrange@redhat.com> writes:

> On Mon, Sep 22, 2025 at 12:37:57PM +0200, Markus Armbruster wrote:
>> Alessandro Ratti <alessandro@0x65c.net> writes:
>> 
>> > Replace virtio_error() with a macro that automatically prepends the
>> > calling function name to error messages. This provides better context
>> > for debugging virtio issues by showing exactly which function
>> > encountered the error.
>> >
>> > Before: "Invalid queue size: 1024"
>> > After:  "virtio_queue_set_num: Invalid queue size: 1024"
>> >
>> > The implementation uses a macro to insert __func__ at compile time,
>> > avoiding any runtime overhead while providing more specific error
>> > context than a generic "virtio:" prefix.
>> 
>> A need for function names and such in error messages suggests the error
>> messages are crap.
>
> I pretty much agree. If we take that view forwards, then I think our
> coding guidelines should explicitly state something like
>
>  "Function names must never be included in error messages.
>
>   The messages need to be sufficiently descriptive in their
>   text, such that including function names is redundant"

Ahh I missed the fact this ends up as an error_report. I think having
function names in debug output is fine.

It does however miss important information like which VirtIO device is
actually failing, despite having vdev passed down to the function.

>
>> > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/230
>
> This is interesting as it shows a link to a previously proposed patch:
>
>   https://patchwork.kernel.org/project/qemu-devel/patch/20220414112902.41390-1-codeguy.moteen@gmail.com/
>
> this old patch just expanded the error messages to include 'Virtio '
> in their text. I'm not going to claim this made new error messages
> hugely user friendly, but I think that old patch approach was at
> least conceptually better & preferrable to the function name
> addition.
>
>> > Buglink: https://bugs.launchpad.net/qemu/+bug/1919021
>> >
>> > Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
>
> With regards,
> Daniel

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


  reply	other threads:[~2025-09-22 11:07 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 [this message]
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

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=87wm5qoig7.fsf@draig.linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=alessandro.ratti@gmail.com \
    --cc=alessandro@0x65c.net \
    --cc=armbru@redhat.com \
    --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.