[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 09/38] libqos: Track QTestState with QVirtioB
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v7 09/38] libqos: Track QTestState with QVirtioBus |
Date: |
Tue, 12 Sep 2017 08:28:05 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/12/2017 02:21 AM, Thomas Huth wrote:
> On 11.09.2017 19:19, Eric Blake wrote:
>> When initializing a QVirtioDevice (which always has an associated
>> QVirtioBus), we want to track which QTestState to use for all
>> I/O processed through that bus and device. Copy the paradigm
>> used for QPCIBus, and track the test state at the bus level; this
>> in turn requires a separate bus object per device (and associated
>> cleanup) rather than just sharing a const version of the dispatch
>> table.
> I fail to see why we need a separate bus object here for each device.
> The bus is only available one time, not multiple times, isn't it? So
> there should also only be one bus object floating around, not multiple
> ones... or do I miss something?
You are right that there is only one bus for the machine - the problem
is that the object representing the bus is dynamically created on the
fly at the point where the device is first grabbed, rather than up front
as part of creating the machine (in other words, the device search is
not performed on a pre-existing bus object).
Contrast qpci_device_find() (lookup based on a pre-existing bus) with
qvirtio_mmio_init_device() (lookup that did not use a pre-existing bus);
also note that qvirtio_pci_device_find() takes a pre-existing QPCIBus
(since on that architecture, the QVirtioBus is itself a device on the
QPCIBus).
I suppose that we could indeed refactor the code to require callers to
create the QVirtioBus object up front, and then make the device lookup
(both qvirtio_mmio_init_device() and qvirtio_pci_device_find()) take a
QVirtioBus parameter instead of QTestState or QPCIBus. That's slightly
more work, but I'm happy to attempt it if you think it will be better.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v7 01/38] test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code, (continued)
- [Qemu-devel] [PATCH v7 01/38] test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 04/38] tests: Clean up wait for event, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 06/38] libqtest: Use qemu_strtoul(), Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 07/38] libqtest: Inline qtest_query_target_endianness(), Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 08/38] libqos: Track QTestState with QPCIBus, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 09/38] libqos: Track QTestState with QVirtioBus, Eric Blake, 2017/09/11
- [Qemu-devel] [PATCH v7 10/38] libqos: Move/rename qpci_unplug_acpi_device_test() to pci.c, Eric Blake, 2017/09/11
[Qemu-devel] [PATCH v7 14/38] libqos: Use explicit QTestState for rtas operations, Eric Blake, 2017/09/11
[Qemu-devel] [PATCH v7 11/38] libqos: Use explicit QTestState for pci operations, Eric Blake, 2017/09/11
[Qemu-devel] [PATCH v7 12/38] libqos: Use explicit QTestState for virtio operations, Eric Blake, 2017/09/11