Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: qemu-devel@nongnu.org,  kvm@vger.kernel.org,  pbonzini@redhat.com
Subject: Re: [PATCH] kvm: turn fprintf into error_report
Date: Tue, 22 Sep 2026 07:09:40 +0200	[thread overview]
Message-ID: <87a4p998iz.fsf@pond.sub.org> (raw)
In-Reply-To: <20260921164442.1137615-1-vsementsov@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Mon, 21 Sep 2026 19:44:42 +0300")

Quick drive-by comments...

Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:

> Main benefit: ability to print timestamps.

Possible additional benefits:

* Ability to print guest name

* Print program name

* "This is an error" is obvious even at a glance

Benefits not applicable here (I believe):

* Print location if we have one

* Automatic redirection to the human monitor when appropriate

> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>  accel/kvm/kvm-all.c | 64 ++++++++++++++++++++++-----------------------
>  1 file changed, 31 insertions(+), 33 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 83cbd120a84..d271699db87 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -300,7 +300,7 @@ static KVMSlot *kvm_alloc_slot(KVMMemoryListener *kml)
       KVMSlot *slot = kvm_get_free_slot(kml);

       if (slot) {
>          return slot;
>      }
>  
> -    fprintf(stderr, "%s: no free slot available\n", __func__);
> +    error_report("%s: no free slot available", __func__);
>      abort();
>  }
>  

Bah, too much ceremony for me.  I'd do

       KVMSlot *slot = kvm_get_free_slot(kml);

       assert(slot);
       return slot;

The "print something to help developers fix the programming error;
abort()" pattern leads to having __func__ in error messages, which is
normally an anti-pattern, because error messages are for users.

But all that is outside the scope of your patch, and the maintainers may
have other ideas anyway.

[...]


      reply	other threads:[~2026-09-22  5:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 16:44 [PATCH] kvm: turn fprintf into error_report Vladimir Sementsov-Ogievskiy
2026-09-22  5:09 ` 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=87a4p998iz.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox