Re: [Qemu-block] [Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target

2015-07-01 Thread Wen Congyang
On 07/01/2015 04:11 PM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: On 07/01/2015 03:01 AM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: On 06/27/2015 03:03 AM, Dr. David Alan Gilbert wrote: snip Ah, I hadn't realised you could

Re: [Qemu-block] [Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target

2015-07-01 Thread Dr. David Alan Gilbert
* Wen Congyang (we...@cn.fujitsu.com) wrote: On 07/01/2015 04:11 PM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: On 07/01/2015 03:01 AM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: On 06/27/2015 03:03 AM, Dr. David Alan Gilbert

[Qemu-block] [PATCH v2 02/15] ahci: stash ncq command

2015-07-01 Thread John Snow
For migration and werror=stop/rerror=stop resume purposes, it will be convenient to have the command handy inside of ncq_tfs. Eventually, we'd like to avoid reading from the FIS entirely after the initial read, so this is a byte (hah!) sized step in that direction. Signed-off-by: John Snow

[Qemu-block] [PATCH v2 01/15] ide: add limit to .prepare_buf()

2015-07-01 Thread John Snow
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

[Qemu-block] [PATCH v2 05/15] ahci: factor ncq_finish out of ncq_cb

2015-07-01 Thread John Snow
When we add werror=stop or rerror=stop support to NCQ, we'll want to take a codepath where we don't actually complete the command, so factor that out into a new routine. Signed-off-by: John Snow js...@redhat.com --- hw/ide/ahci.c | 32 +++- 1 file changed, 19

[Qemu-block] [PATCH v2 04/15] ahci: refactor process_ncq_command

2015-07-01 Thread John Snow
Split off execute_ncq_command so that we can call it separately later if we desire. Signed-off-by: John Snow js...@redhat.com --- hw/ide/ahci.c | 73 ++- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/hw/ide/ahci.c

[Qemu-block] [PATCH v2 03/15] ahci: assert is_ncq for process_ncq

2015-07-01 Thread John Snow
We already checked this in the handle_cmd phase, so just change this to an assertion and simplify the error logic. (Also, fix the switch indent, because checkpatch.pl yelled.) ((Sorry for churn.)) Signed-off-by: John Snow js...@redhat.com --- hw/ide/ahci.c | 60

[Qemu-block] [PATCH v2 06/15] ahci: add rwerror=stop support for ncq

2015-07-01 Thread John Snow
Handle NCQ failures for cases where we want to halt the VM on IO errors. Upon a VM state change, retry the halted NCQ commands. Signed-off-by: John Snow js...@redhat.com --- hw/ide/ahci.c | 36 ++-- hw/ide/ahci.h | 1 + hw/ide/core.c | 7 +++

[Qemu-block] [PATCH v2 15/15] ahci: fix sdb fis semantics

2015-07-01 Thread John Snow
There are two things to fix here: The first one is subtle: the PxSACT register in the AHCI HBA has different semantics from the field it is shadowing, the ACT field in the Set Device Bits FIS. In the HBA register, PxSACT acts as a bitfield indicating outstanding NCQ commands where a set bit

Re: [Qemu-block] [Qemu-devel] [PATCH] block/curl: Don't lose original error when a connection fails.

2015-07-01 Thread John Snow
On 06/25/2015 03:39 PM, Richard W.M. Jones wrote: Currently if qemu is connected to a curl source (eg. web server), and the web server fails / times out / dies, you always see a bogus EIO Input/output error. For example, choose a large file located on any local webserver which you

[Qemu-block] [PATCH 1/1] block: update BlockDriverState's children in bdrv_set_backing_hd()

2015-07-01 Thread Alberto Garcia
When a backing image is opened using bdrv_open_inherit(), it is added to the parent image's list of children. However there's no way to remove it from there. In particular, changing a BlockDriverState's backing image does not add the new one to the list nor removes the old one. If the latter is

[Qemu-block] [PATCH 0/1] A couple of problems with BlockDriverState's children list

2015-07-01 Thread Alberto Garcia
I've been debugging a couple of problems related to the recently merged bdrv_reopen() overhaul code. 1. bs-children is not updated correctly The problem is described in this e-mail: https://lists.gnu.org/archive/html/qemu-devel/2015-06/msg06813.html

Re: [Qemu-block] [RFC] ide: fix bmdma underflow code

2015-07-01 Thread Stefan Hajnoczi
On Mon, Jun 29, 2015 at 04:16:06PM -0400, John Snow wrote: diff --git a/hw/ide/core.c b/hw/ide/core.c index 8c271cc..6bcf07c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -716,8 +716,8 @@ static void ide_dma_cb(void *opaque, int ret) sector_num = ide_get_sector(s); if (n

Re: [Qemu-block] [Qemu-devel] [PATCH v3 2/2] virtio-blk: Use blk_drain() to drain IO requests

2015-07-01 Thread Markus Armbruster
Stefan Hajnoczi stefa...@redhat.com writes: On Mon, Jun 29, 2015 at 08:10:20AM +0200, Markus Armbruster wrote: Alexander Yarygin yary...@linux.vnet.ibm.com writes: Markus Armbruster arm...@redhat.com writes: * Ignorant answer: I was told that the bdrv_drain_all()'s comment is obsolete

Re: [Qemu-block] [Qemu-devel] [PATCH] refresh filename after the node is replaced

2015-07-01 Thread Max Reitz
On 01.07.2015 03:08, Wen Congyang wrote: On 06/30/2015 09:17 PM, Max Reitz wrote: On 29.06.2015 03:16, Wen Congyang wrote: On 06/26/2015 11:16 PM, Max Reitz wrote: I see two solutions to this issue: Either, we do it right and that means, if there is a change in the BDS graph (e.g. because of

Re: [Qemu-block] [RFC] ide: fix bmdma underflow code

2015-07-01 Thread John Snow
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 07/01/2015 06:18 AM, Stefan Hajnoczi wrote: On Mon, Jun 29, 2015 at 04:16:06PM -0400, John Snow wrote: diff --git a/hw/ide/core.c b/hw/ide/core.c index 8c271cc..6bcf07c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -716,8 +716,8 @@

Re: [Qemu-block] [PATCH 1/1] block: update BlockDriverState's children in bdrv_set_backing_hd()

2015-07-01 Thread Max Reitz
On 01.07.2015 16:21, Alberto Garcia wrote: When a backing image is opened using bdrv_open_inherit(), it is added to the parent image's list of children. However there's no way to remove it from there. In particular, changing a BlockDriverState's backing image does not add the new one to the

Re: [Qemu-block] [PATCH] block/mirror: limit qiov to IOV_MAX elements

2015-07-01 Thread Stefan Hajnoczi
On Wed, Jul 1, 2015 at 4:03 PM, Paolo Bonzini pbonz...@redhat.com wrote: On 01/07/2015 16:59, Stefan Hajnoczi wrote: I found it annoying to write it backwards too, but it's for consistency: if (s-buf_free_count nb_chunks + added_chunks) { trace_mirror_break_buf_busy(s, nb_chunks,

Re: [Qemu-block] [PATCH] block/mirror: limit qiov to IOV_MAX elements

2015-07-01 Thread Paolo Bonzini
On 01/07/2015 16:59, Stefan Hajnoczi wrote: I found it annoying to write it backwards too, but it's for consistency: if (s-buf_free_count nb_chunks + added_chunks) { trace_mirror_break_buf_busy(s, nb_chunks, s-in_flight); break; } if (IOV_MAX nb_chunks + added_chunks)

Re: [Qemu-block] [Qemu-devel] [PATCH] block/raw-posix: Don't think /dev/fd/NN is a floppy drive.

2015-07-01 Thread Markus Armbruster
Richard W.M. Jones rjo...@redhat.com writes: In libguestfs we use /dev/fd/NN to pass pre-opened file descriptors to qemu-img. Lately I've discovered that although this works, qemu believes that these are floppy disk images. That in itself isn't much of a problem, but now qemu prints a

[Qemu-block] [PATCH] block/mirror: limit qiov to IOV_MAX elements

2015-07-01 Thread Stefan Hajnoczi
If mirror has more free buffers than IOV_MAX, preadv(2)/pwritev(2) EINVAL failures may be encountered. It is possible to trigger this by setting granularity to a low value like 8192. This patch stops appending chunks once IOV_MAX is reached. The spurious EINVAL failure can be reproduced with a

Re: [Qemu-block] [Qemu-devel] [RFC PATCH COLO v2 00/13] Block replication for continuous checkpoints

2015-07-01 Thread Michael R. Hines
On 06/30/2015 11:11 PM, Wen Congyang wrote: On 07/01/2015 11:09 AM, Michael R. Hines wrote: On 03/25/2015 04:36 AM, Wen Congyang wrote: Block replication is a very important feature which is used for continuous checkpoints(for example: COLO). Usage: Please refer to docs/block-replication.txt

Re: [Qemu-block] [PATCH 1/1] block: update BlockDriverState's children in bdrv_set_backing_hd()

2015-07-01 Thread Alberto Garcia
On Wed 01 Jul 2015 06:05:32 PM CEST, Max Reitz mre...@redhat.com wrote: @@ -1120,6 +1128,11 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd) bs-backing_blocker = NULL; goto out; } + +bdrv_attach_child(bs, backing_hd,

Re: [Qemu-block] [Qemu-devel] [RFC PATCH COLO v2 00/13] Block replication for continuous checkpoints

2015-07-01 Thread Michael R. Hines
On 06/30/2015 11:11 PM, Wen Congyang wrote: On 07/01/2015 11:09 AM, Michael R. Hines wrote: On 03/25/2015 04:36 AM, Wen Congyang wrote: Block replication is a very important feature which is used for continuous checkpoints(for example: COLO). Usage: Please refer to docs/block-replication.txt

[Qemu-block] [PATCH v2 13/15] ahci: Do not map cmd_fis to generate response

2015-07-01 Thread John Snow
The Register D2H FIS should copy the current values of the registers instead of just parroting back the same values the guest sent back to it. In this case, the SECTOR COUNT variables are actually not generally meaningful in terms of standard commands (See ATA8-AC3 Section 9.2 Normal Outputs), so

[Qemu-block] [PATCH v2 10/15] ahci: add cmd header to ncq transfer state

2015-07-01 Thread John Snow
While the rest of the AHCI device can rely on a single bookmarked pointer for the AHCI Command Header currently being processed, NCQ is asynchronous and may have many commands in flight simultaneously. Add a cmdh pointer to the ncq_tfs object and make the sglist prepare function take an

[Qemu-block] [PATCH v2 12/15] ahci: ncq migration

2015-07-01 Thread John Snow
Migrate the NCQ queue. This is solely for the benefit of halted commands, since anything else should have completed and had any relevant status flushed to the HBA registers already. Signed-off-by: John Snow js...@redhat.com --- hw/ide/ahci.c | 51

Re: [Qemu-block] [Qemu-devel] [PATCH v2 00/16] ahci: ncq cleanup, part 1

2015-07-01 Thread John Snow
On 06/22/2015 07:38 PM, John Snow wrote: requires: 1434470575-21625-1-git-send-email-js...@redhat.com [PATCH v2 0/4] ahci: misc fixes/tests for 2.4 This series adds a couple of tests to exercise the NCQ pathways and establish a baseline for us. Most of these patches are fairly

Re: [Qemu-block] [RFC] ide: fix bmdma underflow code

2015-07-01 Thread Stefan Hajnoczi
On Wed, Jul 1, 2015 at 4:49 PM, John Snow js...@redhat.com wrote: On 07/01/2015 06:18 AM, Stefan Hajnoczi wrote: On Mon, Jun 29, 2015 at 04:16:06PM -0400, John Snow wrote: diff --git a/hw/ide/core.c b/hw/ide/core.c index 8c271cc..6bcf07c 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -716,8

Re: [Qemu-block] [Qemu-devel] [PATCH v2 0/4] ahci: misc fixes/tests for 2.4

2015-07-01 Thread John Snow
(Staging as a pre-req for NCQ fixes, last chance to whine!) On 06/16/2015 12:02 PM, John Snow wrote: This is a small handful of fixes for the ahci-tests/ahci device, alongside two new tests. I have a larger series of NCQ patches coming shortly, but these patches were unrelated so I cleaned

[Qemu-block] [PATCH v2 07/15] ahci: correct types in NCQTransferState

2015-07-01 Thread John Snow
Signed-off-by: John Snow js...@redhat.com --- hw/ide/ahci.c | 10 +- hw/ide/ahci.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index d996f37..efd07ac 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -45,7 +45,7 @@ do { \ }

[Qemu-block] [PATCH v2 09/15] qtest/ahci: halted NCQ test

2015-07-01 Thread John Snow
Signed-off-by: John Snow js...@redhat.com --- tests/ahci-test.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 3f06fd9..c30837b 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -1200,13 +1200,13 @@

[Qemu-block] [PATCH v2 08/15] ahci: correct ncq sector count

2015-07-01 Thread John Snow
uint16_t isn't enough to hold the real sector count, since a value of zero implies a full 64K sectors, so we need a uint32_t here. We *could* cheat and pretend that this value is 0-based and fit it in a uint16_t, but I'd rather waste 2 bytes instead of a future dev's 10 minutes when they forget

Re: [Qemu-block] [Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target

2015-07-01 Thread Dr. David Alan Gilbert
* Wen Congyang (we...@cn.fujitsu.com) wrote: On 07/01/2015 03:01 AM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: On 06/27/2015 03:03 AM, Dr. David Alan Gilbert wrote: snip Ah, I hadn't realised you could do that; so do you just do:

[Qemu-block] [PATCH] raw-posix.c: remove raw device access for cdrom

2015-07-01 Thread Programmingkid
Fix real cdrom access in Mac OS X so it can be used in QEMU. It simply removes the r from a device file's name. This allows for a real cdrom to be accessible to the guest. It has been successfully tested with a Windows XP guest in qemu-system-i386. The qemu-system-ppc emulator doesn't quit

Re: [Qemu-block] [Qemu-devel] [PATCH COLO-Block v6 07/16] Add new block driver interface to connect/disconnect the remote target

2015-07-01 Thread Wen Congyang
On 07/02/2015 02:42 AM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: On 07/01/2015 04:11 PM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com) wrote: On 07/01/2015 03:01 AM, Dr. David Alan Gilbert wrote: * Wen Congyang (we...@cn.fujitsu.com)

Re: [Qemu-block] [Qemu-devel] [RFC PATCH COLO v2 00/13] Block replication for continuous checkpoints

2015-07-01 Thread Wen Congyang
On 07/02/2015 03:37 AM, Michael R. Hines wrote: On 06/30/2015 11:11 PM, Wen Congyang wrote: On 07/01/2015 11:09 AM, Michael R. Hines wrote: On 03/25/2015 04:36 AM, Wen Congyang wrote: Block replication is a very important feature which is used for continuous checkpoints(for example: COLO).

Re: [Qemu-block] [Qemu-devel] [RFC PATCH COLO v2 00/13] Block replication for continuous checkpoints

2015-07-01 Thread Wen Congyang
On 07/02/2015 03:37 AM, Michael R. Hines wrote: On 06/30/2015 11:11 PM, Wen Congyang wrote: On 07/01/2015 11:09 AM, Michael R. Hines wrote: On 03/25/2015 04:36 AM, Wen Congyang wrote: Block replication is a very important feature which is used for continuous checkpoints(for example: COLO).