On Mon, Dec 07, 2020 at 11:46:22AM +0300, Roman Bolshakov wrote:
There's no generic way to query current accel and its properties
via QOM
because there's no link between an accel and current machine.
The change adds the link, i.e. if HVF is enabled the following will be
available in QOM:
(qemu) qom-get /machine/accel type
"hvf-accel"
Suggested-by: Markus Armbruster <armbru(a)redhat.com>
Suggested-by: Paolo Bonzini <pbonzini(a)redhat.com>
Signed-off-by: Roman Bolshakov <r.bolshakov(a)yadro.com>
---
Hi,
this is a follow up patch that deprecates earlier series [1].
Is there a reference to the reasoning for dropping the earlier
approach? Your previous approach seems preferable.
An outstanding issue is whether management applications can rely on
the
value of /machine/accel/type and output of qom-list-types command [2][3]
to get current and present accels?
i.e. would it be ok if libvirt assumes that everything up to the first
dash in the accel type is the name of the accel (as specified via -M
accel=ACCEL flag) when it performs QEMU probing?
There are two big assumption libvirt would need to make:
1) That /machine/accel is a stable path that will never change;
2) That the accel name => QOM type naming rules will never change.
Item #1 is unlikely to change, but having the freedom to change
#2 would be useful for future refactoring (like the idea
mentioned at [4]).
The main issue, however, is having those assumptions not being
documented anywhere. A documented QMP interface is better than a
undocumented `qom-get`-based interface.
* * *
This patch is still a good idea, though. Even if it is just for
debugging or for having clearer object ownership rules, having
the accel object as part of the QOM tree is useful. So this has
my:
Reviewed-by: Eduardo Habkost <ehabkost(a)redhat.com>
but we need a commit message that doesn't make people think the
`qom-get` command above will always work.
Also, Eduardo and Claudio earlier had ideas to provide cpu-specific
accel subclasses [4][5].
1.
https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg03944.html
2.
https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg04212.html
3.
https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg07062.html
4.
https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg06513.html
5.
https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg06741.html
Thanks,
Roman
accel/accel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/accel/accel.c b/accel/accel.c
index cb555e3b06..45c5bf87b1 100644
--- a/accel/accel.c
+++ b/accel/accel.c
@@ -56,10 +56,11 @@ int accel_init_machine(AccelState *accel, MachineState *ms)
if (ret < 0) {
ms->accelerator = NULL;
*(acc->allowed) = false;
- object_unref(OBJECT(accel));
} else {
object_set_accelerator_compat_props(acc->compat_props);
+ object_property_add_child(OBJECT(ms), "accel", OBJECT(accel));
}
+ object_unref(OBJECT(accel));
return ret;
}
--
2.29.2
--
Eduardo