1 | The following changes since commit f90ea7ba7c5ae7010ee0ce062207ae42530f57d6: | 1 | The following changes since commit 15ef89d2a1a7b93845a6b09c2ee8e1979f6eb30b: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20171012' into staging (2017-10-12 17:06:50 +0100) | 3 | Update version for v7.0.0-rc1 release (2022-03-22 22:58:44 +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://gitlab.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 2539eade4f689eda7e9fe45486f18334bfbafaf0: |
10 | 10 | ||
11 | block/throttle.c: add bdrv_co_drain_begin/end callbacks (2017-10-13 12:38:41 +0100) | 11 | hw: Fix misleading hexadecimal format (2022-03-24 10:38:42 +0000) |
12 | |||
13 | ---------------------------------------------------------------- | ||
14 | Pull request | ||
15 | |||
16 | Philippe found cases where the 0x%d format string was used, leading to | ||
17 | misleading output. The patches look harmless and could save people time, so I | ||
18 | think it's worth including them in 7.0. | ||
12 | 19 | ||
13 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
14 | 21 | ||
15 | ---------------------------------------------------------------- | 22 | Philippe Mathieu-Daudé (2): |
23 | block: Fix misleading hexadecimal format | ||
24 | hw: Fix misleading hexadecimal format | ||
16 | 25 | ||
17 | Manos Pitsidianakis (3): | 26 | block/parallels-ext.c | 2 +- |
18 | block: add bdrv_co_drain_end callback | 27 | hw/i386/sgx.c | 2 +- |
19 | block: rename bdrv_co_drain to bdrv_co_drain_begin | 28 | hw/i386/trace-events | 6 +++--- |
20 | block/throttle.c: add bdrv_co_drain_begin/end callbacks | 29 | hw/misc/trace-events | 4 ++-- |
21 | 30 | hw/scsi/trace-events | 4 ++-- | |
22 | include/block/block_int.h | 13 ++++++++++--- | 31 | 5 files changed, 9 insertions(+), 9 deletions(-) |
23 | block/io.c | 48 +++++++++++++++++++++++++++++++++-------------- | ||
24 | block/qed.c | 6 +++--- | ||
25 | block/throttle.c | 18 ++++++++++++++++++ | ||
26 | 4 files changed, 65 insertions(+), 20 deletions(-) | ||
27 | 32 | ||
28 | -- | 33 | -- |
29 | 2.13.6 | 34 | 2.35.1 |
30 | 35 | ||
31 | diff view generated by jsdifflib |
1 | From: Manos Pitsidianakis <el13635@mail.ntua.gr> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 3 | "0x%u" format is very misleading, replace by "0x%x". |
4 | Reviewed-by: Fam Zheng <famz@redhat.com> | 4 | |
5 | Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr> | 5 | Found running: |
6 | |||
7 | $ git grep -E '0x%[0-9]*([lL]*|" ?PRI)[dDuU]' block/ | ||
8 | |||
9 | Inspired-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
12 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||
13 | Reviewed-by: Denis V. Lunev <den@openvz.org> | ||
14 | Message-id: 20220323114718.58714-2-philippe.mathieu.daude@gmail.com | ||
6 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 15 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
7 | --- | 16 | --- |
8 | block/throttle.c | 18 ++++++++++++++++++ | 17 | block/parallels-ext.c | 2 +- |
9 | 1 file changed, 18 insertions(+) | 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
10 | 19 | ||
11 | diff --git a/block/throttle.c b/block/throttle.c | 20 | diff --git a/block/parallels-ext.c b/block/parallels-ext.c |
12 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/block/throttle.c | 22 | --- a/block/parallels-ext.c |
14 | +++ b/block/throttle.c | 23 | +++ b/block/parallels-ext.c |
15 | @@ -XXX,XX +XXX,XX @@ static bool throttle_recurse_is_first_non_filter(BlockDriverState *bs, | 24 | @@ -XXX,XX +XXX,XX @@ static int parallels_parse_format_extension(BlockDriverState *bs, |
16 | return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate); | 25 | break; |
17 | } | 26 | |
18 | 27 | default: | |
19 | +static void coroutine_fn throttle_co_drain_begin(BlockDriverState *bs) | 28 | - error_setg(errp, "Unknown feature: 0x%" PRIu64, fh.magic); |
20 | +{ | 29 | + error_setg(errp, "Unknown feature: 0x%" PRIx64, fh.magic); |
21 | + ThrottleGroupMember *tgm = bs->opaque; | 30 | goto fail; |
22 | + if (atomic_fetch_inc(&tgm->io_limits_disabled) == 0) { | 31 | } |
23 | + throttle_group_restart_tgm(tgm); | ||
24 | + } | ||
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 | 32 | ||
47 | -- | 33 | -- |
48 | 2.13.6 | 34 | 2.35.1 |
49 | 35 | ||
50 | 36 | diff view generated by jsdifflib |
1 | From: Manos Pitsidianakis <el13635@mail.ntua.gr> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | BlockDriverState has a bdrv_co_drain() callback but no equivalent for | 3 | "0x%u" format is very misleading, replace by "0x%x". |
4 | the end of the drain. The throttle driver (block/throttle.c) needs a way | ||
5 | to mark the end of the drain in order to toggle io_limits_disabled | ||
6 | correctly, thus bdrv_co_drain_end is needed. | ||
7 | 4 | ||
8 | Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr> | 5 | Found running: |
9 | Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> | 6 | |
10 | Reviewed-by: Fam Zheng <famz@redhat.com> | 7 | $ git grep -E '0x%[0-9]*([lL]*|" ?PRI)[dDuU]' hw/ |
8 | |||
9 | Inspired-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> | ||
12 | Message-id: 20220323114718.58714-3-philippe.mathieu.daude@gmail.com | ||
11 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 13 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
12 | --- | 14 | --- |
13 | include/block/block_int.h | 11 +++++++++-- | 15 | hw/i386/sgx.c | 2 +- |
14 | block/io.c | 48 +++++++++++++++++++++++++++++++++-------------- | 16 | hw/i386/trace-events | 6 +++--- |
15 | 2 files changed, 43 insertions(+), 16 deletions(-) | 17 | hw/misc/trace-events | 4 ++-- |
18 | hw/scsi/trace-events | 4 ++-- | ||
19 | 4 files changed, 8 insertions(+), 8 deletions(-) | ||
16 | 20 | ||
17 | diff --git a/include/block/block_int.h b/include/block/block_int.h | 21 | diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c |
18 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/block/block_int.h | 23 | --- a/hw/i386/sgx.c |
20 | +++ b/include/block/block_int.h | 24 | +++ b/hw/i386/sgx.c |
21 | @@ -XXX,XX +XXX,XX @@ struct BlockDriver { | 25 | @@ -XXX,XX +XXX,XX @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) |
22 | int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo); | 26 | } |
23 | 27 | ||
24 | /** | 28 | if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) { |
25 | - * Drain and stop any internal sources of requests in the driver, and | 29 | - error_report("Size of all 'sgx-epc' =0x%"PRIu64" causes EPC to wrap", |
26 | - * remain so until next I/O callback (e.g. bdrv_co_writev) is called. | 30 | + error_report("Size of all 'sgx-epc' =0x%"PRIx64" causes EPC to wrap", |
27 | + * bdrv_co_drain is called if implemented in the beginning of a | 31 | sgx_epc->size); |
28 | + * drain operation to drain and stop any internal sources of requests in | 32 | exit(EXIT_FAILURE); |
29 | + * the driver. | 33 | } |
30 | + * bdrv_co_drain_end is called if implemented at the end of the drain. | 34 | diff --git a/hw/i386/trace-events b/hw/i386/trace-events |
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 | ||
42 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/block/io.c | 36 | --- a/hw/i386/trace-events |
44 | +++ b/block/io.c | 37 | +++ b/hw/i386/trace-events |
45 | @@ -XXX,XX +XXX,XX @@ typedef struct { | 38 | @@ -XXX,XX +XXX,XX @@ vtd_fault_disabled(void) "Fault processing disabled for context entry" |
46 | Coroutine *co; | 39 | vtd_replay_ce_valid(const char *mode, uint8_t bus, uint8_t dev, uint8_t fn, uint16_t domain, uint64_t hi, uint64_t lo) "%s: replay valid context device %02"PRIx8":%02"PRIx8".%02"PRIx8" domain 0x%"PRIx16" hi 0x%"PRIx64" lo 0x%"PRIx64 |
47 | BlockDriverState *bs; | 40 | vtd_replay_ce_invalid(uint8_t bus, uint8_t dev, uint8_t fn) "replay invalid context device %02"PRIx8":%02"PRIx8".%02"PRIx8 |
48 | bool done; | 41 | vtd_page_walk_level(uint64_t addr, uint32_t level, uint64_t start, uint64_t end) "walk (base=0x%"PRIx64", level=%"PRIu32") iova range 0x%"PRIx64" - 0x%"PRIx64 |
49 | + bool begin; | 42 | -vtd_page_walk_one(uint16_t domain, uint64_t iova, uint64_t gpa, uint64_t mask, int perm) "domain 0x%"PRIu16" iova 0x%"PRIx64" -> gpa 0x%"PRIx64" mask 0x%"PRIx64" perm %d" |
50 | } BdrvCoDrainData; | 43 | +vtd_page_walk_one(uint16_t domain, uint64_t iova, uint64_t gpa, uint64_t mask, int perm) "domain 0x%"PRIx16" iova 0x%"PRIx64" -> gpa 0x%"PRIx64" mask 0x%"PRIx64" perm %d" |
51 | 44 | vtd_page_walk_one_skip_map(uint64_t iova, uint64_t mask, uint64_t translated) "iova 0x%"PRIx64" mask 0x%"PRIx64" translated 0x%"PRIx64 | |
52 | static void coroutine_fn bdrv_drain_invoke_entry(void *opaque) | 45 | vtd_page_walk_one_skip_unmap(uint64_t iova, uint64_t mask) "iova 0x%"PRIx64" mask 0x%"PRIx64 |
53 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_drain_invoke_entry(void *opaque) | 46 | vtd_page_walk_skip_read(uint64_t iova, uint64_t next) "Page walk skip iova 0x%"PRIx64" - 0x%"PRIx64" due to unable to read" |
54 | BdrvCoDrainData *data = opaque; | 47 | vtd_page_walk_skip_reserve(uint64_t iova, uint64_t next) "Page walk skip iova 0x%"PRIx64" - 0x%"PRIx64" due to rsrv set" |
55 | BlockDriverState *bs = data->bs; | 48 | vtd_switch_address_space(uint8_t bus, uint8_t slot, uint8_t fn, bool on) "Device %02x:%02x.%x switching address space (iommu enabled=%d)" |
56 | 49 | vtd_as_unmap_whole(uint8_t bus, uint8_t slot, uint8_t fn, uint64_t iova, uint64_t size) "Device %02x:%02x.%x start 0x%"PRIx64" size 0x%"PRIx64 | |
57 | - bs->drv->bdrv_co_drain(bs); | 50 | -vtd_translate_pt(uint16_t sid, uint64_t addr) "source id 0x%"PRIu16", iova 0x%"PRIx64 |
58 | + if (data->begin) { | 51 | -vtd_pt_enable_fast_path(uint16_t sid, bool success) "sid 0x%"PRIu16" %d" |
59 | + bs->drv->bdrv_co_drain(bs); | 52 | +vtd_translate_pt(uint16_t sid, uint64_t addr) "source id 0x%"PRIx16", iova 0x%"PRIx64 |
60 | + } else { | 53 | +vtd_pt_enable_fast_path(uint16_t sid, bool success) "sid 0x%"PRIx16" %d" |
61 | + bs->drv->bdrv_co_drain_end(bs); | 54 | vtd_irq_generate(uint64_t addr, uint64_t data) "addr 0x%"PRIx64" data 0x%"PRIx64 |
62 | + } | 55 | vtd_reg_read(uint64_t addr, uint64_t size) "addr 0x%"PRIx64" size 0x%"PRIx64 |
63 | 56 | vtd_reg_write(uint64_t addr, uint64_t size, uint64_t val) "addr 0x%"PRIx64" size 0x%"PRIx64" value 0x%"PRIx64 | |
64 | /* Set data->done before reading bs->wakeup. */ | 57 | diff --git a/hw/misc/trace-events b/hw/misc/trace-events |
65 | atomic_mb_set(&data->done, true); | 58 | index XXXXXXX..XXXXXXX 100644 |
66 | bdrv_wakeup(bs); | 59 | --- a/hw/misc/trace-events |
67 | } | 60 | +++ b/hw/misc/trace-events |
68 | 61 | @@ -XXX,XX +XXX,XX @@ | |
69 | -static void bdrv_drain_invoke(BlockDriverState *bs) | 62 | # See docs/devel/tracing.rst for syntax documentation. |
70 | +static void bdrv_drain_invoke(BlockDriverState *bs, bool begin) | 63 | |
71 | { | 64 | # allwinner-cpucfg.c |
72 | - BdrvCoDrainData data = { .bs = bs, .done = false }; | 65 | -allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIu32 |
73 | + BdrvCoDrainData data = { .bs = bs, .done = false, .begin = begin}; | 66 | +allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIx32 |
74 | 67 | allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 | |
75 | - if (!bs->drv || !bs->drv->bdrv_co_drain) { | 68 | allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32 |
76 | + if (!bs->drv || (begin && !bs->drv->bdrv_co_drain) || | 69 | |
77 | + (!begin && !bs->drv->bdrv_co_drain_end)) { | 70 | @@ -XXX,XX +XXX,XX @@ imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" PRIx64 "value 0x%08 |
78 | return; | 71 | |
79 | } | 72 | # mos6522.c |
80 | 73 | mos6522_set_counter(int index, unsigned int val) "T%d.counter=%d" | |
81 | @@ -XXX,XX +XXX,XX @@ static void bdrv_drain_invoke(BlockDriverState *bs) | 74 | -mos6522_get_next_irq_time(uint16_t latch, int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 " delta_next=0x%"PRId64 |
82 | BDRV_POLL_WHILE(bs, !data.done); | 75 | +mos6522_get_next_irq_time(uint16_t latch, int64_t d, int64_t delta) "latch=%d counter=0x%"PRIx64 " delta_next=0x%"PRIx64 |
83 | } | 76 | mos6522_set_sr_int(void) "set sr_int" |
84 | 77 | mos6522_write(uint64_t addr, const char *name, uint64_t val) "reg=0x%"PRIx64 " [%s] val=0x%"PRIx64 | |
85 | -static bool bdrv_drain_recurse(BlockDriverState *bs) | 78 | mos6522_read(uint64_t addr, const char *name, unsigned val) "reg=0x%"PRIx64 " [%s] val=0x%x" |
86 | +static bool bdrv_drain_recurse(BlockDriverState *bs, bool begin) | 79 | diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events |
87 | { | 80 | index XXXXXXX..XXXXXXX 100644 |
88 | BdrvChild *child, *tmp; | 81 | --- a/hw/scsi/trace-events |
89 | bool waited; | 82 | +++ b/hw/scsi/trace-events |
90 | 83 | @@ -XXX,XX +XXX,XX @@ lsi_bad_phase_interrupt(void) "Phase mismatch interrupt" | |
91 | - waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0); | 84 | lsi_bad_selection(uint32_t id) "Selected absent target %"PRIu32 |
92 | - | 85 | lsi_do_dma_unavailable(void) "DMA no data available" |
93 | /* Ensure any pending metadata writes are submitted to bs->file. */ | 86 | lsi_do_dma(uint64_t addr, int len) "DMA addr=0x%"PRIx64" len=%d" |
94 | - bdrv_drain_invoke(bs); | 87 | -lsi_queue_command(uint32_t tag) "Queueing tag=0x%"PRId32 |
95 | + bdrv_drain_invoke(bs, begin); | 88 | +lsi_queue_command(uint32_t tag) "Queueing tag=0x%"PRIx32 |
96 | + | 89 | lsi_add_msg_byte_error(void) "MSG IN data too long" |
97 | + /* Wait for drained requests to finish */ | 90 | lsi_add_msg_byte(uint8_t data) "MSG IN 0x%02x" |
98 | + waited = BDRV_POLL_WHILE(bs, atomic_read(&bs->in_flight) > 0); | 91 | lsi_reselect(int id) "Reselected target %d" |
99 | 92 | @@ -XXX,XX +XXX,XX @@ lsi_do_msgout_noop(void) "MSG: No Operation" | |
100 | QLIST_FOREACH_SAFE(child, &bs->children, next, tmp) { | 93 | lsi_do_msgout_extended(uint8_t msg, uint8_t len) "Extended message 0x%x (len %d)" |
101 | BlockDriverState *bs = child->bs; | 94 | lsi_do_msgout_ignored(const char *msg) "%s (ignored)" |
102 | @@ -XXX,XX +XXX,XX @@ static bool bdrv_drain_recurse(BlockDriverState *bs) | 95 | lsi_do_msgout_simplequeue(uint8_t select_tag) "SIMPLE queue tag=0x%x" |
103 | */ | 96 | -lsi_do_msgout_abort(uint32_t tag) "MSG: ABORT TAG tag=0x%"PRId32 |
104 | bdrv_ref(bs); | 97 | +lsi_do_msgout_abort(uint32_t tag) "MSG: ABORT TAG tag=0x%"PRIx32 |
105 | } | 98 | lsi_do_msgout_clearqueue(uint32_t tag) "MSG: CLEAR QUEUE tag=0x%"PRIx32 |
106 | - waited |= bdrv_drain_recurse(bs); | 99 | lsi_do_msgout_busdevicereset(uint32_t tag) "MSG: BUS DEVICE RESET tag=0x%"PRIx32 |
107 | + waited |= bdrv_drain_recurse(bs, begin); | 100 | lsi_do_msgout_select(int id) "Select LUN %d" |
108 | if (in_main_loop) { | ||
109 | bdrv_unref(bs); | ||
110 | } | ||
111 | @@ -XXX,XX +XXX,XX @@ static void bdrv_co_drain_bh_cb(void *opaque) | ||
112 | BlockDriverState *bs = data->bs; | ||
113 | |||
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 | + } | ||
121 | + | ||
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); | ||
139 | aio_bh_schedule_oneshot(bdrv_get_aio_context(bs), | ||
140 | @@ -XXX,XX +XXX,XX @@ static void coroutine_fn bdrv_co_yield_to_drain(BlockDriverState *bs) | ||
141 | void bdrv_drained_begin(BlockDriverState *bs) | ||
142 | { | ||
143 | if (qemu_in_coroutine()) { | ||
144 | - bdrv_co_yield_to_drain(bs); | ||
145 | + bdrv_co_yield_to_drain(bs, true); | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | @@ -XXX,XX +XXX,XX @@ void bdrv_drained_begin(BlockDriverState *bs) | ||
150 | bdrv_parent_drained_begin(bs); | ||
151 | } | ||
152 | |||
153 | - bdrv_drain_recurse(bs); | ||
154 | + bdrv_drain_recurse(bs, true); | ||
155 | } | ||
156 | |||
157 | void bdrv_drained_end(BlockDriverState *bs) | ||
158 | { | ||
159 | + if (qemu_in_coroutine()) { | ||
160 | + bdrv_co_yield_to_drain(bs, false); | ||
161 | + return; | ||
162 | + } | ||
163 | assert(bs->quiesce_counter > 0); | ||
164 | if (atomic_fetch_dec(&bs->quiesce_counter) > 1) { | ||
165 | return; | ||
166 | } | ||
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 | -- | 101 | -- |
191 | 2.13.6 | 102 | 2.35.1 |
192 | 103 | ||
193 | 104 | 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 |