From: Anthony Liguori <anthony@codemonkey.ws>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>,
Paul Brook <paul@codesourcery.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups
Date: Mon, 22 Mar 2010 10:03:29 -0500 [thread overview]
Message-ID: <4BA786C1.1030105@codemonkey.ws> (raw)
In-Reply-To: <20100322145013.GA19447@redhat.com>
On 03/22/2010 09:50 AM, Michael S. Tsirkin wrote:
> On Mon, Mar 22, 2010 at 09:49:03AM -0500, Anthony Liguori wrote:
>
>> On 03/22/2010 08:30 AM, Paul Brook wrote:
>>
>>>> A VirtIOBlock device cannot be a VirtIODevice while being a
>>>> VirtIOPCIProxy (proxy is a poor name, btw).
>>>>
>>>> It really ought to be:
>>>>
>>>> DeviceState -> VirtIODevice -> VirtIOBlock
>>>>
>>>> and:
>>>>
>>>> PCIDevice -> VirtIOPCI : implements VirtIOBus
>>>>
>>>> The interface between the VirtIODevice and VirtIOBus is the virtio
>>>> transport.
>>>>
>>>> The main reason a separate bus is needed is the same reason it's needed
>>>> in Linux. VirtIOBlock has to be tied to some bus. It cannot be tied to
>>>> the PCI bus without having it be part of the implementation detail.
>>>> Introducing another bus type fixes this (and it's what we do in the
>>>> kernel).
>>>>
>>>>
>>> Why does virtio need a device state and bus at all?
>>>
>>>
>> Because you need VirtIOBlock to have qdev properties that can be set.
>>
>> You also need VirtIOPCI to have separate qdev properties that can be set.
>>
>>
>>> Can't it just be an internal implementation interface, which happens to be
>>> used by all devices that happen to exposed a block device over a virtio
>>> transport?
>>>
>>>
>> Theoretically, yes, but given the rest of the infrastructure's
>> interaction with qdev, making it a device makes the most sense IMHO.
>>
> Does this boil down to qdev wanting to be the 1st field
> in the structure, again? We can just lift that limitation.
>
No, I don't think it's relevant at all.
It's a classic OOP problem.
VirtIOBlock is-a VirtIODevice, VirtIODevice is-a DeviceState
VirtIOPCI is-a PCIDevice, PCIDevice is-a Device State.
But VirtIODevice is-a VirtIOPCI device isn't always true so it can't be
an is-a relationship. Initially, this was true and that's why the code
was structured that way. Now that we have two type so of virtio
transports, we need to change the modelling. It needs to get inverted
into a has-a relationship. IOW, VirtIOPCI has-a VirtIODevice.
When one device has-a one or more other devices, we model that as a Bus.
It's just like SCSI. SCSIDisk is-a SCSIDevice, SCSIDevice is-a DeviceState.
LSIState is-a PCIDevice, PCIDevice is-a DeviceState.
LSIState has-a SCSIDevice because LSIState implements the SCSIBus interface.
>> I can't envision any reason why we would ever want to have two MSI
>> vectors for a given queue.
>>
> No. OTOH whether we want a shared vector or a per-vq vector
> might depend on the device being used.
>
Yup. From a users perspective, we don't want them to create two
separate devices and manipulate parameters. We definitely want one
interface where we can manipulate both VirtIODevice and VirtIOPCI
parameters.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2010-03-22 15:03 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 18:51 [Qemu-devel] [PATCH 0/9] Virtio cleanups Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 1/9] qemu/pci: document msix_entries_nr field Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 2/9] virtio: Teach virtio-balloon about DO_UPCAST Juan Quintela
2010-03-18 7:29 ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 3/9] virtio: Teach virtio-blk " Juan Quintela
2010-03-18 7:29 ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 4/9] virtio: Teach virtio-net " Juan Quintela
2010-03-18 7:29 ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 5/9] virtio: Use DO_UPCAST instead of a cast Juan Quintela
2010-03-18 7:30 ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 6/9] virtio-pci: Remove duplicate test Juan Quintela
2010-03-18 7:25 ` [Qemu-devel] " Michael S. Tsirkin
2010-03-18 8:26 ` Juan Quintela
2010-03-18 8:47 ` Michael S. Tsirkin
2010-03-18 8:59 ` Juan Quintela
2010-03-18 9:11 ` Michael S. Tsirkin
2010-03-18 11:40 ` Juan Quintela
2010-03-18 13:24 ` Michael S. Tsirkin
2010-03-18 13:47 ` Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 7/9] QLIST: Introduce QLIST_COPY_HEAD Juan Quintela
2010-03-16 18:51 ` [Qemu-devel] [PATCH 8/9] virtio-blk: change rq type to VirtIOBlockReq Juan Quintela
2010-03-18 7:27 ` [Qemu-devel] " Michael S. Tsirkin
2010-03-16 18:51 ` [Qemu-devel] [PATCH 9/9] virtio-blk: use QLIST for the list of requests Juan Quintela
2010-03-18 6:40 ` [Qemu-devel] Re: [PATCH 0/9] Virtio cleanups Michael S. Tsirkin
2010-03-18 7:36 ` Juan Quintela
2010-03-18 7:42 ` Michael S. Tsirkin
2010-03-18 8:36 ` Juan Quintela
2010-03-18 9:07 ` Michael S. Tsirkin
2010-03-18 11:53 ` Juan Quintela
2010-03-18 12:33 ` Michael S. Tsirkin
2010-03-18 13:43 ` Juan Quintela
2010-03-18 13:47 ` Michael S. Tsirkin
2010-03-18 14:21 ` Juan Quintela
2010-03-18 17:13 ` Michael S. Tsirkin
2010-03-19 1:41 ` Jamie Lokier
2010-03-21 14:31 ` Michael S. Tsirkin
2010-03-21 18:11 ` Jamie Lokier
2010-03-21 19:16 ` Michael S. Tsirkin
2010-03-22 1:06 ` Juan Quintela
2010-03-22 2:51 ` Anthony Liguori
2010-03-22 13:30 ` Paul Brook
2010-03-22 14:49 ` Anthony Liguori
2010-03-22 14:50 ` Michael S. Tsirkin
2010-03-22 15:03 ` Anthony Liguori [this message]
2010-03-22 15:17 ` Michael S. Tsirkin
2010-03-22 15:50 ` Anthony Liguori
2010-03-22 16:16 ` Paul Brook
2010-03-22 18:48 ` Anthony Liguori
2010-03-22 21:00 ` Paul Brook
2010-03-23 1:13 ` Anthony Liguori
2010-03-22 15:51 ` Paul Brook
2010-03-22 17:19 ` Michael S. Tsirkin
2010-03-22 22:16 ` Juan Quintela
2010-03-23 0:49 ` Paul Brook
2010-03-23 1:16 ` Anthony Liguori
2010-03-23 10:47 ` Michael S. Tsirkin
2010-03-23 11:11 ` Gerd Hoffmann
2010-03-23 11:40 ` Paul Brook
2010-03-23 11:58 ` Michael S. Tsirkin
2010-03-23 12:32 ` Juan Quintela
2010-03-21 19:57 ` Michael S. Tsirkin
2010-03-22 1:13 ` Juan Quintela
2010-03-22 8:37 ` Michael S. Tsirkin
2010-03-18 10:05 ` Michael S. Tsirkin
2010-03-18 15:43 ` Gerd Hoffmann
2010-03-18 16:20 ` Juan Quintela
2010-03-18 16:36 ` Gerd Hoffmann
2010-03-18 17:08 ` Juan Quintela
2010-03-18 17:21 ` Michael S. Tsirkin
2010-03-18 19:37 ` Juan Quintela
2010-03-18 20:07 ` Anthony Liguori
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=4BA786C1.1030105@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=mst@redhat.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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).