qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Arcangeli <aarcange@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: chrisw@redhat.com, avi@redhat.com,
	Gerd Hoffmann <kraxel@redhat.com>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 2 of 5] add can_dma/post_dma for direct IO
Date: Sun, 14 Dec 2008 17:47:52 +0100	[thread overview]
Message-ID: <20081214164751.GF30537@random.random> (raw)
In-Reply-To: <4944251D.8080109@codemonkey.ws>

On Sat, Dec 13, 2008 at 03:11:57PM -0600, Anthony Liguori wrote:
> cause an overflow.  You will naturally validate this in the map() function 
> because you cannot map something that is greater than can fit in a void *.  

When you told me to pass ram_addr_t instead of size_t in my patch, I
didn't mean it was just for validating that callers would comply with
the clear dma interface. With my patch I was going to truly support
dma operations larger than 4G on 32bit host and 64bit guest, but only
with mmio regions as destination, and with a max overhead of the
max-bounce-size of 1M.

To me map/unmap looks backwards. There's absolutely no point at all to
pretend that RAM isn't always mapped. Furthermore bouncing inside that
layer (at least with the api that you're proposing that can't handle
partial I/O and restart) is obviously broken design.

Once memory hotplug will emerge we've just to add a read write lock
before invoking can-dma/post-dma and stuff. There's no reason to ever
call anything after a read dma completed.

After my stuff would work, my next step would be to get rid entirely
of that per-page array that translates a ram_addr_t to a virtual
address and replace it with a rbtree of linear ranges, and then the
iovec would need to be passed down to exec.c so that it would be
filled with direct dma even if the whole range isn't linear. And in
average a single lookup of the tree would return us immediate
information.

I'm ok to support a not entirely flat ram space, but pretending to
support an API that requires to mangle host ptes (and sptes on kvm
case) every time there's a dma is entirely overkill and backwards,
besides preventing you to bounce sanely if you go over mmio regions
and preventing you as well to dma >4G space of mmio on 32bit build
with 64bit guest.

The whole concept of having to map something is flawed, there's
nothing to map. At most you've to take a read lock to prevent future
memory hotplug to change the memory layout from under you, but the
concept of mapping has nothing to do with that. RAM is always mapped,
and mmio has to be emulated anyway so it's worthless to map it.

  reply	other threads:[~2008-12-14 16:48 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12 18:16 [Qemu-devel] [PATCH 0 of 5] dma api v3 Andrea Arcangeli
2008-12-12 18:16 ` [Qemu-devel] [PATCH 1 of 5] fix cpu_physical_memory len Andrea Arcangeli
2008-12-12 19:06   ` [Qemu-devel] " Anthony Liguori
2008-12-12 19:26     ` Andrea Arcangeli
2008-12-12 18:16 ` [Qemu-devel] [PATCH 2 of 5] add can_dma/post_dma for direct IO Andrea Arcangeli
2008-12-12 19:00   ` Blue Swirl
2008-12-12 19:18     ` Anthony Liguori
2008-12-12 20:05       ` Blue Swirl
2008-12-12 20:10         ` Anthony Liguori
2008-12-12 19:15   ` [Qemu-devel] " Anthony Liguori
2008-12-12 19:37     ` Andrea Arcangeli
2008-12-12 20:09       ` Anthony Liguori
2008-12-12 20:25       ` Gerd Hoffmann
2008-12-12 19:39     ` Anthony Liguori
2008-12-13  9:22       ` Avi Kivity
2008-12-13 16:45         ` Anthony Liguori
2008-12-13 19:48           ` Avi Kivity
2008-12-13 21:07             ` Anthony Liguori
2008-12-14  6:03               ` Avi Kivity
2008-12-14 19:10                 ` Anthony Liguori
2008-12-14 19:49                   ` Avi Kivity
2008-12-14 23:08                     ` Anthony Liguori
2008-12-15  0:57                       ` Paul Brook
2008-12-15  2:09                         ` Anthony Liguori
2008-12-15  6:23                           ` Avi Kivity
2008-12-15 18:35                       ` Blue Swirl
2008-12-15 22:06                         ` Anthony Liguori
2008-12-16  9:41                           ` Avi Kivity
2008-12-16 16:55                             ` Blue Swirl
2008-12-16 17:09                               ` Avi Kivity
2008-12-16 17:48                                 ` Anthony Liguori
2008-12-16 18:11                                   ` Blue Swirl
2008-12-16 15:57                           ` Blue Swirl
2008-12-16 16:29                             ` Paul Brook
2008-12-16 16:35                               ` Blue Swirl
2008-12-14 17:30       ` Jamie Lokier
2008-12-13 14:39     ` Andrea Arcangeli
2008-12-13 16:46       ` Anthony Liguori
2008-12-13 16:53         ` Andrea Arcangeli
2008-12-13 17:54           ` Andreas Färber
2008-12-13 21:11           ` Anthony Liguori
2008-12-14 16:47             ` Andrea Arcangeli [this message]
2008-12-14 17:01               ` Avi Kivity
2008-12-14 17:15                 ` Andrea Arcangeli
2008-12-14 19:59                   ` Avi Kivity
2008-12-22 16:44                     ` Ian Jackson
2008-12-22 19:44                       ` Avi Kivity
2008-12-23  0:03                         ` Thiemo Seufer
2008-12-23  1:02                           ` Andrea Arcangeli
2008-12-23 17:31                           ` Avi Kivity
2008-12-22 19:46                       ` Avi Kivity
2009-01-05 10:27                         ` Gerd Hoffmann
2008-12-13 22:47     ` Anthony Liguori
2008-12-14  6:07       ` Avi Kivity
2008-12-12 18:16 ` [Qemu-devel] [PATCH 3 of 5] rename dma.c to isa_dma.c Andrea Arcangeli
2008-12-12 18:16 ` [Qemu-devel] [PATCH 4 of 5] dma api Andrea Arcangeli
2008-12-12 18:55   ` Blue Swirl
2008-12-12 18:16 ` [Qemu-devel] [PATCH 5 of 5] bdrv_aio_readv/writev Andrea Arcangeli

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=20081214164751.GF30537@random.random \
    --to=aarcange@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=chrisw@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kvm@vger.kernel.org \
    --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).