Re: [Qemu-block] [Qemu-devel] [PATCH COLO v4 01/15] docs: block replication's description

2015-05-21 Thread Wen Congyang
On 05/21/2015 12:31 AM, Andrey Korolyov wrote: On Thu, May 14, 2015 at 6:38 PM, Dr. David Alan Gilbert dgilb...@redhat.com wrote: * Wen Congyang (ghost...@gmail.com) wrote: At 2015/5/14 19:19, Dr. David Alan Gilbert Wrote: One thing I wanted to check I understand; how much RAM do the active

Re: [Qemu-block] [PATCH v6 01/13] block: Add op blocker type device IO

2015-05-21 Thread Wen Congyang
On 05/21/2015 02:42 PM, Fam Zheng wrote: It blocks device IO. Does tt only block virtio-blk/scsi? Not all block types? Thanks Wen Congyang All bdrv_op_block_all/blk_op_block_all callers are taken care of: - virtio_blk_data_plane_create - virtio_scsi_hotplug Device creation, unblock

[Qemu-block] [PATCH v6 01/13] block: Add op blocker type device IO

2015-05-21 Thread Fam Zheng
It blocks device IO. All bdrv_op_block_all/blk_op_block_all callers are taken care of: - virtio_blk_data_plane_create - virtio_scsi_hotplug Device creation, unblock it. - bdrv_set_backing_hd Backing hd is not used by device, so blocking is OK. - backup_start Blocking target when

[Qemu-block] [PATCH v6 00/13] Fix transactional snapshot with dataplane and NBD export

2015-05-21 Thread Fam Zheng
v6: Patch 13: unset block after bdrv_swap(). Reported by Paolo. Unlike the iohandler in main loop, iothreads currently process the event notifier used by virtio-blk ioeventfd in nested aio_poll. This is dangerous without proper protection, because guest requests could sneak to block layer where

[Qemu-block] [PATCH v6 03/13] block-backend: Add blk_op_blocker_add_notifier

2015-05-21 Thread Fam Zheng
Forward the call to bdrv_op_blocker_add_notifier. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com --- block/block-backend.c | 6 ++ include/sysemu/block-backend.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/block/block-backend.c

Re: [Qemu-block] [PATCH COLO-Block v5 00/15] Block replication for continuous checkpoints

2015-05-21 Thread Wen Congyang
On 05/21/2015 12:52 PM, 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 You can get the patch here:

[Qemu-block] [PATCH v6 04/13] virtio-blk: Move complete_request to 'ops' structure

2015-05-21 Thread Fam Zheng
Should more ops be added to differentiate code between dataplane and non-dataplane, the new saved_ops approach will be cleaner than messing with N pointers. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com --- hw/block/dataplane/virtio-blk.c | 13 -

[Qemu-block] [PATCH v6 05/13] virtio-blk: Don't handle output when there is device IO op blocker

2015-05-21 Thread Fam Zheng
virtio-blk now listens to op blocker change of the associated block backend. Up on setting op blocker on BLOCK_OP_TYPE_DEVICE_IO: non-dataplane: 1) Set VirtIOBlock.paused 2) In virtio_blk_handle_output, do nothing if VirtIOBlock.paused dataplane: 1) Clear the host event notifier

[Qemu-block] [PATCH v6 11/13] blockdev: Block device IO during blockdev-backup transaction

