From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Peter Xu" <peterx@redhat.com>, "Cédric Le Goater" <clg@redhat.com>
Cc: qemu-devel@nongnu.org, "Eduardo Habkost" <eduardo@habkost.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Juraj Marcin" <jmarcin@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Bharat Bhushan" <r65777@freescale.com>,
qemu-ppc@nongnu.org
Subject: Re: [PATCH 07/12] ppc/e500: Avoid abuse of container_get()
Date: Thu, 21 Nov 2024 18:17:07 +0100 [thread overview]
Message-ID: <725f4e9d-e751-4eaa-8173-d6cfa60966db@linaro.org> (raw)
In-Reply-To: <Zz9irqNkWX3BSDqG@x1n>
On 21/11/24 17:41, Peter Xu wrote:
> On Thu, Nov 21, 2024 at 10:48:43AM +0100, Cédric Le Goater wrote:
>> On 11/21/24 10:38, Cédric Le Goater wrote:
>>> On 11/20/24 22:56, Peter Xu wrote:
>>>> container_get() is going to become strict on not allowing to return a
>>>> non-container.
>>>>
>>>> Switch the e500 user to use object_resolve_path_component() explicitly.
>>>>
>>>> Cc: Bharat Bhushan <r65777@freescale.com>
>>>> Cc: qemu-ppc@nongnu.org
>>>> Signed-off-by: Peter Xu <peterx@redhat.com>
>>>> ---
>>>> hw/pci-host/ppce500.c | 4 ++--
>>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/hw/pci-host/ppce500.c b/hw/pci-host/ppce500.c
>>>> index b70631045a..65233b9e3f 100644
>>>> --- a/hw/pci-host/ppce500.c
>>>> +++ b/hw/pci-host/ppce500.c
>>>> @@ -418,8 +418,8 @@ static const VMStateDescription vmstate_ppce500_pci = {
>>>> static void e500_pcihost_bridge_realize(PCIDevice *d, Error **errp)
>>>> {
>>>> PPCE500PCIBridgeState *b = PPC_E500_PCI_BRIDGE(d);
>>>> - PPCE500CCSRState *ccsr = CCSR(container_get(qdev_get_machine(),
>>>> - "/e500-ccsr"));
>>>> + PPCE500CCSRState *ccsr = CCSR(
>>>> + object_resolve_path_component(qdev_get_machine(), "e500-ccsr"));
>>>
>>>
>>> why not simply use :
>>>
>>> CCSR(object_resolve_path("/machine/e500-ccsr", NULL));
>>
>>
>> I guess we want to avoid the absolute paths. If so,
>
> It wasn't my intention, but what you said actually makes sense to me to
> avoid hard-coded "/machine" if possible.
Long term (heterogeneous emulation & dynamic machines in mind) I'm
unsure about qdev_get_machine() future. Not to take care now, but
I'm expecting it to evolve. So not using hardcoded path is better
IMHO.
>
> OTOH, object_resolve_path_component() was actually tiny little faster when
> we know the depth of the path.
>
>>
>> Reviewed-by: Cédric Le Goater <clg@redhat.com>
>>
>>
>> We might want to convert these lookups to object_resolve_path_component
>> too, not in this patchset.
>>
>> hw/i386/acpi-build.c: host = PCI_HOST_BRIDGE(object_resolve_path("/machine/i440fx", NULL));
>> hw/i386/acpi-build.c: host = PCI_HOST_BRIDGE(object_resolve_path("/machine/q35", NULL));
>> target/i386/kvm/kvm.c: (MemoryRegion *) object_resolve_path("/machine/smram", NULL);
>> target/i386/tcg/sysemu/tcg-cpu.c: (MemoryRegion *) object_resolve_path("/machine/smram", NULL);
>
> Sounds reasonable to me to use the same style. I'll stick with this patch
> as of now in the current series.
>
> Thanks,
>
next prev parent reply other threads:[~2024-11-21 17:17 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-20 21:56 [PATCH 00/12] QOM: container_get() removal Peter Xu
2024-11-20 21:56 ` [PATCH 01/12] qom: Add TYPE_CONTAINER macro Peter Xu
2024-11-21 9:20 ` Philippe Mathieu-Daudé
2024-11-21 10:04 ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 02/12] qom: New container_create() Peter Xu
2024-11-21 10:05 ` Daniel P. Berrangé
2024-11-21 13:20 ` Markus Armbruster
2024-11-21 16:18 ` Peter Xu
2024-11-20 21:56 ` [PATCH 03/12] tests: Fix test-qdev-global-props on anonymous qdev realize() Peter Xu
2024-11-21 9:20 ` Philippe Mathieu-Daudé
2024-11-21 10:16 ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 04/12] tests: Explicitly create containers in test_qom_partial_path() Peter Xu
2024-11-21 9:19 ` Philippe Mathieu-Daudé
2024-11-21 10:16 ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 05/12] ui/console: Explicitly create "/backend" container Peter Xu
2024-11-21 9:19 ` Philippe Mathieu-Daudé
2024-11-21 10:26 ` Daniel P. Berrangé
2024-11-21 16:27 ` Peter Xu
2024-11-20 21:56 ` [PATCH 06/12] hw/ppc: Explicitly create the drc container Peter Xu
2024-11-21 9:35 ` Philippe Mathieu-Daudé
2024-11-21 16:36 ` Peter Xu
2024-11-21 17:14 ` Philippe Mathieu-Daudé
2024-11-20 21:56 ` [PATCH 07/12] ppc/e500: Avoid abuse of container_get() Peter Xu
2024-11-21 9:38 ` Cédric Le Goater
2024-11-21 9:48 ` Cédric Le Goater
2024-11-21 16:41 ` Peter Xu
2024-11-21 17:17 ` Philippe Mathieu-Daudé [this message]
2024-11-21 10:28 ` Daniel P. Berrangé
2024-11-20 21:56 ` [PATCH 08/12] qdev: Make qdev_get_machine() not use container_get() Peter Xu
2024-11-21 10:21 ` Daniel P. Berrangé
2024-11-21 16:48 ` Peter Xu
2024-11-20 21:57 ` [PATCH 09/12] qdev: Add machine_get_container() Peter Xu
2024-11-21 9:23 ` Philippe Mathieu-Daudé
2024-11-21 10:23 ` Daniel P. Berrangé
2024-11-21 13:23 ` Markus Armbruster
2024-11-20 21:57 ` [PATCH 10/12] qom: Create system containers explicitly Peter Xu
2024-11-21 9:13 ` Philippe Mathieu-Daudé
2024-11-21 10:30 ` Daniel P. Berrangé
2024-11-21 13:01 ` Philippe Mathieu-Daudé
2024-11-21 17:17 ` Peter Xu
2024-11-21 17:29 ` Philippe Mathieu-Daudé
2024-11-21 18:03 ` Peter Xu
2024-11-21 19:03 ` Philippe Mathieu-Daudé
2024-11-21 13:31 ` Markus Armbruster
2024-11-21 17:24 ` Peter Xu
2024-11-20 21:57 ` [PATCH 11/12] qom: Add object_get_container() Peter Xu
2024-11-21 9:23 ` Philippe Mathieu-Daudé
2024-11-21 10:30 ` Daniel P. Berrangé
2024-11-20 21:57 ` [PATCH 12/12] qom: Drop container_get() Peter Xu
2024-11-21 10:32 ` Daniel P. Berrangé
2024-11-21 9:18 ` [PATCH 00/12] QOM: container_get() removal Philippe Mathieu-Daudé
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=725f4e9d-e751-4eaa-8173-d6cfa60966db@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=clg@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=r65777@freescale.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 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).