Alex Bennée <[email protected]> writes:

> Daniel P. Berrangé <[email protected]> writes:
>
>> On Mon, Sep 22, 2025 at 12:37:57PM +0200, Markus Armbruster wrote:
>>> Alessandro Ratti <[email protected]> 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 via email to