All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "Daniel P. Berrangé" <berrange@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 14:29:30 +0200	[thread overview]
Message-ID: <877bxqk6vp.fsf@pond.sub.org> (raw)
In-Reply-To: <87wm5qoig7.fsf@draig.linaro.org> ("Alex Bennée"'s message of "Mon, 22 Sep 2025 12:06:00 +0100")

Alex Bennée <alex.bennee@linaro.org> writes:

> 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"

I'm in favor.

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

No argument!

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

Yes, which device failed should definitely be reported.

[...]



  reply	other threads:[~2025-09-22 12:31 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 [this message]
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=877bxqk6vp.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alessandro.ratti@gmail.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.