qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
	Andrea Arcangeli <andrea@qumranet.com>
Subject: Re: [Qemu-devel] [RFC 1/1] pci-dma-api-v2
Date: Mon, 01 Dec 2008 10:37:58 -0600	[thread overview]
Message-ID: <493412E6.9020308@codemonkey.ws> (raw)
In-Reply-To: <4933B13C.6070205@redhat.com>

Avi Kivity wrote:
> Anthony Liguori wrote:
>>
>> I think you need something more sophisticated that can split up a 
>> scatter/gather list into a set of partial bounce buffers and partial 
>> direct copies.  Just checking the vector once is a bit hackish.
>>
>
> That code path would never be used or tested.  As it is, bouncing will 
> only be invoked by dma to or from mmio, and I expect most guests never 
> to invoke it.  Why would we complicate the code even more?

I'm not sure it's strictly required but I think it would be a 
simplificaction.

>>
>> What should be fixed?  Are these emulated functions wrong?
>>
>> There's a lack of symmetry here.  We should have a bdrv_readv and 
>> bdrv_aio_readv.  bdrv_read and bdrv_aio_read should disappear.  We 
>> can maintain wrappers that create a compatible interface for older 
>> code but just adding a new API is wrong.
>>
>
> It was understood a real aio readv/writev was being worked on, so the 
> emulation could be a temporary step.

Yes, but that's orthogonal to what I'm saying here.  I'm saying that 
instead of adding an optional ->aio_readv() member, we should eliminate 
the ->aio_read() member and replace it with ->aio_readv().  There are 
only three or four places in the code that implement aio so it's not a 
big change.  It avoids introducing a new API too.

I also think we should have complimentary synchronous vector functions 
although I'd like to see the synchronous API disappear completely.

>>> +BlockDriverAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t 
>>> sector_num,
>>> +                 struct iovec *iov, int iovcnt, size_t len,
>>> +                 BlockDriverCompletionFunc *cb, void *opaque)
>>> +{
>>>   
>>
>> struct iovec does not exist on Windows.  I also don't think you've 
>> got the abstraction right.  Reading and writing may require actions 
>> to happen.  I don't think you can just introduce something as simple 
>> as an iovec here.  I think we need something more active.
>>
>
> Can you elaborate?  Actions happen in the completion callback.  This 
> is just an straightforward extension of the block API, I don't think a 
> dma api should materially change the block api.

If we're not going to try and fold in the IOMMU/PCI BUS API at this 
pass, then this is less important.  But to implement a proper PCI bus 
API, I think there has to be function pointers associated with each 
element of the scatter/gather list that control how data is copied in 
and out of each element.

>>
>> I think you missed the mark here.  This API needs to go through the 
>> PCIBus and be pluggable at that level.  There can be a default 
>> implementation but it may differ for each PCI bus.
>>
>
> I think this can serve as the default implementation.  Perhaps when a 
> concrete user of pluggable dma emerges we can understand the 
> requirements better.

I think if we drop the pci_ prefixes and just treat it as a basic DMA 
API as Blue Swirl suggested, then this is closer to what we need.

Regards,

Anthony Liguori

  reply	other threads:[~2008-12-01 16:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27 12:35 [Qemu-devel] [RFC 1/2] pci-dma-api-v1 Andrea Arcangeli
2008-11-27 12:43 ` [Qemu-devel] [RFC 2/2] bdrv_aio_readv/writev_em Andrea Arcangeli
2008-11-28 11:09   ` Jamie Lokier
2008-11-27 19:14 ` [Qemu-devel] [RFC 1/2] pci-dma-api-v1 Blue Swirl
2008-11-28  1:56   ` Andrea Arcangeli
2008-11-28 17:59     ` Blue Swirl
2008-11-28 18:50       ` Andrea Arcangeli
2008-11-28 19:03         ` Blue Swirl
2008-11-28 19:18           ` Jamie Lokier
2008-11-29 19:49             ` Avi Kivity
2008-11-30 17:20             ` Andrea Arcangeli
2008-11-30 22:31             ` Anthony Liguori
2008-11-30 18:04           ` Andrea Arcangeli
2008-11-30 17:41         ` [Qemu-devel] [RFC 1/1] pci-dma-api-v2 Andrea Arcangeli
2008-11-30 18:36           ` [Qemu-devel] " Blue Swirl
2008-11-30 19:04             ` Andrea Arcangeli
2008-11-30 19:11               ` Blue Swirl
2008-11-30 19:20                 ` Andrea Arcangeli
2008-11-30 21:36                   ` Blue Swirl
2008-11-30 22:54                     ` Anthony Liguori
2008-11-30 22:50           ` [Qemu-devel] " Anthony Liguori
2008-12-01  9:41             ` Avi Kivity
2008-12-01 16:37               ` Anthony Liguori [this message]
2008-12-02  9:45                 ` Avi Kivity
2008-11-30 22:38         ` [Qemu-devel] [RFC 1/2] pci-dma-api-v1 Anthony Liguori
2008-11-30 22:51           ` Jamie Lokier
2008-11-30 22:34       ` Anthony Liguori
2008-11-29 19:48   ` Avi Kivity
2008-11-30 17:29     ` Andrea Arcangeli
2008-11-30 20:27       ` Avi Kivity
2008-11-30 22:33         ` Andrea Arcangeli
2008-11-30 22:33   ` 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=493412E6.9020308@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=andrea@qumranet.com \
    --cc=blauwirbel@gmail.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).