1 | The following changes since commit f90ea7ba7c5ae7010ee0ce062207ae42530f57d6: | 1 | The following changes since commit 346ed3151f1c43e72c40cb55b392a1d4cface62c: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171012' into staging (2017-10-12 17:06:50 +0100) | 3 | Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20200206.0' into staging (2020-02-07 11:52:15 +0000) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://github.com/stefanha/qemu.git tags/block-pull-request | 7 | https://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to b867eaa17b3940760f51134e409cb0580dd3dde3: | 9 | for you to fetch changes up to 11a18c84db4a71497d3d40769688a01b6f64b2ad: |
10 | 10 | ||
11 | block/throttle.c: add bdrv_co_drain_begin/end callbacks (2017-10-13 12:38:41 +0100) | 11 | hw/core: Allow setting 'virtio-blk-device.scsi' property on OSX host (2020-02-07 16:49:39 +0000) |
12 | |||
13 | ---------------------------------------------------------------- | ||
14 | Pull request | ||
12 | 15 | ||
13 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
14 | 17 | ||
15 | ---------------------------------------------------------------- | 18 | Philippe Mathieu-Daudé (1): |
19 | hw/core: Allow setting 'virtio-blk-device.scsi' property on OSX host | ||
16 | 20 | ||
17 | Manos Pitsidianakis (3): | 21 | Vladimir Sementsov-Ogievskiy (1): |
18 | block: add bdrv_co_drain_end callback | 22 | block: fix crash on zero-length unaligned write and read |
19 | block: rename bdrv_co_drain to bdrv_co_drain_begin | ||
20 | block/throttle.c: add bdrv_co_drain_begin/end callbacks | ||
21 | 23 | ||
22 | include/block/block_int.h | 13 ++++++++++--- | 24 | block/io.c | 28 +++++++++++++++++++++++++++- |
23 | block/io.c | 48 +++++++++++++++++++++++++++++++++-------------- | 25 | hw/core/machine.c | 3 ++- |
24 | block/qed.c | 6 +++--- | 26 | 2 files changed, 29 insertions(+), 2 deletions(-) |
25 | block/throttle.c | 18 ++++++++++++++++++ | ||
26 | 4 files changed, 65 insertions(+), 20 deletions(-) | ||
27 | 27 | ||
28 | -- | 28 | -- |
29 | 2.13.6 | 29 | 2.24.1 |
30 | 30 | ||
31 | 31 | diff view generated by jsdifflib |
1 | From: Manos Pitsidianakis <el13635@mail.ntua.gr> | 1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> |
---|---|---|---|
2 | 2 | ||
3 | BlockDriverState has a bdrv_co_drain() callback but no equivalent for | 3 | Commit 7a3f542fbd "block/io: refactor padding" occasionally dropped |
4 | the end of the drain. The throttle driver (block/throttle.c) needs a way | 4 | aligning for zero-length request: bdrv_init_padding() blindly return |
5 | to mark the end of the drain in order to toggle io_limits_disabled | 5 | false if bytes == 0, like there is nothing to align. |
6 | correctly, thus bdrv_co_drain_end is needed. | ||
7 | 6 | ||
8 | Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr> | 7 | This leads the following command to crash: |
9 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 8 | |
10 | Reviewed-by: Fam Zheng <famz@redhat.com> | 9 | ./qemu-io --image-opts -c 'write 1 0' \ |
10 | driver=blkdebug,align=512,image.driver=null-co,image.size=512 | ||
11 | |||
12 | >> qemu-io: block/io.c:1955: bdrv_aligned_pwritev: Assertion | ||
13 | `(offset & (align - 1)) == 0' failed. | ||
14 | >> Aborted (core dumped) | ||
15 | |||
16 | Prior to 7a3f542fbd we does aligning of such zero requests. Instead of | ||
17 | recovering this behavior let's just do nothing on such requests as it | ||
18 | is useless. | ||
19 | |||
20 | Note that driver may have special meaning of zero-length reqeusts, like | ||
21 | qcow2_co_pwritev_compressed_part, so we can't skip any zero-length | ||
22 | operation. But for unaligned ones, we can't pass it to driver anyway. | ||
23 | |||
24 | This commit also fixes crash in iotest 80 running with -nocache: | ||
25 | |||
26 | ./check -nocache -qcow2 80 | ||
27 | |||
28 | which crashes on same assertion due to trying to read empty extra data | ||
29 | in qcow2_do_read_snapshots(). | ||
30 | |||
31 | Cc: qemu-stable@nongnu.org # v4.2 | ||
32 | Fixes: 7a3f542fbd | ||
33 | Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
34 | Reviewed-by: Max Reitz <mreitz@redhat.com> | ||
35 | Message-id: 20200206164245.17781-1-vsementsov@virtuozzo.com | ||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 36 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
12 | --- | 37 | --- |
13 | include/block/block_int.h | 11 +++++++++-- | 38 | block/io.c | 28 +++++++++++++++++++++++++++- |
14 | block/io.c | 48 +++++++++++++++++++++++++++++++++-------------- | 39 | 1 file changed, 27 insertions(+), 1 deletion(-) |
15 | 2 files changed, 43 insertions(+), 16 deletions(-) | ||
16 | 40 | ||
17 | diff --git a/include/block/block_int.h b/include/block/block_int.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/block/block_int.h | ||
20 | +++ b/include/block/block_int.h | ||
21 | @@ -XXX,XX +XXX,XX @@ struct BlockDriver { | ||
22 | int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo); | ||
23 | |||
24 | /** | ||
25 | - * Drain and stop any internal sources of requests in the driver, and | ||
26 | - * remain so until next I/O callback (e.g. bdrv_co_writev) is called. | ||
27 | + * bdrv_co_drain is called if implemented in the beginning of a | ||
28 | + * drain operation to drain and stop any internal sources of requests in | ||
29 | + * the driver. | ||
30 | + * bdrv_co_drain_end is called if implemented at the end of the drain. | ||
31 | + * | ||
32 | + * They should be used by the driver to e.g. manage scheduled I/O | ||
33 | + * requests, or toggle an internal state. After the end of the drain new | ||
34 | + * requests will continue normally. | ||
35 | */ | ||
36 | void coroutine_fn (*bdrv_co_drain)(BlockDriverState *bs); | ||
37 | + void coroutine_fn (*bdrv_co_drain_end)(BlockDriverState *bs); | ||
38 | |||
39 | void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *child, | ||
40 | Error **errp); | ||
41 | diff --git a/block/io.c b/block/io.c | 41 | diff --git a/block/io.c b/block/io.c |
42 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/block/io.c | 43 | --- a/block/io.c |
44 | +++ b/block/io.c | 44 | +++ b/block/io.c |
45 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 45 | @@ -XXX,XX +XXX,XX @@ static bool bdrv_init_padding(BlockDriverState *bs, |
46 | Coroutine *co; | 46 | pad->tail = align - pad->tail; |
47 | BlockDriverState *bs; | ||
48 | bool done; | ||
49 | + bool begin; | ||
50 | } BdrvCoDrainData; | ||
51 | |||
52 | static void coroutine_fn bdrv_drain_invoke_entry(void *opaque) | ||
53 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_drain_invoke_entry(void *opaque) | ||
54 | BdrvCoDrainData *data = opaque; | ||
55 | BlockDriverState *bs = data->bs; | ||
56 | |||
57 | - bs->drv->bdrv_co_drain(bs); | ||
58 | + if (data->begin) { | ||
59 | + bs->drv->bdrv_co_drain(bs); | ||
60 | + } else { | ||
61 | + bs->drv->bdrv_co_drain_end(bs); | ||
62 | + } | ||
63 | |||
64 | /* Set data->done before reading bs->wakeup. */ | ||
65 | atomic_mb_set(&data->done, true); | ||
66 | bdrv_wakeup(bs); | ||
67 | } | ||
68 | |||
69 | -static void bdrv_drain_invoke(BlockDriverState *bs) | ||
70 | +static void bdrv_drain_invoke(BlockDriverState *bs, bool begin) | ||
71 | { | ||
72 | - BdrvCoDrainData data = { .bs = bs, .done = false }; | ||
73 | + BdrvCoDrainData data = { .bs = bs, .done = false, .begin = begin}; | ||
74 | |||
75 | - if (!bs->drv || !bs->drv->bdrv_co_drain) { | ||
76 | + if (!bs->drv || (begin && !bs->drv->bdrv_co_drain) || | ||
77 | + (!begin && !bs->drv->bdrv_co_drain_end)) { | ||
78 | return; | ||
79 | } | 47 | } |
80 | 48 | ||
81 | @@ -XXX,XX +XXX,XX @@ static void bdrv_drain_invoke(BlockDriverState *bs) | 49 | - if ((!pad->head && !pad->tail) || !bytes) { |
82 | BDRV_POLL_WHILE(bs, !data.done); | 50 | + if (!pad->head && !pad->tail) { |
83 | } | 51 | return false; |
84 | 52 | } | |
85 | -static bool bdrv_drain_recurse(BlockDriverState *bs) | 53 | |
86 | +static bool bdrv_drain_recurse(BlockDriverState *bs, bool begin) | 54 | + assert(bytes); /* Nothing good in aligning zero-length requests */ |
87 | { | ||
88 | BdrvChild *child, *tmp; | ||
89 | bool waited; | ||
90 | |||
91 | - waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0); | ||
92 | - | ||
93 | /* Ensure any pending metadata writes are submitted to bs->file. */ | ||
94 | - bdrv_drain_invoke(bs); | ||
95 | + bdrv_drain_invoke(bs, begin); | ||
96 | + | 55 | + |
97 | + /* Wait for drained requests to finish */ | 56 | sum = pad->head + bytes + pad->tail; |
98 | + waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0); | 57 | pad->buf_len = (sum > align && pad->head && pad->tail) ? 2 * align : align; |
99 | 58 | pad->buf = qemu_blockalign(bs, pad->buf_len); | |
100 | QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) { | 59 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, |
101 | BlockDriverState *bs = child->bs; | 60 | return ret; |
102 | @@ -XXX,XX +XXX,XX @@ static bool bdrv_drain_recurse(BlockDriverState *bs) | 61 | } |
103 | */ | 62 | |
104 | bdrv_ref(bs); | 63 | + if (bytes == 0 && !QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)) { |
105 | } | 64 | + /* |
106 | - waited |= bdrv_drain_recurse(bs); | 65 | + * Aligning zero request is nonsense. Even if driver has special meaning |
107 | + waited |= bdrv_drain_recurse(bs, begin); | 66 | + * of zero-length (like qcow2_co_pwritev_compressed_part), we can't pass |
108 | if (in_main_loop) { | 67 | + * it to driver due to request_alignment. |
109 | bdrv_unref(bs); | 68 | + * |
110 | } | 69 | + * Still, no reason to return an error if someone do unaligned |
111 | @@ -XXX,XX +XXX,XX @@ static void bdrv_co_drain_bh_cb(void *opaque) | 70 | + * zero-length read occasionally. |
112 | BlockDriverState *bs = data->bs; | 71 | + */ |
113 | 72 | + return 0; | |
114 | bdrv_dec_in_flight(bs); | ||
115 | - bdrv_drained_begin(bs); | ||
116 | + if (data->begin) { | ||
117 | + bdrv_drained_begin(bs); | ||
118 | + } else { | ||
119 | + bdrv_drained_end(bs); | ||
120 | + } | 73 | + } |
121 | + | 74 | + |
122 | data->done = true; | ||
123 | aio_co_wake(co); | ||
124 | } | ||
125 | |||
126 | -static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs) | ||
127 | +static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs, | ||
128 | + bool begin) | ||
129 | { | ||
130 | BdrvCoDrainData data; | ||
131 | |||
132 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs) | ||
133 | .co = qemu_coroutine_self(), | ||
134 | .bs = bs, | ||
135 | .done = false, | ||
136 | + .begin = begin, | ||
137 | }; | ||
138 | bdrv_inc_in_flight(bs); | 75 | bdrv_inc_in_flight(bs); |
139 | aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), | 76 | |
140 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs) | 77 | /* Don't do copy-on-read if we read data before write operation */ |
141 | void bdrv_drained_begin(BlockDriverState *bs) | 78 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child, |
142 | { | 79 | return -ENOTSUP; |
143 | if (qemu_in_coroutine()) { | ||
144 | - bdrv_co_yield_to_drain(bs); | ||
145 | + bdrv_co_yield_to_drain(bs, true); | ||
146 | return; | ||
147 | } | 80 | } |
148 | 81 | ||
149 | @@ -XXX,XX +XXX,XX @@ void bdrv_drained_begin(BlockDriverState *bs) | 82 | + if (bytes == 0 && !QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)) { |
150 | bdrv_parent_drained_begin(bs); | 83 | + /* |
151 | } | 84 | + * Aligning zero request is nonsense. Even if driver has special meaning |
152 | 85 | + * of zero-length (like qcow2_co_pwritev_compressed_part), we can't pass | |
153 | - bdrv_drain_recurse(bs); | 86 | + * it to driver due to request_alignment. |
154 | + bdrv_drain_recurse(bs, true); | 87 | + * |
155 | } | 88 | + * Still, no reason to return an error if someone do unaligned |
156 | 89 | + * zero-length write occasionally. | |
157 | void bdrv_drained_end(BlockDriverState *bs) | 90 | + */ |
158 | { | 91 | + return 0; |
159 | + if (qemu_in_coroutine()) { | ||
160 | + bdrv_co_yield_to_drain(bs, false); | ||
161 | + return; | ||
162 | + } | 92 | + } |
163 | assert(bs->quiesce_counter > 0); | 93 | + |
164 | if (atomic_fetch_dec(&bs->quiesce_counter) > 1) { | 94 | bdrv_inc_in_flight(bs); |
165 | return; | 95 | /* |
166 | } | 96 | * Align write if necessary by performing a read-modify-write cycle. |
167 | |||
168 | bdrv_parent_drained_end(bs); | ||
169 | + bdrv_drain_recurse(bs, false); | ||
170 | aio_enable_external(bdrv_get_aio_context(bs)); | ||
171 | } | ||
172 | |||
173 | @@ -XXX,XX +XXX,XX @@ void bdrv_drain_all_begin(void) | ||
174 | aio_context_acquire(aio_context); | ||
175 | for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) { | ||
176 | if (aio_context == bdrv_get_aio_context(bs)) { | ||
177 | - waited |= bdrv_drain_recurse(bs); | ||
178 | + waited |= bdrv_drain_recurse(bs, true); | ||
179 | } | ||
180 | } | ||
181 | aio_context_release(aio_context); | ||
182 | @@ -XXX,XX +XXX,XX @@ void bdrv_drain_all_end(void) | ||
183 | aio_context_acquire(aio_context); | ||
184 | aio_enable_external(aio_context); | ||
185 | bdrv_parent_drained_end(bs); | ||
186 | + bdrv_drain_recurse(bs, false); | ||
187 | aio_context_release(aio_context); | ||
188 | } | ||
189 | |||
190 | -- | 97 | -- |
191 | 2.13.6 | 98 | 2.24.1 |
192 | 99 | ||
193 | 100 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Manos Pitsidianakis <el13635@mail.ntua.gr> | ||
2 | 1 | ||
3 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
4 | Reviewed-by: Fam Zheng <famz@redhat.com> | ||
5 | Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr> | ||
6 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
7 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
8 | --- | ||
9 | include/block/block_int.h | 4 ++-- | ||
10 | block/io.c | 4 ++-- | ||
11 | block/qed.c | 6 +++--- | ||
12 | 3 files changed, 7 insertions(+), 7 deletions(-) | ||
13 | |||
14 | diff --git a/include/block/block_int.h b/include/block/block_int.h | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/include/block/block_int.h | ||
17 | +++ b/include/block/block_int.h | ||
18 | @@ -XXX,XX +XXX,XX @@ struct BlockDriver { | ||
19 | int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo); | ||
20 | |||
21 | /** | ||
22 | - * bdrv_co_drain is called if implemented in the beginning of a | ||
23 | + * bdrv_co_drain_begin is called if implemented in the beginning of a | ||
24 | * drain operation to drain and stop any internal sources of requests in | ||
25 | * the driver. | ||
26 | * bdrv_co_drain_end is called if implemented at the end of the drain. | ||
27 | @@ -XXX,XX +XXX,XX @@ struct BlockDriver { | ||
28 | * requests, or toggle an internal state. After the end of the drain new | ||
29 | * requests will continue normally. | ||
30 | */ | ||
31 | - void coroutine_fn (*bdrv_co_drain)(BlockDriverState *bs); | ||
32 | + void coroutine_fn (*bdrv_co_drain_begin)(BlockDriverState *bs); | ||
33 | void coroutine_fn (*bdrv_co_drain_end)(BlockDriverState *bs); | ||
34 | |||
35 | void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *child, | ||
36 | diff --git a/block/io.c b/block/io.c | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/block/io.c | ||
39 | +++ b/block/io.c | ||
40 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_drain_invoke_entry(void *opaque) | ||
41 | BlockDriverState *bs = data->bs; | ||
42 | |||
43 | if (data->begin) { | ||
44 | - bs->drv->bdrv_co_drain(bs); | ||
45 | + bs->drv->bdrv_co_drain_begin(bs); | ||
46 | } else { | ||
47 | bs->drv->bdrv_co_drain_end(bs); | ||
48 | } | ||
49 | @@ -XXX,XX +XXX,XX @@ static void bdrv_drain_invoke(BlockDriverState *bs, bool begin) | ||
50 | { | ||
51 | BdrvCoDrainData data = { .bs = bs, .done = false, .begin = begin}; | ||
52 | |||
53 | - if (!bs->drv || (begin && !bs->drv->bdrv_co_drain) || | ||
54 | + if (!bs->drv || (begin && !bs->drv->bdrv_co_drain_begin) || | ||
55 | (!begin && !bs->drv->bdrv_co_drain_end)) { | ||
56 | return; | ||
57 | } | ||
58 | diff --git a/block/qed.c b/block/qed.c | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/block/qed.c | ||
61 | +++ b/block/qed.c | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool qed_plug_allocating_write_reqs(BDRVQEDState *s) | ||
63 | assert(!s->allocating_write_reqs_plugged); | ||
64 | if (s->allocating_acb != NULL) { | ||
65 | /* Another allocating write came concurrently. This cannot happen | ||
66 | - * from bdrv_qed_co_drain, but it can happen when the timer runs. | ||
67 | + * from bdrv_qed_co_drain_begin, but it can happen when the timer runs. | ||
68 | */ | ||
69 | qemu_co_mutex_unlock(&s->table_lock); | ||
70 | return false; | ||
71 | @@ -XXX,XX +XXX,XX @@ static void bdrv_qed_attach_aio_context(BlockDriverState *bs, | ||
72 | } | ||
73 | } | ||
74 | |||
75 | -static void coroutine_fn bdrv_qed_co_drain(BlockDriverState *bs) | ||
76 | +static void coroutine_fn bdrv_qed_co_drain_begin(BlockDriverState *bs) | ||
77 | { | ||
78 | BDRVQEDState *s = bs->opaque; | ||
79 | |||
80 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_qed = { | ||
81 | .bdrv_check = bdrv_qed_check, | ||
82 | .bdrv_detach_aio_context = bdrv_qed_detach_aio_context, | ||
83 | .bdrv_attach_aio_context = bdrv_qed_attach_aio_context, | ||
84 | - .bdrv_co_drain = bdrv_qed_co_drain, | ||
85 | + .bdrv_co_drain_begin = bdrv_qed_co_drain_begin, | ||
86 | }; | ||
87 | |||
88 | static void bdrv_qed_init(void) | ||
89 | -- | ||
90 | 2.13.6 | ||
91 | |||
92 | diff view generated by jsdifflib |
1 | From: Manos Pitsidianakis <el13635@mail.ntua.gr> | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 3 | Commit ed65fd1a2750 ("virtio-blk: switch off scsi-passthrough by |
4 | Reviewed-by: Fam Zheng <famz@redhat.com> | 4 | default") changed the default value of the 'scsi' property of |
5 | Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr> | 5 | virtio-blk, which is only available on Linux hosts. It also added |
6 | an unconditional compat entry for 2.4 or earlier machines. | ||
7 | |||
8 | Trying to set this property on a pre-2.5 machine on OSX, we get: | ||
9 | |||
10 | Unexpected error in object_property_find() at qom/object.c:1201: | ||
11 | qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not found | ||
12 | |||
13 | Fix this error by marking the property optional. | ||
14 | |||
15 | Fixes: ed65fd1a27 ("virtio-blk: switch off scsi-passthrough by default") | ||
16 | Suggested-by: Cornelia Huck <cohuck@redhat.com> | ||
17 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> | ||
18 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
19 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
20 | Message-id: 20200207001404.1739-1-philmd@redhat.com | ||
6 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 21 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
7 | --- | 22 | --- |
8 | block/throttle.c | 18 ++++++++++++++++++ | 23 | hw/core/machine.c | 3 ++- |
9 | 1 file changed, 18 insertions(+) | 24 | 1 file changed, 2 insertions(+), 1 deletion(-) |
10 | 25 | ||
11 | diff --git a/block/throttle.c b/block/throttle.c | 26 | diff --git a/hw/core/machine.c b/hw/core/machine.c |
12 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/block/throttle.c | 28 | --- a/hw/core/machine.c |
14 | +++ b/block/throttle.c | 29 | +++ b/hw/core/machine.c |
15 | @@ -XXX,XX +XXX,XX @@ static bool throttle_recurse_is_first_non_filter(BlockDriverState *bs, | 30 | @@ -XXX,XX +XXX,XX @@ GlobalProperty hw_compat_2_5[] = { |
16 | return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate); | 31 | const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5); |
17 | } | 32 | |
18 | 33 | GlobalProperty hw_compat_2_4[] = { | |
19 | +static void coroutine_fn throttle_co_drain_begin(BlockDriverState *bs) | 34 | - { "virtio-blk-device", "scsi", "true" }, |
20 | +{ | 35 | + /* Optional because the 'scsi' property is Linux-only */ |
21 | + ThrottleGroupMember *tgm = bs->opaque; | 36 | + { "virtio-blk-device", "scsi", "true", .optional = true }, |
22 | + if (atomic_fetch_inc(&tgm->io_limits_disabled) == 0) { | 37 | { "e1000", "extra_mac_registers", "off" }, |
23 | + throttle_group_restart_tgm(tgm); | 38 | { "virtio-pci", "x-disable-pcie", "on" }, |
24 | + } | 39 | { "virtio-pci", "migrate-extra", "off" }, |
25 | +} | ||
26 | + | ||
27 | +static void coroutine_fn throttle_co_drain_end(BlockDriverState *bs) | ||
28 | +{ | ||
29 | + ThrottleGroupMember *tgm = bs->opaque; | ||
30 | + assert(tgm->io_limits_disabled); | ||
31 | + atomic_dec(&tgm->io_limits_disabled); | ||
32 | +} | ||
33 | + | ||
34 | static BlockDriver bdrv_throttle = { | ||
35 | .format_name = "throttle", | ||
36 | .protocol_name = "throttle", | ||
37 | @@ -XXX,XX +XXX,XX @@ static BlockDriver bdrv_throttle = { | ||
38 | .bdrv_reopen_abort = throttle_reopen_abort, | ||
39 | .bdrv_co_get_block_status = bdrv_co_get_block_status_from_file, | ||
40 | |||
41 | + .bdrv_co_drain_begin = throttle_co_drain_begin, | ||
42 | + .bdrv_co_drain_end = throttle_co_drain_end, | ||
43 | + | ||
44 | .is_filter = true, | ||
45 | }; | ||
46 | |||
47 | -- | 40 | -- |
48 | 2.13.6 | 41 | 2.24.1 |
49 | 42 | ||
50 | 43 | diff view generated by jsdifflib |