1 | The following changes since commit ea6abffa8a08d832feb759d359d5b935e3087cf7: | 1 | The following changes since commit 346ed3151f1c43e72c40cb55b392a1d4cface62c: |
---|---|---|---|
2 | 2 | ||
3 | Update version for v3.0.0-rc1 release (2018-07-17 18:15:19 +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 6fccbb475bc6effc313ee9481726a1748b6dae57: | 9 | for you to fetch changes up to 11a18c84db4a71497d3d40769688a01b6f64b2ad: |
10 | 10 | ||
11 | throttle-groups: fix hang when group member leaves (2018-07-19 13:08:26 +0100) | 11 | hw/core: Allow setting 'virtio-blk-device.scsi' property on OSX host (2020-02-07 16:49:39 +0000) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Pull request | 14 | Pull request |
15 | 15 | ||
16 | This fix prevents hangs when a drive leaves a throttling group. | ||
17 | |||
18 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
19 | 17 | ||
20 | Stefan Hajnoczi (1): | 18 | Philippe Mathieu-Daudé (1): |
21 | throttle-groups: fix hang when group member leaves | 19 | hw/core: Allow setting 'virtio-blk-device.scsi' property on OSX host |
22 | 20 | ||
23 | block/throttle-groups.c | 4 ++++ | 21 | Vladimir Sementsov-Ogievskiy (1): |
24 | 1 file changed, 4 insertions(+) | 22 | block: fix crash on zero-length unaligned write and read |
23 | |||
24 | block/io.c | 28 +++++++++++++++++++++++++++- | ||
25 | hw/core/machine.c | 3 ++- | ||
26 | 2 files changed, 29 insertions(+), 2 deletions(-) | ||
25 | 27 | ||
26 | -- | 28 | -- |
27 | 2.17.1 | 29 | 2.24.1 |
28 | 30 | ||
29 | 31 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | ||
1 | 2 | ||
3 | Commit 7a3f542fbd "block/io: refactor padding" occasionally dropped | ||
4 | aligning for zero-length request: bdrv_init_padding() blindly return | ||
5 | false if bytes == 0, like there is nothing to align. | ||
6 | |||
7 | This leads the following command to crash: | ||
8 | |||
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 | ||
36 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
37 | --- | ||
38 | block/io.c | 28 +++++++++++++++++++++++++++- | ||
39 | 1 file changed, 27 insertions(+), 1 deletion(-) | ||
40 | |||
41 | diff --git a/block/io.c b/block/io.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/block/io.c | ||
44 | +++ b/block/io.c | ||
45 | @@ -XXX,XX +XXX,XX @@ static bool bdrv_init_padding(BlockDriverState *bs, | ||
46 | pad->tail = align - pad->tail; | ||
47 | } | ||
48 | |||
49 | - if ((!pad->head && !pad->tail) || !bytes) { | ||
50 | + if (!pad->head && !pad->tail) { | ||
51 | return false; | ||
52 | } | ||
53 | |||
54 | + assert(bytes); /* Nothing good in aligning zero-length requests */ | ||
55 | + | ||
56 | sum = pad->head + bytes + pad->tail; | ||
57 | pad->buf_len = (sum > align && pad->head && pad->tail) ? 2 * align : align; | ||
58 | pad->buf = qemu_blockalign(bs, pad->buf_len); | ||
59 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child, | ||
60 | return ret; | ||
61 | } | ||
62 | |||
63 | + if (bytes == 0 && !QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)) { | ||
64 | + /* | ||
65 | + * Aligning zero request is nonsense. Even if driver has special meaning | ||
66 | + * of zero-length (like qcow2_co_pwritev_compressed_part), we can't pass | ||
67 | + * it to driver due to request_alignment. | ||
68 | + * | ||
69 | + * Still, no reason to return an error if someone do unaligned | ||
70 | + * zero-length read occasionally. | ||
71 | + */ | ||
72 | + return 0; | ||
73 | + } | ||
74 | + | ||
75 | bdrv_inc_in_flight(bs); | ||
76 | |||
77 | /* Don't do copy-on-read if we read data before write operation */ | ||
78 | @@ -XXX,XX +XXX,XX @@ int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child, | ||
79 | return -ENOTSUP; | ||
80 | } | ||
81 | |||
82 | + if (bytes == 0 && !QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)) { | ||
83 | + /* | ||
84 | + * Aligning zero request is nonsense. Even if driver has special meaning | ||
85 | + * of zero-length (like qcow2_co_pwritev_compressed_part), we can't pass | ||
86 | + * it to driver due to request_alignment. | ||
87 | + * | ||
88 | + * Still, no reason to return an error if someone do unaligned | ||
89 | + * zero-length write occasionally. | ||
90 | + */ | ||
91 | + return 0; | ||
92 | + } | ||
93 | + | ||
94 | bdrv_inc_in_flight(bs); | ||
95 | /* | ||
96 | * Align write if necessary by performing a read-modify-write cycle. | ||
97 | -- | ||
98 | 2.24.1 | ||
99 | |||
100 | diff view generated by jsdifflib |
1 | Throttle groups consist of members sharing one throttling state | 1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> |
---|---|---|---|
2 | (including bps/iops limits). Round-robin scheduling is used to ensure | ||
3 | fairness. If a group member already has a timer pending then other | ||
4 | groups members do not schedule their own timers. The next group member | ||
5 | will have its turn when the existing timer expires. | ||
6 | 2 | ||
7 | A hang may occur when a group member leaves while it had a timer | 3 | Commit ed65fd1a2750 ("virtio-blk: switch off scsi-passthrough by |
8 | scheduled. Although the code carefully removes the group member from | 4 | default") changed the default value of the 'scsi' property of |
9 | the round-robin list, it does not schedule the next member. Therefore | 5 | virtio-blk, which is only available on Linux hosts. It also added |
10 | remaining members continue to wait for the removed member's timer to | 6 | an unconditional compat entry for 2.4 or earlier machines. |
11 | expire. | ||
12 | 7 | ||
13 | This patch schedules the next request if a timer is pending. | 8 | Trying to set this property on a pre-2.5 machine on OSX, we get: |
14 | Unfortunately the actual bug is a race condition that I've been unable | ||
15 | to capture in a test case. | ||
16 | 9 | ||
17 | Sometimes drive2 hangs when drive1 is removed from the throttling group: | 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 | ||
18 | 12 | ||
19 | $ qemu ... -drive if=none,id=drive1,cache=none,format=qcow2,file=data1.qcow2,iops=100,group=foo \ | 13 | Fix this error by marking the property optional. |
20 | -device virtio-blk-pci,id=virtio-blk-pci0,drive=drive1 \ | ||
21 | -drive if=none,id=drive2,cache=none,format=qcow2,file=data2.qcow2,iops=10,group=foo \ | ||
22 | -device virtio-blk-pci,id=virtio-blk-pci1,drive=drive2 | ||
23 | (guest-console1)# fio -filename /dev/vda 4k-seq-read.job | ||
24 | (guest-console2)# fio -filename /dev/vdb 4k-seq-read.job | ||
25 | (qmp) {"execute": "block_set_io_throttle", "arguments": {"device": "drive1","bps": 0,"bps_rd": 0,"bps_wr": 0,"iops": 0,"iops_rd": 0,"iops_wr": 0}} | ||
26 | 14 | ||
27 | Reported-by: Nini Gu <ngu@redhat.com> | 15 | Fixes: ed65fd1a27 ("virtio-blk: switch off scsi-passthrough by default") |
28 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 16 | Suggested-by: Cornelia Huck <cohuck@redhat.com> |
29 | Message-id: 20180704145410.794-1-stefanha@redhat.com | 17 | Reviewed-by: Cornelia Huck <cohuck@redhat.com> |
30 | RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1535914 | 18 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
31 | Cc: Alberto Garcia <berto@igalia.com> | 19 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> |
20 | Message-id: 20200207001404.1739-1-philmd@redhat.com | ||
32 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | 21 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> |
33 | --- | 22 | --- |
34 | block/throttle-groups.c | 4 ++++ | 23 | hw/core/machine.c | 3 ++- |
35 | 1 file changed, 4 insertions(+) | 24 | 1 file changed, 2 insertions(+), 1 deletion(-) |
36 | 25 | ||
37 | diff --git a/block/throttle-groups.c b/block/throttle-groups.c | 26 | diff --git a/hw/core/machine.c b/hw/core/machine.c |
38 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/block/throttle-groups.c | 28 | --- a/hw/core/machine.c |
40 | +++ b/block/throttle-groups.c | 29 | +++ b/hw/core/machine.c |
41 | @@ -XXX,XX +XXX,XX @@ void throttle_group_unregister_tgm(ThrottleGroupMember *tgm) | 30 | @@ -XXX,XX +XXX,XX @@ GlobalProperty hw_compat_2_5[] = { |
42 | 31 | const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5); | |
43 | qemu_mutex_lock(&tg->lock); | 32 | |
44 | for (i = 0; i < 2; i++) { | 33 | GlobalProperty hw_compat_2_4[] = { |
45 | + if (timer_pending(tgm->throttle_timers.timers[i])) { | 34 | - { "virtio-blk-device", "scsi", "true" }, |
46 | + tg->any_timer_armed[i] = false; | 35 | + /* Optional because the 'scsi' property is Linux-only */ |
47 | + schedule_next_request(tgm, i); | 36 | + { "virtio-blk-device", "scsi", "true", .optional = true }, |
48 | + } | 37 | { "e1000", "extra_mac_registers", "off" }, |
49 | if (tg->tokens[i] == tgm) { | 38 | { "virtio-pci", "x-disable-pcie", "on" }, |
50 | token = throttle_group_next_tgm(tgm); | 39 | { "virtio-pci", "migrate-extra", "off" }, |
51 | /* Take care of the case where this is the last tgm in the group */ | ||
52 | -- | 40 | -- |
53 | 2.17.1 | 41 | 2.24.1 |
54 | 42 | ||
55 | 43 | diff view generated by jsdifflib |