qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 16/17] spapr_vio: take care of creating our own AddressSpace/DMAContext
Date: Thu, 2 May 2013 12:24:55 +1000	[thread overview]
Message-ID: <20130502022455.GD13041@truffula.fritz.box> (raw)
In-Reply-To: <51813E31.5070500@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

On Wed, May 01, 2013 at 06:09:21PM +0200, Paolo Bonzini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Il 01/05/2013 07:16, David Gibson ha scritto:
> > Lack of atomicity makes me a little nervous there, although I
> > guess its ok since qemu is single-threaded.
> 
> Yes.  The original plan was to add a boolean return value to
> address_space_rw, but I left this for later since I wasn't sure of the
> semantics for multipage writes.  What happens if the second half of
> the destination buffer has an invalid translation?  Right now it's
> atomic, but it sounds weird for real hardware.

So, in this regard I don't think real hardware would be atomic.  It
would write a certain amount, then generate some sort of bus error
when it hits the bad translation.  So in general I expect the (guest)
OS would need to treat the target of in-flight device to host DMAs as
having undefined contents if there's a bus error like that.  It would
depend on bus and possibly individual device conventions what it could
assume about which DMAs are interrupted, and which might still be
in-flight.

That is, in this sense, we don't expect the hardware to behave
atomically at all.  The atomicity I was concerned about was atomicity
of checking permissions and returning an error based on that check.

So, case, I think an error return value from address_space_rw() is
appropriate.  Semantics would be that if an error is returned you
can't tell if the operation has not started, completed, or somewhere
in the middle.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

      reply	other threads:[~2013-05-02  2:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1367378320-9246-1-git-send-email-david@gibson.dropbear.id.au>
     [not found] ` <1367378320-9246-7-git-send-email-david@gibson.dropbear.id.au>
2013-05-01  4:02   ` [Qemu-devel] [PATCH 07/17] memory: add address_space_valid David Gibson
2013-05-01  7:17     ` Paolo Bonzini
     [not found] ` <1367378320-9246-11-git-send-email-david@gibson.dropbear.id.au>
2013-05-01  4:38   ` [Qemu-devel] [PATCH 11/17] spapr: convert TCE API to use an opaque type David Gibson
     [not found] ` <1367378320-9246-13-git-send-email-david@gibson.dropbear.id.au>
2013-05-01  4:46   ` [Qemu-devel] [PATCH 13/17] spapr: use memory core for iommu support David Gibson
     [not found] ` <1367378320-9246-14-git-send-email-david@gibson.dropbear.id.au>
2013-05-01  4:49   ` [Qemu-devel] [PATCH 14/17] dma: eliminate old-style IOMMU support David Gibson
     [not found] ` <1367378320-9246-15-git-send-email-david@gibson.dropbear.id.au>
2013-05-01  5:06   ` [Qemu-devel] [PATCH 15/17] pci: use memory core for iommu support David Gibson
2013-05-01 16:07     ` Paolo Bonzini
     [not found] ` <1367378320-9246-16-git-send-email-david@gibson.dropbear.id.au>
2013-05-01  5:16   ` [Qemu-devel] [PATCH 16/17] spapr_vio: take care of creating our own AddressSpace/DMAContext David Gibson
2013-05-01 16:09     ` Paolo Bonzini
2013-05-02  2:24       ` David Gibson [this message]

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=20130502022455.GD13041@truffula.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=pbonzini@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).