qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Alexander Graf <agraf@suse.de>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Possibility of unaligned DMA accesses via the QEMU DMA API?
Date: Wed, 17 Jul 2013 21:12:09 +0100	[thread overview]
Message-ID: <51E6FA99.7070508@ilande.co.uk> (raw)
In-Reply-To: <20130717133538.GJ2458@dhcp-200-207.str.redhat.com>

On 17/07/13 14:35, Kevin Wolf wrote:

> Okay, so I've had a quick look at that DMA controller, and it seems that
> for a complete emulation, there's no way around using a bounce buffer
> (and calling directly into the block layer instead of using
> dma-helpers.c) for the general case.
>
> You can have a fast path that is triggered if one or more directly
> following INPUT/OUTPUT commands cover the whole IDE command, and that
> creates an QEMUSGList as described above and uses dma-helpers.c to
> implement zero-copy requests. I suspect that your Darwin requests would
> actually fall into this category.
>
> Essentially I think Alex' patches are doing something similar, just not
> implementing the complete DMA controller feature set and with the
> regular slow path hacked as additional code into the fast path. So the
> code could be cleaner, it could use asynchronous block layer functions
> and handle errors, and it could be more complete, but at the end of
> the day you'd still have some fast-path zero-copy I/O and some calls
> into the block layer using bounce buffers.

I think the key concept to understand here is at what point does the 
data hit the disk? From the comments in various parts of Darwin/Linux, 
it could be understood that the DMA transfers are between memory and the 
ATA drive *buffer*, so for writes especially there is no guarantee that 
they even hit the disk until some point in the future, unless of course 
the FLUSH flag is set in the control register.

So part of me makes me think that maybe we are over-thinking this and we 
should just go with Kevin's original suggestion: what about if we start 
a new QEMUSGList for each IDE transfer, and just keep appending 
QEMUSGList entries until we find an OUTPUT_LAST/INPUT_LAST command?

Why is this valid? We can respond with a complete status for the 
intermediate INPUT_MORE/OUTPUT_MORE commands without touching the disk 
because all that guarantees is that data has been passed between memory 
and the drive *buffer* - not that it has actually hit the disk. And what 
is the point of having explicit _LAST commands if they aren't used to 
signify completion of the whole transfer between drive and memory?


ATB,

Mark.

  reply	other threads:[~2013-07-17 20:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <51E64692.1010407@ilande.co.uk>
     [not found] ` <20130717081627.GB2458@dhcp-200-207.str.redhat.com>
2013-07-17 12:52   ` [Qemu-devel] Possibility of unaligned DMA accesses via the QEMU DMA API? Mark Cave-Ayland
2013-07-17 12:59     ` Alexander Graf
2013-07-17 13:35       ` Kevin Wolf
2013-07-17 20:12         ` Mark Cave-Ayland [this message]
2013-07-18  7:41           ` Kevin Wolf
2013-07-18 13:44             ` Alexander Graf
2013-07-18 13:55               ` Kevin Wolf
2013-07-22  8:04               ` Mark Cave-Ayland

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=51E6FA99.7070508@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=agraf@suse.de \
    --cc=kwolf@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).