From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Luigi Leonardi <leonardi@redhat.com>,
qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Ani Sinha <anisinha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] igvm: populate errp in stub functions
Date: Tue, 09 Jun 2026 15:43:06 +0200 [thread overview]
Message-ID: <87o6hjn82d.fsf@pond.sub.org> (raw)
In-Reply-To: <aigULaw73khPNxoR@redhat.com> ("Daniel P. Berrangé"'s message of "Tue, 9 Jun 2026 14:25:01 +0100")
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Tue, Jun 09, 2026 at 03:20:14PM +0200, Luigi Leonardi wrote:
>> Use error_setg() to report that IGVM is not available, matching
>> the pattern used by other stubs in the tree.
>>
>> Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
>> Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
>> ---
>> stubs/igvm.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/stubs/igvm.c b/stubs/igvm.c
>> index 9e9f683fc9..dfb85eb548 100644
>> --- a/stubs/igvm.c
>> +++ b/stubs/igvm.c
>> @@ -17,15 +17,18 @@ int qigvm_x86_get_mem_map_entry(int index,
>> ConfidentialGuestMemoryMapEntry *entry,
>> Error **errp)
>> {
>> + error_setg(errp, "IGVM not supported on this platform");
>> return -1;
>> }
>>
>> int qigvm_x86_set_vp_context(void *data, int index, Error **errp)
>> {
>> + error_setg(errp, "IGVM not supported on this platform");
>> return -1;
>> }
>>
>> int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **errp)
>> {
>> + error_setg(errp, "IGVM not supported on this platform");
>> return -1;
>> }
>
> This is not wrong per-se, so on that basis
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
> but are any of these stubs actually reachable when IGVM is not
> enabled in the build ? Usually with stubs we find that one
> or two methods are the primary entrypoints which must return
> an error, at which point everything else becomes unreachable.
> The latter cases can just be g_assert_not_reached() as a sanity
> check that some unexpected codepath isn't calling in without
> checking status earlier. Those would thus would not need
> error_setg, nor a 'return' statement.
I much prefer g_assert_not_reached() to unreachable (and thus
untestable) errors.
next prev parent reply other threads:[~2026-06-09 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 13:20 [PATCH] igvm: populate errp in stub functions Luigi Leonardi
2026-06-09 13:25 ` Daniel P. Berrangé
2026-06-09 13:43 ` Markus Armbruster [this message]
2026-06-09 14:02 ` Luigi Leonardi
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=87o6hjn82d.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=anisinha@redhat.com \
--cc=berrange@redhat.com \
--cc=kraxel@redhat.com \
--cc=leonardi@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
/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.