qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 01/15] ide: add limit to .prepare_buf()
Date: Thu, 2 Jul 2015 15:04:55 +0100	[thread overview]
Message-ID: <20150702140455.GL21214@stefanha-thinkpad.home> (raw)
In-Reply-To: <1435767578-32743-2-git-send-email-jsnow@redhat.com>

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

On Wed, Jul 01, 2015 at 12:19:24PM -0400, John Snow wrote:
> prepare_buf should not always grab as many descriptors
> as it can, sometimes it should self-limit.
> 
> For example, an NCQ transfer of 1 sector with a PRDT that
> describes 4GiB of data should not copy 4GiB of data, it
> should just transfer that first 512 bytes.
> 
> PIO is not affected, because the dma_buf_rw dma helpers
> already have a byte limit built-in to them, but DMA/NCQ
> will exhaust the entire list regardless of requested size.
> 
> AHCI 1.3 specifies in section 6.1.6 Command List Underflow that
> NCQ is not required to detect underflow conditions. Non-NCQ
> pathways signal underflow by writing to the PRDBC field, which
> will already occur by writing the actual transferred byte count
> to the PRDBC, signaling the underflow.
> 
> Our NCQ pathways aren't required to detect underflow, but since our DMA
> backend uses the size of the PRDT to determine the size of the transer,
> if our PRDT is bigger than the transaction (the underflow condition) it
> doesn't cost us anything to detect it and truncate the PRDT.
> 
> This is a recoverable error and is not signaled to the guest, in either
> NCQ or normal DMA cases.
> 
> For BMDMA, the existing pathways should see no guest-visible difference,
> but any bytes described in the overage will no longer be transferred
> before indicating to the guest that there was an underflow.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  hw/ide/ahci.c     | 27 ++++++++++++++-------------
>  hw/ide/core.c     |  8 ++++----
>  hw/ide/internal.h |  2 +-
>  hw/ide/macio.c    |  2 +-
>  hw/ide/pci.c      | 21 ++++++++++++++++-----
>  5 files changed, 36 insertions(+), 24 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

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

  reply	other threads:[~2015-07-02 14:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 16:19 [Qemu-devel] [PATCH v2 00/15] ahci: ncq cleanup, part 2 John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 01/15] ide: add limit to .prepare_buf() John Snow
2015-07-02 14:04   ` Stefan Hajnoczi [this message]
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 02/15] ahci: stash ncq command John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 03/15] ahci: assert is_ncq for process_ncq John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 04/15] ahci: refactor process_ncq_command John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 05/15] ahci: factor ncq_finish out of ncq_cb John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 06/15] ahci: add rwerror=stop support for ncq John Snow
2015-07-02 14:05   ` Stefan Hajnoczi
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 07/15] ahci: correct types in NCQTransferState John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 08/15] ahci: correct ncq sector count John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 09/15] qtest/ahci: halted NCQ test John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 10/15] ahci: add cmd header to ncq transfer state John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 11/15] ahci: add get_cmd_header helper John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 12/15] ahci: ncq migration John Snow
2015-07-02 14:06   ` Stefan Hajnoczi
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 13/15] ahci: Do not map cmd_fis to generate response John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 14/15] qtest/ahci: halted ncq migration test John Snow
2015-07-01 16:19 ` [Qemu-devel] [PATCH v2 15/15] ahci: fix sdb fis semantics John Snow
2015-07-02 14:09 ` [Qemu-devel] [PATCH v2 00/15] ahci: ncq cleanup, part 2 Stefan Hajnoczi
2015-07-02 15:36 ` John Snow

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=20150702140455.GL21214@stefanha-thinkpad.home \
    --to=stefanha@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.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).