Block patches
Subsystems (2)
The following changes since commit c2a57aae9a1c3dd7de77daf5478df10379aeeebf:
Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging (2016-09-09 12:49:41 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 8f1096787517c66b67cc29bab65edc0188a86326:
tests: fix qvirtqueue_kick (2016-09-12 15:06:29 +0100)
----------------------------------------------------------------
----------------------------------------------------------------
Changlong Xie (6):
virtio-blk: rename virtio_device_info to virtio_blk_info
Backup: export interfaces for extra serialization
configure: support replication
replication: Introduce new APIs to do replication operation
tests: add unit test case for replication
MAINTAINERS: add maintainer for replication
Laurent Vivier (1):
tests: fix qvirtqueue_kick
Roman Pen (3):
linux-aio: consume events in userspace instead of calling io_getevents
linux-aio: split processing events function
linux-aio: process completions from ioq_submit()
Wen Congyang (7):
block: unblock backup operations in backing file
Backup: clear all bitmap when doing block checkpoint
block: Link backup into block core
docs: block replication's description
mirror: auto complete active commit
replication: Implement new driver for block replication support replication driver in blockdev-add
MAINTAINERS | 9 + Makefile.objs | 1 + block.c | 17 ++ block/Makefile.objs | 3 +- block/backup.c | 59 +++- block/linux-aio.c | 184 +++++++++--- block/mirror.c | 13 +- block/replication.c | 659 +++++++++++++++++++++++++++++++++++++++++++ blockdev.c | 2 +- configure | 11 + docs/block-replication.txt | 239 ++++++++++++++++ hw/block/virtio-blk.c | 4 +- include/block/block_backup.h | 39 +++ include/block/block_int.h | 3 +- qapi/block-core.json | 36 ++- qemu-img.c | 2 +- replication.c | 107 +++++++ replication.h | 174 ++++++++++++ tests/.gitignore | 1 + tests/Makefile.include | 4 + tests/libqos/virtio.c | 6 +- tests/test-replication.c | 575 +++++++++++++++++++++++++++++++++++++ 22 files changed, 2086 insertions(+), 62 deletions(-) create mode 100644 block/replication.c create mode 100644 docs/block-replication.txt create mode 100644 include/block/block_backup.h create mode 100644 replication.c create mode 100644 replication.h create mode 100644 tests/test-replication.c
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 01/17] linux-aio: consume events in userspace instead of calling io_getevents
From: Roman Pen <[email protected]>
AIO context in userspace is represented as a simple ring buffer, which can be consumed directly without entering the kernel, which obviously can bring some performance gain. QEMU does not use timeout value for waiting for events completions, so we can consume all events from userspace.
Message-id: [email protected]
--- block/linux-aio.c | 129 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 101 insertions(+), 28 deletions(-)
block/linux-aio.c +101 -28
@@ -59,7 +59,6 @@ struct LinuxAioState {/* I/O completion processing */ QEMUBH *completion_bh; -struct io_event events[MAX_EVENTS ];int event_idx;int event_max; };
@@ -102,6 +101,85 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb) } } +/** +* aio_ring buffer which is shared between userspace and kernel. +* +* This copied from linux/fs/aio.c, common header does not exist +* but AIO exists for ages so we assume ABI is stable. +*/ +struct aio_ring { +unsigned id;/* kernel internal index number */ +unsigned nr;/* number of io_events */ +unsigned head;/* Written to by userland or by kernel. */ +unsigned tail; + +unsigned magic; +unsigned compat_features; +unsigned incompat_features; +unsigned header_length;/* size of aio_ring */ + +struct io_event io_events[0 ]; +}; + +/** +* io_getevents_peek: +* @ctx: AIO context +* @events: pointer on events array, output value + +* Returns the number of completed events and sets a pointer +* on events array. This function does not update the internal +* ring buffer, only reads head and tail. When @events has been +* processed io_getevents_commit() must be called. +*/ +static inline unsigned int io_getevents_peek (io_context_t ctx, +struct io_event **events) +{ +struct aio_ring *ring = (struct aio_ring *)ctx; +unsigned int head = ring->head, tail = ring->tail; +unsigned int nr; + + nr = tail >= head ? tail - head : ring->nr - head; + *events = ring->io_events + head; +/* To avoid speculative loads of s->events[i] before observing tail. +Paired with smp_wmb() inside linux/fs/aio.c: aio_complete(). */ +smp_rmb (); + +return nr; +} + +/** +* io_getevents_commit: +* @ctx: AIO context +* @nr: the number of events on which head should be advanced +* +* Advances head of a ring buffer. +*/ +static inline void io_getevents_commit (io_context_t ctx,unsigned int nr) +{ +struct aio_ring *ring = (struct aio_ring *)ctx; + +if (nr) { + ring->head = (ring->head + nr) % ring->nr; + } +} + +/** +* io_getevents_advance_and_peek: +* @ctx: AIO context +* @events: pointer on events array, output value +* @nr: the number of events on which head should be advanced +* +* Advances head of a ring buffer and returns number of elements left. +*/ +static inline unsigned int +io_getevents_advance_and_peek (io_context_t ctx, +struct io_event **events, +unsigned int nr) +{ +io_getevents_commit (ctx, nr); +return io_getevents_peek (ctx, events); +} +/* The completion BH fetches completed I/O requests and invokes their * callbacks. *
@@ -116,43 +194,38 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)static void qemu_laio_completion_bh (void *opaque) {LinuxAioState *s = opaque; - -/* Fetch more completion events when empty */ -if (s->event_idx == s->event_max) { -do { -struct timespec ts = {0 }; - s->event_max =io_getevents (s->ctx,MAX_EVENTS ,MAX_EVENTS , - s->events, &ts); - }while (s->event_max == -EINTR ); - - s->event_idx =0 ; -if (s->event_max <=0 ) { - s->event_max =0 ; -return ;/* no more events */ - } - s->io_q.in_flight -= s->event_max; - } +struct io_event *events;/* Reschedule so nested event loops see currently pending completions */ qemu_bh_schedule (s->completion_bh); -/* Process completion events */ -while (s->event_idx < s->event_max) { -struct iocb *iocb = s->events[s->event_idx].obj; -struct qemu_laiocb *laiocb = +while ((s->event_max =io_getevents_advance_and_peek (s->ctx, &events, + s->event_idx))) { +for (s->event_idx =0 ; s->event_idx < s->event_max; ) { +struct iocb *iocb = events[s->event_idx].obj; +struct qemu_laiocb *laiocb = container_of(iocb, struct qemu_laiocb, iocb); - laiocb->ret =io_event_ret (&s->events[s->event_idx]); - s->event_idx++; + laiocb->ret =io_event_ret (&events[s->event_idx]); -qemu_laio_process_completion (laiocb); - } - -if (!s->io_q.plugged && !QSIMPLEQ_EMPTY (&s->io_q.pending)) { -ioq_submit (s); +/* Change counters one-by-one because we can be nested. */ + s->io_q.in_flight--; + s->event_idx++; +qemu_laio_process_completion (laiocb); + } }qemu_bh_cancel (s->completion_bh); + +/* If we are nested we have to notify the level above that we are done +* by setting event_max to zero, upper level will then jump out of it's +* own `for` loop. If we are the last all counters droped to zero. */ + s->event_max =0 ; + s->event_idx =0 ; + +if (!s->io_q.plugged && !QSIMPLEQ_EMPTY (&s->io_q.pending)) { +ioq_submit (s); + } }static void qemu_laio_completion_cb (EventNotifier *e)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 02/17] linux-aio: split processing events function
In reply to Stefan HajnocziFrom: Roman Pen <[email protected]>
Prepare processing events function to be called from ioq_submit(), thus split function on two parts: the first harvests completed IO requests, the second submits pending requests.
Message-id: [email protected]
--- block/linux-aio.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-)
block/linux-aio.c +21 -10
@@ -180,20 +180,20 @@ io_getevents_advance_and_peek(io_context_t ctx,return io_getevents_peek (ctx, events); } -/* The completion BH fetches completed I/O requests and invokes their -* callbacks. +/** +* qemu_laio_process_completions: +* @s: AIO state +* +* Fetches completed I/O requests and invokes their callbacks. * * The function is somewhat tricky because it supports nested event loops, for * example when a request callback invokes aio_poll(). In order to do this, -* the completion events array and index are kept in LinuxAioState. The BH -* reschedules itself as long as there are completions pending so it will -* either be called again in a nested event loop or will be called after all -* events have been completed. When there are no events left to complete, the -* BH returns without rescheduling. +* indices are kept in LinuxAioState. Function schedules BH completion so it +* can be called again in a nested event loop. When there are no events left +* to complete the BH is being canceled. */ -static void qemu_laio_completion_bh (void *opaque) +static void qemu_laio_process_completions (LinuxAioState *s) { -LinuxAioState *s = opaque;struct io_event *events;/* Reschedule so nested event loops see currently pending completions */
@@ -222,18 +222,29 @@ static void qemu_laio_completion_bh(void *opaque)* own `for` loop. If we are the last all counters droped to zero. */ s->event_max =0 ; s->event_idx =0 ; +} +static void qemu_laio_process_completions_and_submit (LinuxAioState *s) +{ +qemu_laio_process_completions (s);if (!s->io_q.plugged && !QSIMPLEQ_EMPTY (&s->io_q.pending)) {ioq_submit (s); } } +static void qemu_laio_completion_bh (void *opaque) +{ +LinuxAioState *s = opaque; + +qemu_laio_process_completions_and_submit (s); +} +static void qemu_laio_completion_cb (EventNotifier *e) {LinuxAioState *s =container_of (e, LinuxAioState, e);if (event_notifier_test_and_clear (&s->e)) { -qemu_laio_completion_bh (s); +qemu_laio_process_completions_and_submit (s); } }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 04/17] virtio-blk: rename virtio_device_info to virtio_blk_info
In reply to Stefan HajnocziFrom: Changlong Xie <[email protected]>
The old one is confusing with @virtio_device_info in virtio.c, so make it more appropriate.
Message-id: [email protected]
--- hw/block/virtio-blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/block/virtio-blk.c +2 -2
@@ -992,7 +992,7 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data) vdc->load = virtio_blk_load_device; } -static const TypeInfo virtio_device_info = { +static const TypeInfo virtio_blk_info = { .name =TYPE_VIRTIO_BLK , .parent =TYPE_VIRTIO_DEVICE , .instance_size =sizeof (VirtIOBlock),
@@ -1002,7 +1002,7 @@ static const TypeInfo virtio_device_info = {static void virtio_register_types (void ) { -type_register_static (&virtio_device_info); +type_register_static (&virtio_blk_info); }type_init (virtio_register_types)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 03/17] linux-aio: process completions from ioq_submit()
In reply to Stefan HajnocziFrom: Roman Pen <[email protected]>
In order to reduce completion latency it makes sense to harvest completed requests ASAP. Very fast backend device can complete requests just after submission, so it is worth trying to check ring buffer in order to peek completed requests directly after io_submit() has been called.
Indeed, this patch reduces the completions latencies and increases the overall throughput, e.g. the following is the percentiles of number of completed requests at once:
1th 10th 20th 30th 40th 50th 60th 70th 80th 90th 99.99th Before 2 4 42 112 128 128 128 128 128 128 128 After 1 1 4 14 33 45 47 48 50 51 108
That means, that before the current patch is applied the ring buffer is observed as full (128 requests were consumed at once) in 60% of calls.
After patch is applied the distribution of number of completed requests is "smoother" and the queue (requests in-flight) is almost never full.
The fio read results are the following (write results are almost the same and are not showed here):
Before
------
job: (groupid=0, jobs=8): err= 0: pid=2227: Tue Jul 19 11:29:50 2016
Description : [Emulation of Storage Server Access Pattern] read : io=54681MB, bw=1822.7MB/s, iops=179779, runt= 30001msec
slat (usec): min=172, max=16883, avg=338.35, stdev=109.66
clat (usec): min=1, max=21977, avg=1051.45, stdev=299.29
lat (usec): min=317, max=22521, avg=1389.83, stdev=300.73
clat percentiles (usec):
| 1.00th=[ 346], 5.00th=[ 596], 10.00th=[ 708], 20.00th=[ 852],
| 30.00th=[ 932], 40.00th=[ 996], 50.00th=[ 1048], 60.00th=[ 1112],
| 70.00th=[ 1176], 80.00th=[ 1256], 90.00th=[ 1384], 95.00th=[ 1496],
| 99.00th=[ 1800], 99.50th=[ 1928], 99.90th=[ 2320], 99.95th=[ 2672],
| 99.99th=[ 4704]
bw (KB /s): min=205229, max=553181, per=12.50%, avg=233278.26, stdev=18383.51 After
------
job: (groupid=0, jobs=8): err= 0: pid=2220: Tue Jul 19 11:31:51 2016
Description : [Emulation of Storage Server Access Pattern] read : io=57637MB, bw=1921.2MB/s, iops=189529, runt= 30002msec
slat (usec): min=169, max=20636, avg=329.61, stdev=124.18
clat (usec): min=2, max=19592, avg=988.78, stdev=251.04
lat (usec): min=381, max=21067, avg=1318.42, stdev=243.58
clat percentiles (usec):
| 1.00th=[ 310], 5.00th=[ 580], 10.00th=[ 748], 20.00th=[ 876],
| 30.00th=[ 908], 40.00th=[ 948], 50.00th=[ 1012], 60.00th=[ 1064],
| 70.00th=[ 1080], 80.00th=[ 1128], 90.00th=[ 1224], 95.00th=[ 1288],
| 99.00th=[ 1496], 99.50th=[ 1608], 99.90th=[ 1960], 99.95th=[ 2256],
| 99.99th=[ 5408]
bw (KB /s): min=212149, max=390160, per=12.49%, avg=245746.04, stdev=11606.75Throughput increased from 1822MB/s to 1921MB/s, average completion latencies decreased from 1051us to 988us.
Message-id: [email protected]
--- block/linux-aio.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
block/linux-aio.c +22 -2
@@ -94,7 +94,11 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb) laiocb->ret = ret;if (laiocb->co) { -qemu_coroutine_enter (laiocb->co); +/* Jump and continue completion for foreign requests, don't do +* anything for current request, it will be completed shortly. */ +if (laiocb->co !=qemu_coroutine_self ()) { +qemu_coroutine_enter (laiocb->co); + } }else { laiocb->common.cb (laiocb->common.opaque, ret);qemu_aio_unref (laiocb);
@@ -320,6 +324,19 @@ static void ioq_submit(LinuxAioState *s)QSIMPLEQ_SPLIT_AFTER (&s->io_q.pending, aiocb, next, &completed); }while (ret == len && !QSIMPLEQ_EMPTY (&s->io_q.pending)); s->io_q.blocked = (s->io_q.in_queue >0 ); + +if (s->io_q.in_flight) { +/* We can try to complete something just right away if there are +* still requests in-flight. */ +qemu_laio_process_completions (s); +/* +* Even we have completed everything (in_flight == 0), the queue can +* have still pended requests (in_queue > 0). We do not attempt to +* repeat submission to avoid IO hang. The reason is simple: s->e is +* still set and completion callback will be called shortly and all +* pended requests will be submitted from there. +*/ + } }void laio_io_plug (BlockDriverState *bs,LinuxAioState *s)
@@ -377,6 +394,7 @@ int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd, .co = qemu_coroutine_self(), .nbytes = qiov->size, .ctx = s, + .ret = -EINPROGRESS, .is_read = (type == QEMU_AIO_READ), .qiov = qiov, };
@@ -386,7 +404,9 @@ int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd,return ret; } -qemu_coroutine_yield (); +if (laiocb.ret == -EINPROGRESS ) { +qemu_coroutine_yield (); + }return laiocb.ret; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 05/17] block: unblock backup operations in backing file
In reply to Stefan HajnocziFrom: Wen Congyang <[email protected]>
Kashyap Chamarthy <[email protected]>
Message-id: [email protected]
--- block.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
block.c +17 -0
@@ -1312,6 +1312,23 @@ void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd)/* Otherwise we won't be able to commit due to check in bdrv_commit */ bdrv_op_unblock (backing_hd,BLOCK_OP_TYPE_COMMIT_TARGET , bs->backing_blocker); +/* +* We do backup in 3 ways: +* 1. drive backup +* The target bs is new opened, and the source is top BDS +* 2. blockdev backup +* Both the source and the target are top BDSes. +* 3. internal backup(used for block replication) +* Both the source and the target are backing file +* +* In case 1 and 2, neither the source nor the target is the backing file. +* In case 3, we will block the top BDS, so there is only one block job +* for the top BDS and its backing chain. +*/ +bdrv_op_unblock (backing_hd,BLOCK_OP_TYPE_BACKUP_SOURCE , + bs->backing_blocker); +bdrv_op_unblock (backing_hd,BLOCK_OP_TYPE_BACKUP_TARGET , + bs->backing_blocker); out:bdrv_refresh_limits (bs,NULL ); }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 06/17] Backup: clear all bitmap when doing block checkpoint
In reply to Stefan HajnocziFrom: Wen Congyang <[email protected]>
Message-id: [email protected]
--- block/backup.c | 18 ++++++++++++++++++ include/block/block_backup.h | 25 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 include/block/block_backup.h
block/backup.c +18 -0
@@ -17,6 +17,7 @@#include "block/block.h" #include "block/block_int.h" #include "block/blockjob.h" +#include "block/block_backup.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h"
@@ -255,6 +256,23 @@ static void backup_attached_aio_context(BlockJob *job, AioContext *aio_context)blk_set_aio_context (s->target, aio_context); } +void backup_do_checkpoint (BlockJob *job,Error **errp) +{ +BackupBlockJob *backup_job =container_of (job, BackupBlockJob, common); +int64_t len; + +assert (job->driver->job_type ==BLOCK_JOB_TYPE_BACKUP ); + +if (backup_job->sync_mode !=MIRROR_SYNC_MODE_NONE ) { +error_setg (errp,"The backup job only supports block checkpoint in" +" sync=none mode" ); +return ; + } + + len =DIV_ROUND_UP (backup_job->common.len, backup_job->cluster_size); +bitmap_zero (backup_job->done_bitmap, len); +} +static const BlockJobDriver backup_job_driver = { .instance_size =sizeof (BackupBlockJob), .job_type =BLOCK_JOB_TYPE_BACKUP ,
include/block/block_backup.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* QEMU backup +* +* Copyright (c) 2013 Proxmox Server Solutions +* Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD. +* Copyright (c) 2016 Intel Corporation +* Copyright (c) 2016 FUJITSU LIMITED +* +* Authors: +* Dietmar Maurer <[email protected]> +* Changlong Xie <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +* +*/ + +#ifndef BLOCK_BACKUP_H +#define BLOCK_BACKUP_H + +#include "block/block_int.h" + +void backup_do_checkpoint (BlockJob *job,Error **errp); + +#endif
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 07/17] Backup: export interfaces for extra serialization
In reply to Stefan HajnocziFrom: Changlong Xie <[email protected]>
Normal backup(sync='none') workflow:
step 1. NBD peformance I/O write from client to server
qcow2_co_writev
bdrv_co_writev
...
bdrv_aligned_pwritev
notifier_with_return_list_notify -> backup_do_cow
bdrv_driver_pwritev // write new contentsstep 2. drive-backup sync=none
backup_do_cow
{
wait_for_overlapping_requests
cow_request_begin
for(; start < end; start++) {
bdrv_co_readv_no_serialising //read old contents from Secondary disk bdrv_co_writev // write old contents to hidden-disk
}
cow_request_end
}
step 3. Then roll back to "step 1" to write new contents to Secondary disk.
And for replication, we must make sure that we only read the old contents from Secondary disk in order to keep contents consistent.
1) Replication workflow of Secondary
virtio-blk
^
-------> 1 NBD |
|| server 3 replication
|| ^ ^
|| | backing backing |
|| Secondary disk 6<-------- hidden-disk 5 <-------- active-disk 4
|| | ^
|| '-------------------------'
|| drive-backup sync=none 2Hence, we need these interfaces to implement coarse-grained serialization between COW of Secondary disk and the read operation of replication.
Example codes about how to use them:
*#include "block/block_backup.h"
static coroutine_fn int xxx_co_readv()
{
CowRequest req;
BlockJob *job = secondary_disk->bs->job;
if (job) {
backup_wait_for_overlapping_requests(job, start, end);
backup_cow_request_begin(&req, job, start, end);
ret = bdrv_co_readv();
backup_cow_request_end(&req);
goto out;
}
ret = bdrv_co_readv();
out:
return ret;
}Message-id: [email protected]
--- block/backup.c | 41 ++++++++++++++++++++++++++++++++++------- include/block/block_backup.h | 14 ++++++++++++++ 2 files changed, 48 insertions(+), 7 deletions(-)
block/backup.c +34 -7
@@ -28,13 +28,6 @@#define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16)#define SLICE_TIME 100000000ULL/* ns */ -typedef struct CowRequest { -int64_t start; -int64_t end; -QLIST_ENTRY (CowRequest) list; -CoQueue wait_queue;/* coroutines blocked on this request */ -}CowRequest ; - typedef struct BackupBlockJob { BlockJob common; BlockBackend *target;
@@ -273,6 +266,40 @@ void backup_do_checkpoint(BlockJob *job, Error **errp)bitmap_zero (backup_job->done_bitmap, len); } +void backup_wait_for_overlapping_requests (BlockJob *job,int64_t sector_num, +int nb_sectors) +{ +BackupBlockJob *backup_job =container_of (job, BackupBlockJob, common); +int64_t sectors_per_cluster =cluster_size_sectors (backup_job); +int64_t start, end; + +assert (job->driver->job_type ==BLOCK_JOB_TYPE_BACKUP ); + + start = sector_num / sectors_per_cluster; + end =DIV_ROUND_UP (sector_num + nb_sectors, sectors_per_cluster); +wait_for_overlapping_requests (backup_job, start, end); +} + +void backup_cow_request_begin (CowRequest *req,BlockJob *job, +int64_t sector_num, +int nb_sectors) +{ +BackupBlockJob *backup_job =container_of (job, BackupBlockJob, common); +int64_t sectors_per_cluster =cluster_size_sectors (backup_job); +int64_t start, end; + +assert (job->driver->job_type ==BLOCK_JOB_TYPE_BACKUP ); + + start = sector_num / sectors_per_cluster; + end =DIV_ROUND_UP (sector_num + nb_sectors, sectors_per_cluster); +cow_request_begin (req, backup_job, start, end); +} + +void backup_cow_request_end (CowRequest *req) +{ +cow_request_end (req); +} +static const BlockJobDriver backup_job_driver = { .instance_size =sizeof (BackupBlockJob), .job_type =BLOCK_JOB_TYPE_BACKUP ,
include/block/block_backup.h +14 -0
@@ -20,6 +20,20 @@#include "block/block_int.h" +typedef struct CowRequest { +int64_t start; +int64_t end; +QLIST_ENTRY (CowRequest) list; +CoQueue wait_queue;/* coroutines blocked on this request */ +}CowRequest ; + +void backup_wait_for_overlapping_requests (BlockJob *job,int64_t sector_num, +int nb_sectors); +void backup_cow_request_begin (CowRequest *req,BlockJob *job, +int64_t sector_num, +int nb_sectors); +void backup_cow_request_end (CowRequest *req); +void backup_do_checkpoint (BlockJob *job,Error **errp);#endif
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 09/17] docs: block replication's description
In reply to Stefan HajnocziFrom: Wen Congyang <[email protected]>
Message-id: [email protected]
--- docs/block-replication.txt | 239 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 docs/block-replication.txt
docs/block-replication.txt new file +239 -0
@@ -0,0 +1,239 @@ +Block replication +---------------------------------------- +Copyright Fujitsu, Corp. 2016 +Copyright (c) 2016 Intel Corporation +Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD. + +This work is licensed under the terms of the GNU GPL, version 2 or later. +See the COPYING file in the top-level directory. + +Block replication is used for continuous checkpoints. It is designed +for COLO (COarse-grain LOck-stepping) where the Secondary VM is running. +It can also be applied for FT/HA (Fault-tolerance/High Assurance) scenario, +where the Secondary VM is not running. + +This document gives an overview of block replication's design. + +== Background == +High availability solutions such as micro checkpoint and COLO will do +consecutive checkpoints. The VM state of the Primary and Secondary VM is +identical right after a VM checkpoint, but becomes different as the VM +executes till the next checkpoint. To support disk contents checkpoint, +the modified disk contents in the Secondary VM must be buffered, and are +only dropped at next checkpoint time. To reduce the network transportation +effort during a vmstate checkpoint, the disk modification operations of +the Primary disk are asynchronously forwarded to the Secondary node. + +== Workflow == +The following is the image of block replication workflow: + + +----------------------+ +------------------------+ + |Primary Write Requests| |Secondary Write Requests| + +----------------------+ +------------------------+ + | | + | (4) + | V + | /-------------\ + | Copy and Forward | | + |---------(1)----------+ | Disk Buffer | + | | | | + | (3) \-------------/ + | speculative ^ + | write through (2) + | | | + V V | + +--------------+ +----------------+ + | Primary Disk | | Secondary Disk | + +--------------+ +----------------+ + + 1) Primary write requests will be copied and forwarded to Secondary + QEMU. + 2) Before Primary write requests are written to Secondary disk, the + original sector content will be read from Secondary disk and + buffered in the Disk buffer, but it will not overwrite the existing + sector content (it could be from either "Secondary Write Requests" or + previous COW of "Primary Write Requests") in the Disk buffer. + 3) Primary write requests will be written to Secondary disk. + 4) Secondary write requests will be buffered in the Disk buffer and it + will overwrite the existing sector content in the buffer. + +== Architecture == +We are going to implement block replication from many basic +blocks that are already in QEMU. + + virtio-blk || + ^ || .---------- + | || | Secondary + 1 Quorum || '---------- + / \ || + / \ || + Primary 2 filter + disk ^ virtio-blk + | ^ + 3 NBD -------> 3 NBD | + client || server 2 filter + || ^ ^ +--------. || | | +Primary | || Secondary disk <--------- hidden-disk 5 <--------- active-disk 4 +--------' || | backing ^ backing + || | | + || | | + || '-------------------------' + || drive-backup sync=none 6 + +1) The disk on the primary is represented by a block device with two +children, providing replication between a primary disk and the host that +runs the secondary VM. The read pattern (fifo) for quorum can be extended +to make the primary always read from the local disk instead of going through +NBD. + +2) The new block filter (the name is replication) will control the block +replication. + +3) The secondary disk receives writes from the primary VM through QEMU's +embedded NBD server (speculative write-through). + +4) The disk on the secondary is represented by a custom block device +(called active-disk). It should start as an empty disk, and the format +should support bdrv_make_empty() and backing file. + +5) The hidden-disk is created automatically. It buffers the original content +that is modified by the primary VM. It should also start as an empty disk, +and the driver supports bdrv_make_empty() and backing file. + +6) The drive-backup job (sync=none) is run to allow hidden-disk to buffer +any state that would otherwise be lost by the speculative write-through +of the NBD server into the secondary disk. So before block replication, +the primary disk and secondary disk should contain the same data. + +== Failure Handling == +There are 7 internal errors when block replication is running: +1. I/O error on primary disk +2. Forwarding primary write requests failed +3. Backup failed +4. I/O error on secondary disk +5. I/O error on active disk +6. Making active disk or hidden disk empty failed +7. Doing failover failed +In case 1 and 5, we just report the error to the disk layer. In case 2, 3, +4 and 6, we just report block replication's error to FT/HA manager (which +decides when to do a new checkpoint, when to do failover). +In case 7, if active commit failed, we use replication failover failed state +in Secondary's write operation (what decides which target to write). + +== New block driver interface == +We add four block driver interfaces to control block replication: +a. replication_start_all() + Start block replication, called in migration/checkpoint thread. + We must call block_replication_start_all() in secondary QEMU before + calling block_replication_start_all() in primary QEMU. The caller + must hold the I/O mutex lock if it is in migration/checkpoint + thread. +b. replication_do_checkpoint_all() + This interface is called after all VM state is transferred to + Secondary QEMU. The Disk buffer will be dropped in this interface. + The caller must hold the I/O mutex lock if it is in migration/checkpoint + thread. +c. replication_get_error_all() + This interface is called to check if error happened in replication. + The caller must hold the I/O mutex lock if it is in migration/checkpoint + thread. +d. replication_stop_all() + It is called on failover. We will flush the Disk buffer into + Secondary Disk and stop block replication. The vm should be stopped + before calling it if you use this API to shutdown the guest, or other + things except failover. The caller must hold the I/O mutex lock if it is + in migration/checkpoint thread. + +== Usage == +Primary: + -drive if=xxx,driver=quorum,read-pattern=fifo,id=colo1,vote-threshold=1,\ + children.0.file.filename=1.raw,\ + children.0.driver=raw + + Run qmp command in primary qemu: + { 'execute': 'human-monitor-command', + 'arguments': { + 'command-line': 'drive_add -n buddy driver=replication,mode=primary,file.driver=nbd,file.host=xxxx,file.port=xxxx,file.export=colo1,node-name=nbd_client1' + } + } + { 'execute': 'x-blockdev-change', + 'arguments': { + 'parent': 'colo1', + 'node': 'nbd_client1' + } + } + Note: + 1. There should be only one NBD Client for each primary disk. + 2. host is the secondary physical machine's hostname or IP + 3. Each disk must have its own export name. + 4. It is all a single argument to -drive and you should ignore the + leading whitespace. + 5. The qmp command line must be run after running qmp command line in + secondary qemu. + 6. After failover we need remove children.1 (replication driver). + +Secondary: + -drive if=none,driver=raw,file.filename=1.raw,id=colo1 \ + -drive if=xxx,id=topxxx,driver=replication,mode=secondary,top-id=topxxx\ + file.file.filename=active_disk.qcow2,\ + file.driver=qcow2,\ + file.backing.file.filename=hidden_disk.qcow2,\ + file.backing.driver=qcow2,\ + file.backing.backing=colo1 + + Then run qmp command in secondary qemu: + { 'execute': 'nbd-server-start', + 'arguments': { + 'addr': { + 'type': 'inet', + 'data': { + 'host': 'xxx', + 'port': 'xxx' + } + } + } + } + { 'execute': 'nbd-server-add', + 'arguments': { + 'device': 'colo1', + 'writable': true + } + } + + Note: + 1. The export name in secondary QEMU command line is the secondary + disk's id. + 2. The export name for the same disk must be the same + 3. The qmp command nbd-server-start and nbd-server-add must be run + before running the qmp command migrate on primary QEMU + 4. Active disk, hidden disk and nbd target's length should be the + same. + 5. It is better to put active disk and hidden disk in ramdisk. + 6. It is all a single argument to -drive, and you should ignore + the leading whitespace. + +After Failover: +Primary: + The secondary host is down, so we should run the following qmp command + to remove the nbd child from the quorum: + { 'execute': 'x-blockdev-change', + 'arguments': { + 'parent': 'colo1', + 'child': 'children.1' + } + } + { 'execute': 'human-monitor-command', + 'arguments': { + 'command-line': 'drive_del xxxx' + } + } + Note: there is no qmp command to remove the blockdev now + +Secondary: + The primary host is down, so we should do the following thing: + { 'execute': 'nbd-server-stop' } + +TODO: +1. Continuous block replication +2. Shared disk
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 08/17] block: Link backup into block core
In reply to Stefan HajnocziFrom: Wen Congyang <[email protected]>
Some programs that add a dependency on it will use the block layer directly.
Message-id: [email protected]
--- block/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/Makefile.objs +1 -1
@@ -22,11 +22,11 @@ block-obj-$(CONFIG_ARCHIPELAGO) += archipelago.o block-obj-$(CONFIG_LIBSSH2) += ssh.o block-obj-y += accounting.o dirty-bitmap.o block-obj-y += write-threshold.o +block-obj-y += backup.o block-obj-y += crypto.o common-obj-y += stream.o -common-obj-y += backup.o iscsi.o-cflags := $(LIBISCSI_CFLAGS) iscsi.o-libs := $(LIBISCSI_LIBS)
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 10/17] mirror: auto complete active commit
In reply to Stefan HajnocziFrom: Wen Congyang <[email protected]>
Auto complete mirror job in background to prevent from blocking synchronously
Message-id: [email protected]
--- block/mirror.c | 13 +++++++++---- blockdev.c | 2 +- include/block/block_int.h | 3 ++- qemu-img.c | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-)
block/mirror.c +9 -4
@@ -916,7 +916,8 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs, BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, - bool is_none_mode, BlockDriverState *base) + bool is_none_mode, BlockDriverState *base, + bool auto_complete) { MirrorBlockJob *s;
@@ -952,6 +953,9 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs, s->granularity = granularity; s->buf_size =ROUND_UP (buf_size, granularity); s->unmap = unmap; +if (auto_complete) { + s->should_complete = true; + } s->dirty_bitmap =bdrv_create_dirty_bitmap (bs, granularity,NULL , errp);if (!s->dirty_bitmap) {
@@ -990,14 +994,15 @@ void mirror_start(const char *job_id, BlockDriverState *bs,mirror_start_job (job_id, bs, target, replaces, speed, granularity, buf_size, backing_mode, on_source_error, on_target_error, unmap, cb, opaque, errp, - &mirror_job_driver, is_none_mode, base); + &mirror_job_driver, is_none_mode, base, false); }void commit_active_start (const char *job_id,BlockDriverState *bs,BlockDriverState *base,int64_t speed,BlockdevOnError on_error,BlockCompletionFunc *cb, -void *opaque,Error **errp) +void *opaque,Error **errp, +bool auto_complete) {int64_t length, base_length;int orig_base_flags;
@@ -1038,7 +1043,7 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,mirror_start_job (job_id, bs, base,NULL , speed,0 ,0 ,MIRROR_LEAVE_BACKING_CHAIN , on_error, on_error, false, cb, opaque, &local_err, - &commit_active_job_driver, false, base); + &commit_active_job_driver, false, base, auto_complete);if (local_err) {error_propagate (errp, local_err); goto error_restore_flags;
blockdev.c +1 -1
@@ -3090,7 +3090,7 @@ void qmp_block_commit(bool has_job_id, const char *job_id, const char *device, goto out; }commit_active_start (has_job_id ? job_id :NULL , bs, base_bs, speed, - on_error, block_job_cb, bs, &local_err); + on_error, block_job_cb, bs, &local_err, false); }else { commit_start(has_job_id ? job_id : NULL, bs, base_bs, top_bs, speed, on_error, block_job_cb, bs,
include/block/block_int.h +2 -1
@@ -702,13 +702,14 @@ void commit_start(const char *job_id, BlockDriverState *bs,* @cb: Completion function for the job. * @opaque: Opaque pointer value passed to @cb. * @errp: Error object. +* @auto_complete: Auto complete the job. * */ void commit_active_start (const char *job_id,BlockDriverState *bs,BlockDriverState *base,int64_t speed,BlockdevOnError on_error,BlockCompletionFunc *cb, -void *opaque,Error **errp); +void *opaque,Error **errp,bool auto_complete);/* * mirror_start: * @job_id: The id of the newly-created job, or %NULL to use the
qemu-img.c +1 -1
@@ -921,7 +921,7 @@ static int img_commit(int argc, char **argv) };commit_active_start ("commit" , bs, base_bs,0 ,BLOCKDEV_ON_ERROR_REPORT , - common_block_job_cb, &cbi, &local_err); + common_block_job_cb, &cbi, &local_err, false);if (local_err) { goto done; }
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 11/17] configure: support replication
In reply to Stefan HajnocziFrom: Changlong Xie <[email protected]>
configure --(enable/disable)-replication to switch replication support on/off, and it is on by default.
We later introduce replation support.
Message-id: [email protected]
--- configure | 11 +++++++++++ 1 file changed, 11 insertions(+)
configure +11 -0
@@ -320,6 +320,7 @@ vhdx="" numa="" tcmalloc="no" jemalloc="no" +replication="yes" # parse CC options first for opt do
@@ -1150,6 +1151,10 @@ for opt do ;; --enable-jemalloc) jemalloc="yes" ;; + --disable-replication) replication="no" + ;; + --enable-replication) replication="yes" + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information"
@@ -1380,6 +1385,7 @@ disabled with --disable-FEATURE, default is enabled if available: numa libnuma support tcmalloc tcmalloc support jemalloc jemalloc support + replication replication support NOTE: The object files are built at the place where configure is launched EOF
@@ -4920,6 +4926,7 @@ echo "NUMA host support $numa" echo "tcmalloc support $tcmalloc" echo "jemalloc support $jemalloc" echo "avx2 optimization $avx2_opt" +echo "replication support $replication" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support"
@@ -5497,6 +5504,10 @@ if test "$have_rtnetlink" = "yes" ; then echo "CONFIG_RTNETLINK=y" >> $config_host_mak fi +if test "$replication" = "yes" ; then + echo "CONFIG_REPLICATION=y" >> $config_host_mak +fi + # Hold two types of flag: # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on # a thread we have a handle to
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 12/17] replication: Introduce new APIs to do replication operation
In reply to Stefan HajnocziFrom: Changlong Xie <[email protected]>
This commit introduces six replication interfaces(for block, network etc). Firstly we can use replication_(new/remove) to create/destroy replication instances, then in migration we can use replication_(start/stop/do_checkpoint /get_error)_all to handle all replication operations. More detail please refer to replication.h
Message-id: [email protected]
--- Makefile.objs | 1 + qapi/block-core.json | 13 ++++ replication.c | 107 +++++++++++++++++++++++++++++++ replication.h | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 295 insertions(+) create mode 100644 replication.c create mode 100644 replication.h
Makefile.objs +1 -0
@@ -15,6 +15,7 @@ block-obj-$(CONFIG_POSIX) += aio-posix.o block-obj-$(CONFIG_WIN32) += aio-win32.o block-obj-y += block/ block-obj-y += qemu-io-cmds.o +block-obj-$(CONFIG_REPLICATION) += replication.o block-obj-m = block/
qapi/block-core.json +13 -0
@@ -2163,6 +2163,19 @@ '*debug-level': 'int' } } ## +# @ReplicationMode +# +# An enumeration of replication modes. +# +# @primary: Primary mode, the vm's state will be sent to secondary QEMU. +# +# @secondary: Secondary mode, receive the vm's state from primary QEMU. +# +# Since: 2.8 +## +{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] } + +## # @BlockdevOptions # # Options for creating a block device. Many options are available for all
replication.c new file +107 -0
107 lines not on this page · raw message
replication.h new file +174 -0
174 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 13/17] replication: Implement new driver for block replication
In reply to Stefan HajnocziFrom: Wen Congyang <[email protected]>
Message-id: [email protected]
--- block/Makefile.objs | 1 + block/replication.c | 659 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 660 insertions(+) create mode 100644 block/replication.c
block/Makefile.objs +1 -0
@@ -23,6 +23,7 @@ block-obj-$(CONFIG_LIBSSH2) += ssh.o block-obj-y += accounting.o dirty-bitmap.o block-obj-y += write-threshold.o block-obj-y += backup.o +block-obj-$(CONFIG_REPLICATION) += replication.o block-obj-y += crypto.o
block/replication.c new file +659 -0
659 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 14/17] tests: add unit test case for replication
In reply to Stefan HajnocziFrom: Changlong Xie <[email protected]>
Message-id: [email protected]
--- tests/.gitignore | 1 + tests/Makefile.include | 4 + tests/test-replication.c | 575 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 580 insertions(+) create mode 100644 tests/test-replication.c
tests/.gitignore +1 -0
@@ -63,6 +63,7 @@ test-qmp-introspect.[ch] test-qmp-marshal.c test-qmp-output-visitor test-rcu-list +test-replication test-rfifolock test-string-input-visitor test-string-output-visitor
tests/Makefile.include +4 -0
@@ -112,6 +112,7 @@ check-unit-y += tests/test-crypto-xts$(EXESUF) check-unit-y += tests/test-crypto-block$(EXESUF) gcov-files-test-logging-y = tests/test-logging.c check-unit-y += tests/test-logging$(EXESUF) +check-unit-$(CONFIG_REPLICATION) += tests/test-replication$(EXESUF) check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
@@ -502,6 +503,9 @@ tests/test-base64$(EXESUF): tests/test-base64.o \ tests/test-logging$(EXESUF): tests/test-logging.o $(test-util-obj-y) +tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \ + $(test-block-obj-y) + tests/test-qapi-types.c tests/test-qapi-types.h :\ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-types.py \
tests/test-replication.c new file +575 -0
575 lines not on this page · raw message
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 15/17] support replication driver in blockdev-add
In reply to Stefan HajnocziFrom: Wen Congyang <[email protected]>
Message-id: [email protected]
--- qapi/block-core.json | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
qapi/block-core.json +21 -2
@@ -252,6 +252,7 @@ # 2.3: 'host_floppy' deprecated # 2.5: 'host_floppy' dropped # 2.6: 'luks' added +# 2.8: 'replication' added # # @backing_file: #optional the name of the backing file (for copy-on-write) #
@@ -1712,8 +1713,8 @@ 'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop', 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'luks', 'null-aio', 'null-co', - 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', - 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } + 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', + 'replication', 'tftp', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } ## # @BlockdevOptionsFile
@@ -2176,6 +2177,23 @@ { 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] } ## +# @BlockdevOptionsReplication +# +# Driver specific block device options for replication +# +# @mode: the replication mode +# +# @top-id: #optional In secondary mode, node name or device ID of the root +# node who owns the replication node chain. Ignored in primary mode. +# +# Since: 2.8 +## +{ 'struct': 'BlockdevOptionsReplication', + 'base': 'BlockdevOptionsGenericFormat', + 'data': { 'mode': 'ReplicationMode', + '*top-id': 'str' } } + +## # @BlockdevOptions # # Options for creating a block device. Many options are available for all
@@ -2240,6 +2258,7 @@ 'quorum': 'BlockdevOptionsQuorum', 'raw': 'BlockdevOptionsGenericFormat', # TODO rbd: Wait for structured options + 'replication':'BlockdevOptionsReplication', # TODO sheepdog: Wait for structured options # TODO ssh: Should take InetSocketAddress for 'host'? 'tftp': 'BlockdevOptionsFile',
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PULL 15/17] support replication driver in blockdev-add
Quoted 17 lines · Stefan Hajnoczi
From: Wen Congyang <[email protected]>
Signed-off-by Wen Congyang <[email protected]>Signed-off-by Changlong Xie <[email protected]>Signed-off-by Wang WeiWei <[email protected]>Signed-off-by zhanghailiang <[email protected]>Signed-off-by Gonglei <[email protected]>Reviewed-by Eric Blake <[email protected]>Message-id: [email protected]
Signed-off-by Stefan Hajnoczi <[email protected]>--- qapi/block-core.json | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)+++
b/qapi/block-core.json
qapi/block-core.json line 255
Quoted 4 lines
qapi/block-core.json +1
-0@@ -252,6 +252,7 @@ # 2.3: 'host_floppy' deprecated # 2.5: 'host_floppy' dropped # 2.6: 'luks' added +# 2.8: 'replication' added
You added documentation here...
qapi/block-core.json
Quoted 4 lines
qapi/block-core.json +0
-0# # @backing_file: #optional the name of the backing file (for copy-on-write) #@@ -1712,8 +1713,8 @@
...but not for the BlockdevDriver enum.
qapi/block-core.json line 1717
Quoted 7 lines
qapi/block-core.json +2
-2'data': [ 'archipelago', 'blkdebug', 'blkverify', 'bochs', 'cloop', 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'luks', 'null-aio', 'null-co', - 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'tftp', - 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } + 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', + 'replication', 'tftp', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] }
Also, I failed to notice that you added TAB damage here. Other patches are currently proposed to touch the same area (nfs, ssh, nbd), so hopefully one of them will correct it in the process.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
[Qemu-devel] [PULL 16/17] MAINTAINERS: add maintainer for replication
In reply to Stefan HajnocziFrom: Changlong Xie <[email protected]>
As per Stefan's suggestion, add Wen and I as co-maintainers of replication.
Message-id: [email protected]
--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -1624,6 +1624,15 @@ L: [email protected] S: Supported F: tests/image-fuzzer/ +Replication +M: Wen Congyang <[email protected]> +M: Changlong Xie <[email protected]> +S: Supported +F: replication* +F: block/replication.c +F: tests/test-replication.c +F: docs/block-replication.txt + Build and test automation ------------------------- M: Alex Bennée <[email protected]>
Signature · 1 line
2.7.4
[Qemu-devel] [PULL 17/17] tests: fix qvirtqueue_kick
In reply to Stefan HajnocziFrom: Laurent Vivier <[email protected]>
vq->avail.idx and vq->avail->ring[] are a 16bit values, so read and write them with readw()/writew() instead of readl()/writel().
To read/write a 16bit value with a 32bit accessor works fine on little-endian CPU but not on big endian CPU.
[An equivalent patch for the writew() calls was also sent by Zhang Shuai <[email protected]>.
--Stefan]
Message-id: [email protected]
--- tests/libqos/virtio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/libqos/virtio.c +3 -3
@@ -257,16 +257,16 @@ void qvirtqueue_kick(const QVirtioBus *bus, QVirtioDevice *d, QVirtQueue *vq, uint32_t free_head) {/* vq->avail->idx */ -uint16_t idx =readl (vq->avail +2 ); +uint16_t idx =readw (vq->avail +2 );/* vq->used->flags */ uint16_t flags;/* vq->used->avail_event */ uint16_t avail_event;/* vq->avail->ring[idx % vq->size] */ -writel (vq->avail +4 + (2 * (idx % vq->size)), free_head); +writew (vq->avail +4 + (2 * (idx % vq->size)), free_head);/* vq->avail->idx */ -writel (vq->avail +2 , idx +1 ); +writew (vq->avail +2 , idx +1 );/* Must read after idx is updated */ flags =readw (vq->avail);
Signature · 1 line
2.7.4
Quoted 11 lines · Stefan Hajnoczi
The following changes since commit
c2a57aae9a1c3dd7de77daf5478df10379aeeebf:Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging (2016-09-09 12:49:41 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/block-pull-requestfor you to fetch changes up to
8f1096787517c66b67cc29bab65edc0188a86326:tests: fix
qvirtqueue_kick(2016-09-12 15:06:29 +0100)
/replication/primary/get_error: OK
/replication/secondary/get_error: OK
Please can you rename these tests? They create false positives in scripts that look in the build logs for errors by grepping for "error:" or "warning:".
thanks
-- PMM
Quoted 14 lines · Peter Maydell
Quoted 11 lines · Stefan Hajnoczi
The following changes since commit
c2a57aae9a1c3dd7de77daf5478df10379aeeebf:Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging (2016-09-09 12:49:41 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/block-pull-requestfor you to fetch changes up to
8f1096787517c66b67cc29bab65edc0188a86326:tests: fix
qvirtqueue_kick(2016-09-12 15:06:29 +0100)
Quoted 6 lines
/replication/primary/get_error: OK
/replication/secondary/get_error: OKPlease can you rename these tests? They create false positives in scripts that look in the build logs for errors by grepping for "error:" or "warning:".
Also, two new sanitizer errors:
/home/petmay01/linaro/qemu-for-merges/block/qcow2.c:1807:41: runtime
error: null pointer passed as argument 2, which is declared to never be null /home/petmay01/linaro/qemu-for-merges/block/qcow2-cluster.c:86:26:
runtime error: null pointer passed as argument 2, which is declared to never be null
both attempts to memcpy() from a NULL source pointer while running the tests/test-replication test.
thanks
-- PMM
Quoted 31 lines · Peter Maydell
Quoted 14 lines · Peter Maydell
Quoted 11 lines · Stefan Hajnoczi
The following changes since commit
c2a57aae9a1c3dd7de77daf5478df10379aeeebf:Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging (2016-09-09 12:49:41 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/block-pull-requestfor you to fetch changes up to
8f1096787517c66b67cc29bab65edc0188a86326:tests: fix
qvirtqueue_kick(2016-09-12 15:06:29 +0100)Quoted 6 lines
/replication/primary/get_error: OK
/replication/secondary/get_error: OKPlease can you rename these tests? They create false positives in scripts that look in the build logs for errors by grepping for "error:" or "warning:".
Also, two new sanitizer errors:
/home/petmay01/linaro/qemu-for-merges/block/qcow2.c:1807:41: runtime
error: null pointer passed as argument 2, which is declared to never be null/home/petmay01/linaro/qemu-for-merges/block/qcow2-cluster.c:86:26:
runtime error: null pointer passed as argument 2, which is declared to never be null
Quoted 3 lines
both attempts to
memcpy()from a NULL source pointer while running the tests/test-replication test.
Stefan, if you are going to do another PULL, do you mind including
https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg01717.html
as well? :)
Fam
Quoted 36 lines · Fam Zheng
Quoted 31 lines · Peter Maydell
Quoted 14 lines · Peter Maydell
Quoted 11 lines · Stefan Hajnoczi
The following changes since commit
c2a57aae9a1c3dd7de77daf5478df10379aeeebf:Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging (2016-09-09 12:49:41 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/block-pull-requestfor you to fetch changes up to
8f1096787517c66b67cc29bab65edc0188a86326:tests: fix
qvirtqueue_kick(2016-09-12 15:06:29 +0100)Quoted 6 lines
/replication/primary/get_error: OK
/replication/secondary/get_error: OKPlease can you rename these tests? They create false positives in scripts that look in the build logs for errors by grepping for "error:" or "warning:".
Also, two new sanitizer errors:
/home/petmay01/linaro/qemu-for-merges/block/qcow2.c:1807:41: runtime
error: null pointer passed as argument 2, which is declared to never be null/home/petmay01/linaro/qemu-for-merges/block/qcow2-cluster.c:86:26:
runtime error: null pointer passed as argument 2, which is declared to never be nullQuoted 3 lines
both attempts to
memcpy()from a NULL source pointer while running the tests/test-replication test.
Quoted 5 lines
Stefan, if you are going to do another PULL, do you mind including
https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg01717.html
as well? :)
Sure, I'll resend today.
Stefan
Quoted 31 lines · Peter Maydell
Quoted 14 lines · Peter Maydell
Quoted 11 lines · Stefan Hajnoczi
The following changes since commit
c2a57aae9a1c3dd7de77daf5478df10379aeeebf:Merge remote-tracking branch 'remotes/famz/tags/docker-pull-request' into staging (2016-09-09 12:49:41 +0100)
are available in the git repository at:
git://github.com/stefanha/qemu.gittags/block-pull-requestfor you to fetch changes up to
8f1096787517c66b67cc29bab65edc0188a86326:tests: fix
qvirtqueue_kick(2016-09-12 15:06:29 +0100)Quoted 6 lines
/replication/primary/get_error: OK
/replication/secondary/get_error: OKPlease can you rename these tests? They create false positives in scripts that look in the build logs for errors by grepping for "error:" or "warning:".
Also, two new sanitizer errors:
/home/petmay01/linaro/qemu-for-merges/block/qcow2.c:1807:41: runtime
error: null pointer passed as argument 2, which is declared to never be null/home/petmay01/linaro/qemu-for-merges/block/qcow2-cluster.c:86:26:
runtime error: null pointer passed as argument 2, which is declared to never be null
Quoted 2 lines
both attempts to
memcpy()from a NULL source pointer while running the tests/test-replication test.
These sanitizer errors cannot be introduced by this pull request because no patches touched block/qcow2.c or block/qcow2-cluster.c. Strange.
I will add a patch to fix them anyway.
Stefan