From: Markus Armbruster <armbru@redhat.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com,
richard.henderson@linaro.org, berrange@redhat.com,
eduardo@habkost.net, Andrew Jones <ajones@ventanamicro.com>
Subject: Re: [PATCH v2 2/2] qom/object, accel-system: add support to Accel globals
Date: Wed, 31 Jul 2024 08:30:46 +0200 [thread overview]
Message-ID: <87bk2ekr8p.fsf@pond.sub.org> (raw)
In-Reply-To: <20240703204149.1957136-3-dbarboza@ventanamicro.com> (Daniel Henrique Barboza's message of "Wed, 3 Jul 2024 17:41:49 -0300")
I apologize for the delay.
Daniel Henrique Barboza <dbarboza@ventanamicro.com> writes:
> We're not honouring KVM options that are provided by any -accel option
> aside from the first. In this example:
>
> qemu-system-riscv64 -accel kvm,riscv-aia=emul (...) \
> -accel kvm,riscv-aia=hwaccel
>
> 'riscv-aia' will be set to 'emul', ignoring the last occurrence of the
> option that set 'riscv-aia' to 'hwaccel'.
The way you phrase this, it sounds like a bug. But as far as I know,
-accel is meant to have fallback semantics: we use the first one that
works.
Perhaps:
-accel has fallback semantics, i.e. we try accelerators in order until
we find one that works. Any remainder is ignored.
Because of that, you can't override properties like this:
qemu-system-riscv64 -accel kvm,riscv-aia=emul (...) \
-accel kvm,riscv-aia=hwaccel
When KVM is available, 'riscv-aia' will be set to 'emul', and the
second -accel is ignored. When KVM is not available, neither option
works, and the command fails.
Why would you want to override accelerator properties?
Aside: not diagnosing obvious errors in fallback options we don't use is
not nice. Not this patch's problem.
> A failed attempt to solve this issue by setting 'merge_lists' can be
> found in [1].
I guess this failed because it destroyed the fallback semantics.
Correct?
> A different approach was suggested in [2]: enable global
> properties for accelerators. This allows an user to override any accel
> setting by using '-global' and we won't need to change how '-accel' opts
> are handled.
>
> This is done by calling object_prop_set_globals() in
> accel_init_machine(). As done in device_post_init(), user's global
> props take precedence over compat props so object_prop_set_globals() is
> called after object_set_accelerator_compat_props().
>
> object_prop_check_globals() is then changed to recognize TYPE_ACCEL
> globals as valid.
Would it make sense to enable -global for user-creatable objects
(-object), too?
> Re-using the fore-mentioned example we'll be able to set
> riscv-aia=hwaccel by doing the following:
>
> qemu-system-riscv64 -accel kvm,riscv-aia=emul (...) \
> -global kvm-accel.riscv-aia=hwaccel
I'm confused.
-accel kvm,riscv-aia=emul creates accelerator kvm (which is an instance
of class "kvm-accel") and sets its property "riscv-aia" to "emul".
-global kvm-accel,riscv-aia=hwaccel changes the (global) default value
of class "kvm-accel" property "riscv-aia".
Are you *sure* your example sets "riscv-aia" to "hwaccel"?
> [1] https://lore.kernel.org/qemu-devel/20240701133038.1489043-1-dbarboza@ventanamicro.com/
> [2] https://lore.kernel.org/qemu-devel/CABgObfbVJkCdpHV2uA7LGTbYEaoaizrbeG0vNo_T1ua5b=jq7Q@mail.gmail.com/
>
> Reported-by: Andrew Jones <ajones@ventanamicro.com>
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
next prev parent reply other threads:[~2024-07-31 6:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 20:41 [PATCH v2 0/2] object,accel-system: allow Accel type globals Daniel Henrique Barboza
2024-07-03 20:41 ` [PATCH v2 1/2] qom/object, qdev: move globals functions to object.c Daniel Henrique Barboza
2024-07-26 16:42 ` Daniel P. Berrangé
2024-08-01 6:58 ` object_new() cannot fail, and that's fundamental (was: [PATCH v2 1/2] qom/object, qdev: move globals functions to object.c) Markus Armbruster
2024-08-01 11:56 ` Daniel P. Berrangé
2024-07-03 20:41 ` [PATCH v2 2/2] qom/object, accel-system: add support to Accel globals Daniel Henrique Barboza
2024-07-31 6:30 ` Markus Armbruster [this message]
2024-07-31 7:41 ` Andrew Jones
2024-07-31 8:42 ` Markus Armbruster
2024-08-07 9:46 ` Daniel Henrique Barboza
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=87bk2ekr8p.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=ajones@ventanamicro.com \
--cc=berrange@redhat.com \
--cc=dbarboza@ventanamicro.com \
--cc=eduardo@habkost.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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.