[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 12/21] hw/arm: Use sysbus_init_child_obj for corr
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PULL 12/21] hw/arm: Use sysbus_init_child_obj for correct reference counting |
Date: |
Wed, 4 Sep 2019 15:13:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
On 9/3/19 5:36 PM, Peter Maydell wrote:
> From: Philippe Mathieu-Daudé <address@hidden>
>
> Both object_initialize() and qdev_set_parent_bus() increase the
> reference counter of the new object, so one of the references has
> to be dropped afterwards to get the reference counting right.
> In machine model code this refcount leak is not particularly
> problematic because (unlike devices) machines will never be
> created on demand via QMP, and they are never destroyed.
> But in any case let's use the new sysbus_init_child_obj() instead
> to get the reference counting here right.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>
> Message-id: address@hidden
> [PMM: rewrote commit message]
Thank you very much Peter!
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> hw/arm/exynos4_boards.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/exynos4_boards.c b/hw/arm/exynos4_boards.c
> index f69358a5ba8..2781d8bd419 100644
> --- a/hw/arm/exynos4_boards.c
> +++ b/hw/arm/exynos4_boards.c
> @@ -131,8 +131,8 @@ exynos4_boards_init_common(MachineState *machine,
> exynos4_boards_init_ram(s, get_system_memory(),
> exynos4_board_ram_size[board_type]);
>
> - object_initialize(&s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
> - qdev_set_parent_bus(DEVICE(&s->soc), sysbus_get_default());
> + sysbus_init_child_obj(OBJECT(machine), "soc",
> + &s->soc, sizeof(s->soc), TYPE_EXYNOS4210_SOC);
> object_property_set_bool(OBJECT(&s->soc), true, "realized",
> &error_fatal);
- [Qemu-devel] [PULL 02/21] target/arm: Factor out unallocated_encoding for aarch32, (continued)
- [Qemu-devel] [PULL 02/21] target/arm: Factor out unallocated_encoding for aarch32, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 03/21] target/arm: Allow ARMCPRegInfo read/write functions to throw exceptions, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 05/21] aspeed/timer: Provide back-pressure information for short periods, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 06/21] memory: Remove unused memory_region_iommu_replay_all(), Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 08/21] hw/arm/smmuv3: Remove spurious error messages on IOVA invalidations, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 04/21] target/arm: Take exceptions on ATS instructions when needed, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 07/21] hw/arm/smmuv3: Log a guest error when decoding an invalid STE, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 09/21] target/arm: Fix SMMLS argument order, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 10/21] hw/arm: Use ARM_CPU_TYPE_NAME() macro when appropriate, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 12/21] hw/arm: Use sysbus_init_child_obj for correct reference counting, Peter Maydell, 2019/09/03
- Re: [Qemu-devel] [PULL 12/21] hw/arm: Use sysbus_init_child_obj for correct reference counting,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PULL 11/21] hw/arm: Use object_initialize_child for correct reference counting, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 13/21] hw/arm/fsl-imx: Add the cpu as child of the SoC object, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 14/21] hw/dma/xilinx_axi: Use object_initialize_child for correct ref. counting, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 15/21] hw/net/xilinx_axi: Use object_initialize_child for correct ref. counting, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 20/21] target/arm: Free TCG temps in trans_VMOV_64_sp(), Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 16/21] includes: remove stale [smp|max]_cpus externs, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 17/21] tcg/README: fix typo s/afterwise/afterwards/, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 18/21] atomic_template: fix indentation in GEN_ATOMIC_HELPER, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 19/21] include/exec/cpu-defs.h: fix typo, Peter Maydell, 2019/09/03
- [Qemu-devel] [PULL 21/21] target/arm: Don't abort on M-profile exception return in linux-user mode, Peter Maydell, 2019/09/03