1 | The following changes since commit 0a301624c2f4ced3331ffd5bce85b4274fe132af: | 1 | The following changes since commit 6dffbe36af79e26a4d23f94a9a1c1201de99c261: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20220208' into staging (2022-02-08 11:40:08 +0000) | 3 | Merge tag 'migration-20230215-pull-request' of https://gitlab.com/juan.quintela/qemu into staging (2023-02-16 13:09:51 +0000) |
4 | 4 | ||
5 | are available in the Git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | https://gitlab.com/kmwolf/qemu.git tags/for-upstream | 7 | https://repo.or.cz/qemu/kevin.git tags/for-upstream |
8 | 8 | ||
9 | for you to fetch changes up to fdb8541b2e4f6ff60f435fbb5a5e1df20c275a86: | 9 | for you to fetch changes up to a4d5224c2cb650b5a401d626d3f36e42e6987aa7: |
10 | 10 | ||
11 | hw/block/fdc-isa: Respect QOM properties when building AML (2022-02-11 17:37:26 +0100) | 11 | hbitmap: fix hbitmap_status() return value for first dirty bit case (2023-02-17 14:34:24 +0100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Block layer patches | 14 | Block layer patches |
15 | 15 | ||
16 | - Fix crash in blockdev-reopen with iothreads | 16 | - configure: Enable -Wthread-safety if present |
17 | - fdc-isa: Respect QOM properties when building AML | 17 | - no_co_wrapper to fix bdrv_open*() calls from coroutine context |
18 | - curl fixes, including enablement of newer libcurl versions | ||
19 | - MAINTAINERS: drop Vladimir from parallels block driver | ||
20 | - hbitmap: fix hbitmap_status() return value for first dirty bit case | ||
21 | - file-posix: Fix assertion failure in write_zeroes after moving | ||
22 | bdrv_getlength() to co_wrapper | ||
18 | 23 | ||
19 | ---------------------------------------------------------------- | 24 | ---------------------------------------------------------------- |
20 | Bernhard Beschow (1): | 25 | Andrey Zhadchenko (1): |
21 | hw/block/fdc-isa: Respect QOM properties when building AML | 26 | hbitmap: fix hbitmap_status() return value for first dirty bit case |
22 | 27 | ||
23 | Kevin Wolf (2): | 28 | Anton Johansson (1): |
24 | block: Lock AioContext for drain_end in blockdev-reopen | 29 | block: Handle curl 7.55.0, 7.85.0 version changes |
25 | iotests: Test blockdev-reopen with iothreads and throttling | ||
26 | 30 | ||
27 | blockdev.c | 11 ++++++++++- | 31 | Emanuele Giuseppe Esposito (3): |
28 | hw/block/fdc-isa.c | 11 +++++++---- | 32 | util/qemu-thread-posix: use TSA_NO_TSA to suppress clang TSA warnings in FreeBSD |
29 | tests/qemu-iotests/245 | 36 +++++++++++++++++++++++++++++++++--- | 33 | bsd-user/mmap: use TSA_NO_TSA to suppress clang TSA warnings in FreeBSD |
30 | tests/qemu-iotests/245.out | 4 ++-- | 34 | block/file-posix: don't use functions calling AIO_WAIT_WHILE in worker threads |
31 | 4 files changed, 52 insertions(+), 10 deletions(-) | ||
32 | 35 | ||
36 | Hanna Czenczek (1): | ||
37 | curl: Fix error path in curl_open() | ||
33 | 38 | ||
39 | Kevin Wolf (14): | ||
40 | configure: Enable -Wthread-safety if present | ||
41 | block-coroutine-wrapper: Introduce no_co_wrapper | ||
42 | block: Create no_co_wrappers for open functions | ||
43 | luks: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
44 | parallels: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
45 | qcow: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
46 | qcow2: Fix open/create to open images with no_co_wrapper | ||
47 | qed: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
48 | vdi: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
49 | vhdx: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
50 | vmdk: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
51 | vpc: Fix .bdrv_co_create(_opts) to open images with no_co_wrapper | ||
52 | block: Fix bdrv_co_create_opts_simple() to open images with no_co_wrapper | ||
53 | block: Assert non-coroutine context for bdrv_open_inherit() | ||
54 | |||
55 | Stefano Garzarella (1): | ||
56 | block: temporarily hold the new AioContext of bs_top in bdrv_append() | ||
57 | |||
58 | Vladimir Sementsov-Ogievskiy (1): | ||
59 | MAINTAINERS: drop Vladimir from parallels block driver | ||
60 | |||
61 | configure | 1 + | ||
62 | bsd-user/qemu.h | 5 +- | ||
63 | include/block/block-common.h | 14 +++++ | ||
64 | include/block/block-global-state.h | 35 ++++++++---- | ||
65 | include/exec/exec-all.h | 5 +- | ||
66 | include/qemu/hbitmap.h | 2 +- | ||
67 | include/qemu/thread.h | 14 +++-- | ||
68 | include/sysemu/block-backend-global-state.h | 21 ++++++-- | ||
69 | block.c | 40 ++++++++++---- | ||
70 | block/crypto.c | 19 ++++--- | ||
71 | block/curl.c | 50 +++++++++++++---- | ||
72 | block/file-posix.c | 2 +- | ||
73 | block/parallels.c | 10 ++-- | ||
74 | block/qcow.c | 10 ++-- | ||
75 | block/qcow2.c | 43 +++++++-------- | ||
76 | block/qed.c | 10 ++-- | ||
77 | block/vdi.c | 10 ++-- | ||
78 | block/vhdx.c | 10 ++-- | ||
79 | block/vmdk.c | 22 ++++---- | ||
80 | block/vpc.c | 10 ++-- | ||
81 | util/hbitmap.c | 2 +- | ||
82 | util/qemu-thread-posix.c | 2 +- | ||
83 | scripts/block-coroutine-wrapper.py | 83 +++++++++++++++++++++++++---- | ||
84 | MAINTAINERS | 2 - | ||
85 | block/meson.build | 1 + | ||
86 | 25 files changed, 295 insertions(+), 128 deletions(-) | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | bdrv_subtree_drained_end() requires the caller to hold the AioContext | ||
2 | lock for the drained node. Not doing this for nodes outside of the main | ||
3 | AioContext leads to crashes when AIO_WAIT_WHILE() needs to wait and | ||
4 | tries to temporarily release the lock. | ||
5 | 1 | ||
6 | Fixes: 3908b7a8994fa5ef7a89aa58cd5a02fc58141592 | ||
7 | Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2046659 | ||
8 | Reported-by: Qing Wang <qinwang@redhat.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
10 | Message-Id: <20220203140534.36522-2-kwolf@redhat.com> | ||
11 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
12 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
13 | --- | ||
14 | blockdev.c | 11 ++++++++++- | ||
15 | 1 file changed, 10 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/blockdev.c b/blockdev.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/blockdev.c | ||
20 | +++ b/blockdev.c | ||
21 | @@ -XXX,XX +XXX,XX @@ void qmp_blockdev_reopen(BlockdevOptionsList *reopen_list, Error **errp) | ||
22 | { | ||
23 | BlockReopenQueue *queue = NULL; | ||
24 | GSList *drained = NULL; | ||
25 | + GSList *p; | ||
26 | |||
27 | /* Add each one of the BDS that we want to reopen to the queue */ | ||
28 | for (; reopen_list != NULL; reopen_list = reopen_list->next) { | ||
29 | @@ -XXX,XX +XXX,XX @@ void qmp_blockdev_reopen(BlockdevOptionsList *reopen_list, Error **errp) | ||
30 | |||
31 | fail: | ||
32 | bdrv_reopen_queue_free(queue); | ||
33 | - g_slist_free_full(drained, (GDestroyNotify) bdrv_subtree_drained_end); | ||
34 | + for (p = drained; p; p = p->next) { | ||
35 | + BlockDriverState *bs = p->data; | ||
36 | + AioContext *ctx = bdrv_get_aio_context(bs); | ||
37 | + | ||
38 | + aio_context_acquire(ctx); | ||
39 | + bdrv_subtree_drained_end(bs); | ||
40 | + aio_context_release(ctx); | ||
41 | + } | ||
42 | + g_slist_free(drained); | ||
43 | } | ||
44 | |||
45 | void qmp_blockdev_del(const char *node_name, Error **errp) | ||
46 | -- | ||
47 | 2.34.1 | ||
48 | |||
49 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The 'throttle' block driver implements .bdrv_co_drain_end, so | ||
2 | blockdev-reopen will have to wait for it to complete in the polling | ||
3 | loop at the end of qmp_blockdev_reopen(). This makes AIO_WAIT_WHILE() | ||
4 | release the AioContext lock, which causes a crash if the lock hasn't | ||
5 | correctly been taken. | ||
6 | 1 | ||
7 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
8 | Message-Id: <20220203140534.36522-3-kwolf@redhat.com> | ||
9 | Reviewed-by: Hanna Reitz <hreitz@redhat.com> | ||
10 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | ||
11 | --- | ||
12 | tests/qemu-iotests/245 | 36 +++++++++++++++++++++++++++++++++--- | ||
13 | tests/qemu-iotests/245.out | 4 ++-- | ||
14 | 2 files changed, 35 insertions(+), 5 deletions(-) | ||
15 | |||
16 | diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 | ||
17 | index XXXXXXX..XXXXXXX 100755 | ||
18 | --- a/tests/qemu-iotests/245 | ||
19 | +++ b/tests/qemu-iotests/245 | ||
20 | @@ -XXX,XX +XXX,XX @@ class TestBlockdevReopen(iotests.QMPTestCase): | ||
21 | self.assertEqual(self.get_node('hd1'), None) | ||
22 | self.assert_qmp(self.get_node('hd2'), 'ro', True) | ||
23 | |||
24 | - def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None): | ||
25 | - opts = hd_opts(0) | ||
26 | + def run_test_iothreads(self, iothread_a, iothread_b, errmsg = None, | ||
27 | + opts_a = None, opts_b = None): | ||
28 | + opts = opts_a or hd_opts(0) | ||
29 | result = self.vm.qmp('blockdev-add', conv_keys = False, **opts) | ||
30 | self.assert_qmp(result, 'return', {}) | ||
31 | |||
32 | - opts2 = hd_opts(2) | ||
33 | + opts2 = opts_b or hd_opts(2) | ||
34 | result = self.vm.qmp('blockdev-add', conv_keys = False, **opts2) | ||
35 | self.assert_qmp(result, 'return', {}) | ||
36 | |||
37 | @@ -XXX,XX +XXX,XX @@ class TestBlockdevReopen(iotests.QMPTestCase): | ||
38 | def test_iothreads_switch_overlay(self): | ||
39 | self.run_test_iothreads('', 'iothread0') | ||
40 | |||
41 | + def test_iothreads_with_throttling(self): | ||
42 | + # Create a throttle-group object | ||
43 | + opts = { 'qom-type': 'throttle-group', 'id': 'group0', | ||
44 | + 'limits': { 'iops-total': 1000 } } | ||
45 | + result = self.vm.qmp('object-add', conv_keys = False, **opts) | ||
46 | + self.assert_qmp(result, 'return', {}) | ||
47 | + | ||
48 | + # Options with a throttle filter between format and protocol | ||
49 | + opts = [ | ||
50 | + { | ||
51 | + 'driver': iotests.imgfmt, | ||
52 | + 'node-name': f'hd{idx}', | ||
53 | + 'file' : { | ||
54 | + 'node-name': f'hd{idx}-throttle', | ||
55 | + 'driver': 'throttle', | ||
56 | + 'throttle-group': 'group0', | ||
57 | + 'file': { | ||
58 | + 'driver': 'file', | ||
59 | + 'node-name': f'hd{idx}-file', | ||
60 | + 'filename': hd_path[idx], | ||
61 | + }, | ||
62 | + }, | ||
63 | + } | ||
64 | + for idx in (0, 2) | ||
65 | + ] | ||
66 | + | ||
67 | + self.run_test_iothreads('iothread0', 'iothread0', None, | ||
68 | + opts[0], opts[1]) | ||
69 | + | ||
70 | if __name__ == '__main__': | ||
71 | iotests.activate_logging() | ||
72 | iotests.main(supported_fmts=["qcow2"], | ||
73 | diff --git a/tests/qemu-iotests/245.out b/tests/qemu-iotests/245.out | ||
74 | index XXXXXXX..XXXXXXX 100644 | ||
75 | --- a/tests/qemu-iotests/245.out | ||
76 | +++ b/tests/qemu-iotests/245.out | ||
77 | @@ -XXX,XX +XXX,XX @@ read 1/1 bytes at offset 262152 | ||
78 | read 1/1 bytes at offset 262160 | ||
79 | 1 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) | ||
80 | |||
81 | -............... | ||
82 | +................ | ||
83 | ---------------------------------------------------------------------- | ||
84 | -Ran 25 tests | ||
85 | +Ran 26 tests | ||
86 | |||
87 | OK | ||
88 | -- | ||
89 | 2.34.1 | ||
90 | |||
91 | diff view generated by jsdifflib |
1 | From: Bernhard Beschow <shentey@gmail.com> | 1 | From: Emanuele Giuseppe Esposito <eesposit@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Other ISA devices such as serial-isa use the properties in their | 3 | FreeBSD implements pthread headers using TSA (thread safety analysis) |
4 | build_aml functions. fdc-isa not using them is probably an oversight. | 4 | annotations, therefore when an application is compiled with |
5 | -Wthread-safety there are some locking/annotation requirements that the | ||
6 | user of the pthread API has to follow. | ||
5 | 7 | ||
6 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | 8 | This will also be the case in QEMU, since util/qemu-thread-posix.c uses |
7 | Message-Id: <20220209191558.30393-1-shentey@gmail.com> | 9 | the pthread API. Therefore when building it with -Wthread-safety, the |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 10 | compiler will throw warnings because the functions are not properly |
11 | annotated. We need TSA to be enabled because it ensures that the | ||
12 | critical sections of an annotated variable are properly locked. | ||
13 | |||
14 | In order to make the compiler happy and avoid adding all the necessary | ||
15 | macros to all callers (lock functions should use TSA_ACQUIRE, while | ||
16 | unlock TSA_RELEASE, and this applies to all users of pthread_mutex_lock | ||
17 | and pthread_mutex_unlock), simply use TSA_NO_TSA to supppress such | ||
18 | warnings. | ||
19 | |||
20 | Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> | ||
21 | Message-Id: <20230117135203.3049709-2-eesposit@redhat.com> | ||
22 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
9 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> | 23 | Signed-off-by: Kevin Wolf <kwolf@redhat.com> |
10 | --- | 24 | --- |
11 | hw/block/fdc-isa.c | 11 +++++++---- | 25 | include/qemu/thread.h | 14 +++++++++----- |
12 | 1 file changed, 7 insertions(+), 4 deletions(-) | 26 | util/qemu-thread-posix.c | 2 +- |
27 | 2 files changed, 10 insertions(+), 6 deletions(-) | ||
13 | 28 | ||
14 | diff --git a/hw/block/fdc-isa.c b/hw/block/fdc-isa.c | 29 | diff --git a/include/qemu/thread.h b/include/qemu/thread.h |
15 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/block/fdc-isa.c | 31 | --- a/include/qemu/thread.h |
17 | +++ b/hw/block/fdc-isa.c | 32 | +++ b/include/qemu/thread.h |
18 | @@ -XXX,XX +XXX,XX @@ int cmos_get_fd_drive_type(FloppyDriveType fd0) | 33 | @@ -XXX,XX +XXX,XX @@ |
19 | 34 | ||
20 | static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope) | 35 | #include "qemu/processor.h" |
36 | #include "qemu/atomic.h" | ||
37 | +#include "qemu/clang-tsa.h" | ||
38 | |||
39 | typedef struct QemuCond QemuCond; | ||
40 | typedef struct QemuSemaphore QemuSemaphore; | ||
41 | @@ -XXX,XX +XXX,XX @@ typedef struct QemuThread QemuThread; | ||
42 | |||
43 | void qemu_mutex_init(QemuMutex *mutex); | ||
44 | void qemu_mutex_destroy(QemuMutex *mutex); | ||
45 | -int qemu_mutex_trylock_impl(QemuMutex *mutex, const char *file, const int line); | ||
46 | -void qemu_mutex_lock_impl(QemuMutex *mutex, const char *file, const int line); | ||
47 | -void qemu_mutex_unlock_impl(QemuMutex *mutex, const char *file, const int line); | ||
48 | +int TSA_NO_TSA qemu_mutex_trylock_impl(QemuMutex *mutex, const char *file, | ||
49 | + const int line); | ||
50 | +void TSA_NO_TSA qemu_mutex_lock_impl(QemuMutex *mutex, const char *file, | ||
51 | + const int line); | ||
52 | +void TSA_NO_TSA qemu_mutex_unlock_impl(QemuMutex *mutex, const char *file, | ||
53 | + const int line); | ||
54 | |||
55 | void qemu_rec_mutex_init(QemuRecMutex *mutex); | ||
56 | void qemu_rec_mutex_destroy(QemuRecMutex *mutex); | ||
57 | @@ -XXX,XX +XXX,XX @@ void qemu_cond_destroy(QemuCond *cond); | ||
58 | */ | ||
59 | void qemu_cond_signal(QemuCond *cond); | ||
60 | void qemu_cond_broadcast(QemuCond *cond); | ||
61 | -void qemu_cond_wait_impl(QemuCond *cond, QemuMutex *mutex, | ||
62 | - const char *file, const int line); | ||
63 | +void TSA_NO_TSA qemu_cond_wait_impl(QemuCond *cond, QemuMutex *mutex, | ||
64 | + const char *file, const int line); | ||
65 | bool qemu_cond_timedwait_impl(QemuCond *cond, QemuMutex *mutex, int ms, | ||
66 | const char *file, const int line); | ||
67 | |||
68 | diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c | ||
69 | index XXXXXXX..XXXXXXX 100644 | ||
70 | --- a/util/qemu-thread-posix.c | ||
71 | +++ b/util/qemu-thread-posix.c | ||
72 | @@ -XXX,XX +XXX,XX @@ void qemu_cond_wait_impl(QemuCond *cond, QemuMutex *mutex, const char *file, con | ||
73 | error_exit(err, __func__); | ||
74 | } | ||
75 | |||
76 | -static bool | ||
77 | +static bool TSA_NO_TSA | ||
78 | qemu_cond_timedwait_ts(QemuCond *cond, QemuMutex *mutex, struct timespec *ts, | ||
79 | const char *file, const int line) | ||
21 | { | 80 | { |
22 | + FDCtrlISABus *isa = ISA_FDC(isadev); | ||
23 | Aml *dev; | ||
24 | Aml *crs; | ||
25 | int i; | ||
26 | @@ -XXX,XX +XXX,XX @@ static void fdc_isa_build_aml(ISADevice *isadev, Aml *scope) | ||
27 | }; | ||
28 | |||
29 | crs = aml_resource_template(); | ||
30 | - aml_append(crs, aml_io(AML_DECODE16, 0x03F2, 0x03F2, 0x00, 0x04)); | ||
31 | - aml_append(crs, aml_io(AML_DECODE16, 0x03F7, 0x03F7, 0x00, 0x01)); | ||
32 | - aml_append(crs, aml_irq_no_flags(6)); | ||
33 | aml_append(crs, | ||
34 | - aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, 2)); | ||
35 | + aml_io(AML_DECODE16, isa->iobase + 2, isa->iobase + 2, 0x00, 0x04)); | ||
36 | + aml_append(crs, | ||
37 | + aml_io(AML_DECODE16, isa->iobase + 7, isa->iobase + 7, 0x00, 0x01)); | ||
38 | + aml_append(crs, aml_irq_no_flags(isa->irq)); | ||
39 | + aml_append(crs, | ||
40 | + aml_dma(AML_COMPATIBILITY, AML_NOTBUSMASTER, AML_TRANSFER8, isa->dma)); | ||
41 | |||
42 | dev = aml_device("FDC0"); | ||
43 | aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0700"))); | ||
44 | -- | 81 | -- |
45 | 2.34.1 | 82 | 2.39.2 |
46 | |||
47 | diff view generated by jsdifflib |