qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Kai <kai.kang@windriver.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	 "Daniel P. Berrange" <berrange@redhat.com>,
	Eduardo Habkost <eduardo@habkost.net>
Subject: Re: [PATCH] qdev: not add devices to bus in reverse order
Date: Thu, 18 Jan 2024 10:05:43 +0000	[thread overview]
Message-ID: <CAFEAcA-UPK_Uo_6bvMVrGSR9ZPMuA4DiAbJOmehhYSKKpEuMWw@mail.gmail.com> (raw)
In-Reply-To: <1db86e7c-9d4a-6c7d-9e6b-52054b2382cd@windriver.com>

On Thu, 18 Jan 2024 at 06:49, Kai <kai.kang@windriver.com> wrote:
>
> On 1/18/24 01:31, Peter Maydell wrote:
> > (cc'd the people listed for this file in MAINTAINERS)
> >
> > On Tue, 9 Jan 2024 at 13:53, Kai Kang <kai.kang@windriver.com> wrote:
> >> 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.
> > What are the problems being caused by the the list items being added
> > in reverse order? Your commit message doesn't say what specific
> > bug or problem it's trying to fix.
>
> The problem I met was just as I asked for for help in the maillist on
> Dec 18, 2023.
>
> The indexes of serial isa devices changes with the commit dcdbfaafe90a
> since qemu 6.2.0.
> Before the commit, it creates devices literally with "1" & "2":
>
> @@ -1252,8 +1222,6 @@ static void build_isa_devices_aml(Aml *table)
>           aml_append(scope, build_fdc_device_aml(fdc));
>       }
>       aml_append(scope, build_lpt_device_aml());
> -    build_com_device_aml(scope, 1);
> -    build_com_device_aml(scope, 2);
>
> After apply the commit, it uses the 'aml builder' way and the devices
> are handled in reverse way.
> Then the indexes are reversed. It affects guest os such as freebsd. When
> run `pstat -t` on freebsd
> with qemu, the sequence of the output is not right.
>
> root@freebsd:~ # pstat -t
>        LINE   INQ  CAN  LIN  LOW  OUTQ  USE  LOW   COL  SESS  PGID STATE
>       ttyu2     0    0    0    0     0    0    0     0     0     0 IC
>       ttyu3     0    0    0    0     0    0    0     0     0     0 IC
>       ttyu1     0    0    0    0     0    0    0     0     0     0 IC
>       ttyu0  1920    0    0  192  1984    0  199     0   664   668 ICOi
>
> It is expected with ascend order which keeps the same behavior with
> older version qemu.

Thanks. This seems like something that should be fixed in
the AML related code, not here.

-- PMM


  reply	other threads:[~2024-01-18 10:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09  9:20 [PATCH] qdev: not add devices to bus in reverse order Kai Kang
2024-01-17 17:31 ` Peter Maydell
2024-01-18  6:48   ` Kai
2024-01-18 10:05     ` Peter Maydell [this message]
2024-01-18 12:07     ` Igor Mammedov
2024-01-22  1:59       ` Kai
2024-01-24 16:11         ` Igor Mammedov
  -- strict thread matches above, loose matches on Subject: below --
2024-01-09  9:52 kai.kang
2024-01-17  4:23 ` Kai

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=CAFEAcA-UPK_Uo_6bvMVrGSR9ZPMuA4DiAbJOmehhYSKKpEuMWw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=berrange@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=kai.kang@windriver.com \
    --cc=pbonzini@redhat.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).