2015-05-21 Thread Fam Zheng
Signed-off-by: Fam Zheng f...@redhat.com --- blockdev.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index ae52d27..bd28183 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1649,6 +1649,7 @@ typedef struct BlockdevBackupState {

[Qemu-block] [PATCH v6 02/13] block: Add op blocker notifier list

2015-05-21 Thread Fam Zheng
BDS users can register a notifier and get notified about op blocker changes. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: Max Reitz mre...@redhat.com --- block.c | 35 +++ include/block/block.h | 8

Re: [Qemu-block] [Qemu-devel] [PATCH 3/8] fdc: Introduce fdctrl-phase

2015-05-21 Thread Dr. David Alan Gilbert
* Peter Maydell (peter.mayd...@linaro.org) wrote: On 21 May 2015 at 12:09, Markus Armbruster arm...@redhat.com wrote: Kevin Wolf kw...@redhat.com writes: Am 21.05.2015 um 12:11 hat Peter Maydell geschrieben: 2b add a subsection, send the subsection always in new qemu, if receiving from

[Qemu-block] [PATCH v2 0/8] fdc: Clean up and fix command processing

2015-05-21 Thread Kevin Wolf
The hotfix for CVE-2015-3456 fixed the security problem, but didn't fully correct the behaviour of the emulated floppy controller. This series fixes the bug that was the root cause for the problem, and does some cleanup in the FIFO access functions to make the command processing more obvious.

[Qemu-block] [PATCH v2 1/8] fdc: Rename fdctrl_reset_fifo() to fdctrl_to_command_phase()

2015-05-21 Thread Kevin Wolf
What all callers of fdctrl_reset_fifo() really want to do is to start the command phase, where writes to the data port initiate a new command. The function doesn't only clear the FIFO, but also sets up the state so that a new command can be received. Rename it to reflect this. Signed-off-by:

Re: [Qemu-block] [Qemu-devel] [PATCH COLO v4 01/15] docs: block replication's description

2015-05-21 Thread Andrey Korolyov
On Thu, May 21, 2015 at 11:35 AM, Wen Congyang we...@cn.fujitsu.com wrote: On 05/21/2015 12:31 AM, Andrey Korolyov wrote: On Thu, May 14, 2015 at 6:38 PM, Dr. David Alan Gilbert dgilb...@redhat.com wrote: * Wen Congyang (ghost...@gmail.com) wrote: At 2015/5/14 19:19, Dr. David Alan Gilbert

[Qemu-block] [PATCH v2 3/8] fdc: Introduce fdctrl-phase

2015-05-21 Thread Kevin Wolf
The floppy controller spec describes three different controller phases, which are currently not explicitly modelled in our emulation. Instead, each phase is represented by a combination of flags in registers. This patch makes explicit in which phase the controller currently is. Signed-off-by:

[Qemu-block] [PATCH v2 2/8] fdc: Rename fdctrl_set_fifo() to fdctrl_to_result_phase()

2015-05-21 Thread Kevin Wolf
What callers really do with this function is to switch from execution phase (including data transfers) to result phase where the guest can read out one or more status bytes from the FIFO (the number depends on the command). Rename the function accordingly. Signed-off-by: Kevin Wolf

[Qemu-block] [PATCH v2 5/8] fdc: Code cleanup in fdctrl_write_data()

2015-05-21 Thread Kevin Wolf
Factor out a few common lines of code, reformat, improve comments. Signed-off-by: Kevin Wolf kw...@redhat.com --- hw/block/fdc.c | 63 -- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index

[Qemu-block] [PATCH v2 4/8] fdc: Use phase in fdctrl_write_data()

2015-05-21 Thread Kevin Wolf
Instead of relying on a flag in the MSR to distinguish controller phases, use the explicit phase that we store now. Assertions of the right MSR flags are added. Signed-off-by: Kevin Wolf kw...@redhat.com Reviewed-by: John Snow js...@redhat.com --- hw/block/fdc.c | 69

[Qemu-block] [PATCH v2 7/8] fdc: Fix MSR.RQM flag

2015-05-21 Thread Kevin Wolf
The RQM bit in MSR should be set whenever the guest is supposed to access the FIFO, and it should be cleared in all other cases. This is important so the guest can't continue writing/reading the FIFO beyond the length that it's suppossed to access (see CVE-2015-3456). Commit e9077462 fixed the

Re: [Qemu-block] [Qemu-devel] [PATCH v2 7/8] fdc: Fix MSR.RQM flag

2015-05-21 Thread John Snow
On 05/21/2015 09:19 AM, Kevin Wolf wrote: The RQM bit in MSR should be set whenever the guest is supposed to access the FIFO, and it should be cleared in all other cases. This is important so the guest can't continue writing/reading the FIFO beyond the length that it's suppossed to access

Re: [Qemu-block] [Qemu-devel] [PATCH 3/8] fdc: Introduce fdctrl-phase

2015-05-21 Thread Peter Maydell
On 21 May 2015 at 10:42, Kevin Wolf kw...@redhat.com wrote: Am 20.05.2015 um 14:07 hat Peter Maydell geschrieben: On 20 May 2015 at 12:55, John Snow js...@redhat.com wrote: So even if /currently/ we can reconstitute it from the register values, we may eventually be unable to. post_load

Re: [Qemu-block] [Qemu-devel] [PATCH v2 3/8] fdc: Introduce fdctrl-phase

2015-05-21 Thread John Snow
On 05/21/2015 09:19 AM, Kevin Wolf wrote: The floppy controller spec describes three different controller phases, which are currently not explicitly modelled in our emulation. Instead, each phase is represented by a combination of flags in registers. This patch makes explicit in which

[Qemu-block] [PATCH v4 1/8] block: Add base option to bdrv_get_block_status

2015-05-21 Thread Fam Zheng
Now this function follows the backing chain until seeing BDRV_BLOCK_ALLOCATED. Base is not included, and it can be NULL just like bdrv_is_allocated_above(). Existing callers pass in bs-backing_hd to keep the old behavior. Signed-off-by: Fam Zheng f...@redhat.com --- block/io.c| 39

[Qemu-block] [PATCH v4 0/8] block: Mirror discarded sectors

2015-05-21 Thread Fam Zheng
v4: Add Paolo's rev-by in 2,4. Add unmap option to drive-mirror. Introduce above to bdrv_get_block_status and use it in mirror.c v3: Add John's rev-by in patches 3~6. Rewrite patch 1: discard may not suffice, use write zeroes in that case. v2: Fix typo and add Eric's rev-by in patch

[Qemu-block] [PATCH v4 4/8] block: Fix dirty bitmap in bdrv_co_discard

2015-05-21 Thread Fam Zheng
Unsetting dirty globally with discard is not very correct. The discard may zero out sectors (depending on can_write_zeroes_with_unmap), we should replicate this change to destinition side to make sure that the guest sees the same data. Calling bdrv_reset_dirty also troubles mirror job because the

[Qemu-block] [PATCH v4 5/8] block: Remove bdrv_reset_dirty

2015-05-21 Thread Fam Zheng
Using this function would always be wrong because a dirty bitmap must have a specific owner that consumes the dirty bits and calls bdrv_reset_dirty_bitmap(). Remove the unused function to avoid future misuse. Reviewed-by: Eric Blake ebl...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com

[Qemu-block] [PATCH v4 6/8] qemu-iotests: Make block job methods common

2015-05-21 Thread Fam Zheng
Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: John Snow js...@redhat.com Reviewed-by: Paolo Bonzini pbonz...@redhat.com --- tests/qemu-iotests/041| 66 ++- tests/qemu-iotests/iotests.py | 28 ++ 2 files changed, 43

[Qemu-block] [PATCH v4 8/8] iotests: Use event_wait in wait_ready

2015-05-21 Thread Fam Zheng
Only poll the specific type of event we are interested in, to avoid stealing events that should be consumed by someone else. Suggested-by: John Snow js...@redhat.com Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: John Snow js...@redhat.com --- tests/qemu-iotests/iotests.py | 9 ++---

[Qemu-block] [PATCH v4 7/8] qemu-iotests: Add test case for mirror with unmap

2015-05-21 Thread Fam Zheng
This checks that the discard on mirror source that effectively zeroes data is also reflected by the data of target. Signed-off-by: Fam Zheng f...@redhat.com Reviewed-by: John Snow js...@redhat.com --- tests/qemu-iotests/131 | 59 ++

[Qemu-block] [PATCH v4 3/8] mirror: Do zero write on target if sectors not allocated

2015-05-21 Thread Fam Zheng
If guest discards a source cluster, mirroring with bdrv_aio_readv is overkill. Some protocols do zero upon discard, where it's best to use bdrv_aio_write_zeroes, otherwise, bdrv_aio_discard will be enough. Signed-off-by: Fam Zheng f...@redhat.com --- block/mirror.c | 19 +-- 1