All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Alessandro Ratti <alessandro@0x65c.net>,
	alex.bennee@linaro.org, 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 11:47:50 +0100	[thread overview]
Message-ID: <aNEpVhkZ2r5e2Z9X@redhat.com> (raw)
In-Reply-To: <87h5wulqm2.fsf@pond.sub.org>

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"

> > 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
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

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