From: Kai <kai.kang@windriver.com>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH] qdev: not add devices to bus in reverse order
Date: Wed, 17 Jan 2024 12:23:00 +0800 [thread overview]
Message-ID: <ada226b3-c7e4-bf73-ea48-9a0e1699ef7f@windriver.com> (raw)
In-Reply-To: <20240109095222.1420182-1-kai.kang@windriver.com>
On 1/9/24 17:52, kai.kang@windriver.com wrote:
> From: Kai Kang <kai.kang@windriver.com>
>
> When this section of source codes were added via commit:
>
> * 02e2da45c4 Add common BusState
>
> it added devices to bus with LIST_INSERT_HEAD() which operated on the
> single direction list. It didn't have something like LIST_INSERT_TAIL()
> at that time and kept that way when turned to QTAILQ.
>
> Then it causes the fist device in qemu command line inserted at the end
> of the bus child link list. And when realize them, the first device will
> be the last one to be realized.
>
> Replace QTAILQ_INSERT_HEAD_RCU() with QTAILQ_INSERT_TAIL_RCU() to make
> sure that devices are added to bus with the sequence in the command
> line.
Ping.
>
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
> hw/core/qdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 43d863b0c5..5e2ff43715 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -89,7 +89,7 @@ static void bus_add_child(BusState *bus, DeviceState *child)
> kid->child = child;
> object_ref(OBJECT(kid->child));
>
> - QTAILQ_INSERT_HEAD_RCU(&bus->children, kid, sibling);
> + QTAILQ_INSERT_TAIL_RCU(&bus->children, kid, sibling);
>
> /* This transfers ownership of kid->child to the property. */
> snprintf(name, sizeof(name), "child[%d]", kid->index);
--
Kai Kang
Wind River Linux
next prev parent reply other threads:[~2024-01-17 4:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 9:52 [PATCH] qdev: not add devices to bus in reverse order kai.kang
2024-01-17 4:23 ` Kai [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-09 9:20 Kai Kang
2024-01-17 17:31 ` Peter Maydell
2024-01-18 6:48 ` Kai
2024-01-18 10:05 ` Peter Maydell
2024-01-18 12:07 ` Igor Mammedov
2024-01-22 1:59 ` Kai
2024-01-24 16:11 ` Igor Mammedov
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=ada226b3-c7e4-bf73-ea48-9a0e1699ef7f@windriver.com \
--to=kai.kang@windriver.com \
--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).