From: Steven Sistare <steven.sistare@oracle.com>
To: David Hildenbrand <david@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Eduardo Habkost <eduardo@habkost.net>,
Philippe Mathieu-Daude <philmd@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [RFC V1 04/14] accel: set accelerator and machine props earlier
Date: Wed, 23 Oct 2024 16:28:54 -0400 [thread overview]
Message-ID: <cbbd6fda-2bef-46d4-8c13-91cdd7cc96f5@oracle.com> (raw)
In-Reply-To: <ce3c0f72-0442-4519-9c0e-bbd67d25730a@redhat.com>
On 10/22/2024 4:30 AM, David Hildenbrand wrote:
> On 18.10.24 21:15, Steven Sistare wrote:
>> On 10/18/2024 11:40 AM, Steven Sistare wrote:
>>> On 10/18/2024 11:32 AM, Steven Sistare wrote:
>>>> On 10/18/2024 11:08 AM, Fabiano Rosas wrote:
>>>>> Steve Sistare <steven.sistare@oracle.com> writes:
>>>>>
>>>>>> Make all global and compat properties available before the first objects
>>>>>> are created. Set accelerator compatibility properties in
>>>>>> configure_accelerators, when the accelerator is chosen, and call
>>>>>> configure_accelerators earlier. Set machine options earlier.
>>>>>>
>>>>>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>>>>>> ---
>>>>>> accel/accel-system.c | 2 --
>>>>>> system/vl.c | 34 ++++++++++++++++++----------------
>>>>>> 2 files changed, 18 insertions(+), 18 deletions(-)
>>>>>>
>>>>>> diff --git a/accel/accel-system.c b/accel/accel-system.c
>>>>>> index f6c947d..c8aeae4 100644
>>>>>> --- a/accel/accel-system.c
>>>>>> +++ b/accel/accel-system.c
>>>>>> @@ -41,8 +41,6 @@ int accel_init_machine(AccelState *accel, MachineState *ms)
>>>>>> ms->accelerator = NULL;
>>>>>> *(acc->allowed) = false;
>>>>>> object_unref(OBJECT(accel));
>>>>>> - } else {
>>>>>> - object_set_accelerator_compat_props(acc->compat_props);
>>>>>> }
>>>>>> return ret;
>>>>>> }
>>>>>> diff --git a/system/vl.c b/system/vl.c
>>>>>> index b94a6b9..bca2292 100644
>>>>>> --- a/system/vl.c
>>>>>> +++ b/system/vl.c
>>>>>> @@ -2346,6 +2346,7 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
>>>>>> goto bad;
>>>>>> }
>>>>>> + object_set_accelerator_compat_props(ac->compat_props);
>>>>>> acs->accel = accel;
>>>>>> return 1;
>>>>>> @@ -3728,29 +3729,14 @@ void qemu_init(int argc, char **argv)
>>>>>> parse_memory_options();
>>>>>> qemu_create_machine(machine_opts_dict);
>>>>>> -
>>>>>> - suspend_mux_open();
>>>>>> -
>>>>>> - qemu_disable_default_devices();
>>>>>> - qemu_setup_display();
>>>>>> - qemu_create_default_devices();
>>>>>> - qemu_create_early_backends();
>>>>>> -
>>>>>> qemu_apply_legacy_machine_options(machine_opts_dict);
>>>>>> qemu_apply_machine_options(machine_opts_dict);
>>>>>> qobject_unref(machine_opts_dict);
>>>>>> - phase_advance(PHASE_MACHINE_CREATED);
>>>>>> - /*
>>>>>> - * Note: uses machine properties such as kernel-irqchip, must run
>>>>>> - * after qemu_apply_machine_options.
>>>>>> - */
>>>>>> accel = configure_accelerators(argv[0]);
>>>>>> - create_accelerator(accel);
>>>>>> - phase_advance(PHASE_ACCEL_CREATED);
>>>>>> /*
>>>>>> - * Beware, QOM objects created before this point miss global and
>>>>>> + * QOM objects created after this point see all global and
>>>>>> * compat properties.
>>>>>> *
>>>>>> * Global properties get set up by qdev_prop_register_global(),
>>>>>> @@ -3765,6 +3751,22 @@ void qemu_init(int argc, char **argv)
>>>>>> * called from do_configure_accelerator().
>>>>>> */
>>>>>> + suspend_mux_open();
>>>>>> +
>>>>>> + qemu_disable_default_devices();
>>>>>> + qemu_setup_display();
>>>>>> + qemu_create_default_devices();
>>>>>> + qemu_create_early_backends();
>>>>>> +
>>>>>> + phase_advance(PHASE_MACHINE_CREATED);
>>>>>> +
>>>>>> + /*
>>>>>> + * Note: uses machine properties such as kernel-irqchip, must run
>>>>>> + * after qemu_apply_machine_options.
>>>>>> + */
>>>>>> + create_accelerator(accel);
>>>>>> + phase_advance(PHASE_ACCEL_CREATED);
>>>>>> +
>>>>>> machine_class = MACHINE_GET_CLASS(current_machine);
>>>>>> if (!qtest_enabled() && machine_class->deprecation_reason) {
>>>>>> warn_report("Machine type '%s' is deprecated: %s",
>>>>>
>>>>> Hi Steve,
>>>>>
>>>>> after this commit:
>>>>>
>>>>> $ QTEST_QEMU_BINARY=./qemu-system-aarch64 ./tests/qtest/xlnx-can-test
>>>>> # random seed: R02Saf9b44f2d88dd417052905692ee79981
>>>>> 1..5
>>>>> # Start of aarch64 tests
>>>>> # Start of net tests
>>>>> # Start of can tests
>>>>> # starting QEMU: exec ./qemu-system-aarch64 -qtest unix:/tmp/qtest-2396.sock -qtest-log /dev/null -chardev socket,path=/tmp/qtest-2396.qmp,id=char0 -mon chardev=char0,mode=control -display none -audio none -machine xlnx-zcu102 -object can-bus,id=canbus -machine canbus0=canbus -machine canbus1=canbus -accel qtest
>>>>> qemu-system-aarch64: Device 'canbus' not found
>>>>>
>>>>> I tried briefly to figure out what the issue is, but I don't really
>>>>> understand the dependencies involved. Hope you can tell us.
>>>>
>>>> Thanks! I forgot to define the preinit method for the qtest accelerator in patch 1.
>>>> I'll verify that fixes the problem and send you a one-off patch if you want to continue
>>>> testing.
>>>
>>> Actually that is not a problem. qtest qtest_init_accel does nothing, so preinit will do
>>> nothing, so it is OK to not define preinit.
>>>
>>> Still looking.
>>
>> I understand this now. The old code worked in this order:
>>
>> qemu_create_early_backends()
>> ... creates "-object can-bus,id=canbus"
>> qemu_create_machine()
>> qemu_apply_machine_options()
>> applies link property "canbus0" with value canbus, finds canbus object
>
> Now I am confused.
>
> I think the current code does:
>
> qemu_create_machine(machine_opts_dict);
> qemu_create_early_backends();
> qemu_apply_machine_options(machine_opts_dict);
>
> Isn't the relevant part that we may only apply the machine options after creating the early backends?
Yes, I showed the wrong order for the old code, but our explanations are equivalent.
Perhaps this could be fixed by moving qemu_apply_machine_options after
qemu_create_early_backends in qemu_exit_precreate. But that seems risky and
fragile, as there would be a large window of code between qemu_create_machine
and qemu_apply_machine_options where the machine has been created but the machine
options and not known.
- Steve
next prev parent reply other threads:[~2024-10-23 20:29 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 15:14 [RFC V1 00/14] precreate phase Steve Sistare
2024-10-17 15:14 ` [RFC V1 01/14] accel: encapsulate search state Steve Sistare
2024-10-21 20:03 ` Fabiano Rosas
2024-10-17 15:14 ` [RFC V1 02/14] accel: accel preinit function Steve Sistare
2024-10-17 15:26 ` Steven Sistare
2024-10-21 14:54 ` Peter Xu
2024-10-23 16:13 ` Steven Sistare
2024-10-23 15:53 ` Paolo Bonzini
2024-10-23 16:25 ` Steven Sistare
2024-10-17 15:14 ` [RFC V1 03/14] accel: split configure_accelerators Steve Sistare
2024-10-17 15:14 ` [RFC V1 04/14] accel: set accelerator and machine props earlier Steve Sistare
2024-10-18 15:08 ` Fabiano Rosas
2024-10-18 15:32 ` Steven Sistare
2024-10-18 15:40 ` Steven Sistare
2024-10-18 19:15 ` Steven Sistare
2024-10-21 16:20 ` Peter Xu
2024-10-23 17:16 ` Paolo Bonzini
2024-10-22 8:30 ` David Hildenbrand
2024-10-23 20:28 ` Steven Sistare [this message]
2024-10-21 15:19 ` Peter Xu
2024-10-23 20:29 ` Steven Sistare
2024-10-23 16:00 ` Paolo Bonzini
2024-10-23 17:18 ` Paolo Bonzini
2024-10-23 20:29 ` Steven Sistare
2024-10-17 15:14 ` [RFC V1 05/14] migration: init and listen during precreate Steve Sistare
2024-10-21 16:41 ` Peter Xu
2024-10-21 21:05 ` Fabiano Rosas
2024-10-23 16:01 ` Steven Sistare
2024-10-17 15:14 ` [RFC V1 06/14] vl: precreate phase Steve Sistare
2024-10-23 14:03 ` Fabiano Rosas
2024-10-17 15:14 ` [RFC V1 07/14] monitor: chardev name Steve Sistare
2024-10-17 15:14 ` [RFC V1 08/14] qom: get properties Steve Sistare
2024-10-17 15:14 ` [RFC V1 09/14] qemu-option: filtered foreach Steve Sistare
2024-10-17 15:14 ` [RFC V1 10/14] qemu-options: pass object to filter Steve Sistare
2024-10-17 15:14 ` [RFC V1 11/14] monitor: connect in precreate Steve Sistare
2024-10-21 19:28 ` Peter Xu
2024-10-23 17:34 ` Steven Sistare
2024-10-23 16:05 ` Paolo Bonzini
2024-10-23 17:35 ` Steven Sistare
2024-10-17 15:14 ` [RFC V1 12/14] qtest: " Steve Sistare
2024-10-17 15:14 ` [RFC V1 13/14] net: cleanup for precreate phase Steve Sistare
2024-10-17 15:27 ` Steven Sistare
2024-10-21 19:20 ` Peter Xu
2024-10-23 17:43 ` Steven Sistare
2024-10-17 15:14 ` [RFC V1 14/14] migration: allow commands during precreate and preconfig Steve Sistare
2024-10-21 19:36 ` Peter Xu
2024-10-23 17:50 ` Steven Sistare
2024-10-17 15:19 ` [RFC V1 00/14] precreate phase Steven Sistare
2024-10-17 15:53 ` Peter Xu
2024-10-21 15:56 ` Steven Sistare
2024-10-23 16:31 ` Paolo Bonzini
2024-10-24 21:16 ` Steven Sistare
2024-10-25 8:46 ` Daniel P. Berrangé
2024-10-25 13:33 ` Steven Sistare
2024-10-25 13:43 ` Daniel P. Berrangé
2024-10-25 14:32 ` Steven Sistare
2024-10-25 14:49 ` Daniel P. Berrangé
2024-10-28 21:56 ` Peter Xu
2024-10-29 9:09 ` Daniel P. Berrangé
2024-10-29 11:13 ` Daniel P. Berrangé
2024-10-29 13:20 ` Fabiano Rosas
2024-10-29 15:18 ` Peter Xu
2024-10-29 15:58 ` Daniel P. Berrangé
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=cbbd6fda-2bef-46d4-8c13-91cdd7cc96f5@oracle.com \
--to=steven.sistare@oracle.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).