1
The following changes since commit 240ab11fb72049d6373cbbec8d788f8e411a00bc:
1
The following changes since commit ca61fa4b803e5d0abaf6f1ceb690f23bb78a4def:
2
2
3
Merge remote-tracking branch 'remotes/aperard/tags/pull-xen-20190924' into staging (2019-09-24 15:36:31 +0100)
3
Merge remote-tracking branch 'remotes/quic/tags/pull-hex-20211006' into staging (2021-10-06 12:11:14 -0700)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://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 f9a7e3698a737ee75a7b0af34203303df982550f:
9
for you to fetch changes up to 1cc7eada97914f090125e588497986f6f7900514:
10
10
11
virtio-blk: schedule virtio_notify_config to run on main context (2019-09-25 18:06:36 +0100)
11
iothread: use IOThreadParamInfo in iothread_[set|get]_param() (2021-10-07 15:29:50 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request
14
Pull request
15
15
16
----------------------------------------------------------------
16
----------------------------------------------------------------
17
17
18
Sergio Lopez (1):
18
Stefano Garzarella (2):
19
virtio-blk: schedule virtio_notify_config to run on main context
19
iothread: rename PollParamInfo to IOThreadParamInfo
20
iothread: use IOThreadParamInfo in iothread_[set|get]_param()
20
21
21
Vladimir Sementsov-Ogievskiy (1):
22
iothread.c | 28 +++++++++++++++-------------
22
util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended
23
1 file changed, 15 insertions(+), 13 deletions(-)
23
24
hw/block/virtio-blk.c | 16 +++++++++++++++-
25
util/iov.c | 3 ++-
26
2 files changed, 17 insertions(+), 2 deletions(-)
27
24
28
--
25
--
29
2.21.0
26
2.31.1
30
27
31
28
29
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
Make it more obvious, that filling qiov corresponds to qiov allocation,
3
Commit 1793ad0247 ("iothread: add aio-max-batch parameter") added
4
which in turn corresponds to total_niov calculation, based on mid_niov
4
a new parameter (aio-max-batch) to IOThread and used PollParamInfo
5
(not mid_len). Still add an assertion to show that there should be no
5
structure to handle it.
6
difference.
7
6
8
Reported-by: Coverity (CID 1405302)
7
Since it is not a parameter of the polling mechanism, we rename the
9
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
8
structure to a more generic IOThreadParamInfo.
10
Message-id: 20190910090310.14032-1-vsementsov@virtuozzo.com
9
11
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
10
Suggested-by: Kevin Wolf <kwolf@redhat.com>
12
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
11
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
13
Message-Id: <20190910090310.14032-1-vsementsov@virtuozzo.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20210727145936.147032-2-sgarzare@redhat.com
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
---
15
---
16
util/iov.c | 3 ++-
16
iothread.c | 14 +++++++-------
17
1 file changed, 2 insertions(+), 1 deletion(-)
17
1 file changed, 7 insertions(+), 7 deletions(-)
18
18
19
diff --git a/util/iov.c b/util/iov.c
19
diff --git a/iothread.c b/iothread.c
20
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
21
--- a/util/iov.c
21
--- a/iothread.c
22
+++ b/util/iov.c
22
+++ b/iothread.c
23
@@ -XXX,XX +XXX,XX @@ void qemu_iovec_init_extended(
23
@@ -XXX,XX +XXX,XX @@ static void iothread_complete(UserCreatable *obj, Error **errp)
24
p++;
24
typedef struct {
25
}
25
const char *name;
26
26
ptrdiff_t offset; /* field's byte offset in IOThread struct */
27
- if (mid_len) {
27
-} PollParamInfo;
28
+ assert(!mid_niov == !mid_len);
28
+} IOThreadParamInfo;
29
+ if (mid_niov) {
29
30
memcpy(p, mid_iov, mid_niov * sizeof(*p));
30
-static PollParamInfo poll_max_ns_info = {
31
p[0].iov_base = (uint8_t *)p[0].iov_base + mid_head;
31
+static IOThreadParamInfo poll_max_ns_info = {
32
p[0].iov_len -= mid_head;
32
"poll-max-ns", offsetof(IOThread, poll_max_ns),
33
};
34
-static PollParamInfo poll_grow_info = {
35
+static IOThreadParamInfo poll_grow_info = {
36
"poll-grow", offsetof(IOThread, poll_grow),
37
};
38
-static PollParamInfo poll_shrink_info = {
39
+static IOThreadParamInfo poll_shrink_info = {
40
"poll-shrink", offsetof(IOThread, poll_shrink),
41
};
42
-static PollParamInfo aio_max_batch_info = {
43
+static IOThreadParamInfo aio_max_batch_info = {
44
"aio-max-batch", offsetof(IOThread, aio_max_batch),
45
};
46
47
@@ -XXX,XX +XXX,XX @@ static void iothread_get_param(Object *obj, Visitor *v,
48
const char *name, void *opaque, Error **errp)
49
{
50
IOThread *iothread = IOTHREAD(obj);
51
- PollParamInfo *info = opaque;
52
+ IOThreadParamInfo *info = opaque;
53
int64_t *field = (void *)iothread + info->offset;
54
55
visit_type_int64(v, name, field, errp);
56
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
57
const char *name, void *opaque, Error **errp)
58
{
59
IOThread *iothread = IOTHREAD(obj);
60
- PollParamInfo *info = opaque;
61
+ IOThreadParamInfo *info = opaque;
62
int64_t *field = (void *)iothread + info->offset;
63
int64_t value;
64
33
--
65
--
34
2.21.0
66
2.31.1
35
67
36
68
diff view generated by jsdifflib
1
From: Sergio Lopez <slp@redhat.com>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
virtio_notify_config() needs to acquire the global mutex, which isn't
3
Commit 0445409d74 ("iothread: generalize
4
allowed from an iothread, and may lead to a deadlock like this:
4
iothread_set_param/iothread_get_param") moved common code to set and
5
get IOThread parameters in two new functions.
5
6
6
- main thead
7
These functions are called inside callbacks, so we don't need to use an
7
* Has acquired: qemu_global_mutex.
8
opaque pointer. Let's replace `void *opaque` parameter with
8
* Is trying the acquire: iothread AioContext lock via
9
`IOThreadParamInfo *info`.
9
AIO_WAIT_WHILE (after aio_poll).
10
10
11
- iothread
11
Suggested-by: Kevin Wolf <kwolf@redhat.com>
12
* Has acquired: AioContext lock.
12
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
13
* Is trying to acquire: qemu_global_mutex (via
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
virtio_notify_config->prepare_mmio_access).
14
Message-id: 20210727145936.147032-3-sgarzare@redhat.com
15
16
If virtio_blk_resize() is called from an iothread, schedule
17
virtio_notify_config() to be run in the main context BH.
18
19
[Removed unnecessary newline as suggested by Kevin Wolf
20
<kwolf@redhat.com>.
21
--Stefan]
22
23
Signed-off-by: Sergio Lopez <slp@redhat.com>
24
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
25
Message-id: 20190916112411.21636-1-slp@redhat.com
26
Message-Id: <20190916112411.21636-1-slp@redhat.com>
27
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
28
---
16
---
29
hw/block/virtio-blk.c | 16 +++++++++++++++-
17
iothread.c | 18 ++++++++++--------
30
1 file changed, 15 insertions(+), 1 deletion(-)
18
1 file changed, 10 insertions(+), 8 deletions(-)
31
19
32
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
20
diff --git a/iothread.c b/iothread.c
33
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/block/virtio-blk.c
22
--- a/iothread.c
35
+++ b/hw/block/virtio-blk.c
23
+++ b/iothread.c
36
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@ static IOThreadParamInfo aio_max_batch_info = {
37
#include "qemu/iov.h"
25
};
38
#include "qemu/module.h"
26
39
#include "qemu/error-report.h"
27
static void iothread_get_param(Object *obj, Visitor *v,
40
+#include "qemu/main-loop.h"
28
- const char *name, void *opaque, Error **errp)
41
#include "trace.h"
29
+ const char *name, IOThreadParamInfo *info, Error **errp)
42
#include "hw/block/block.h"
30
{
43
#include "hw/qdev-properties.h"
31
IOThread *iothread = IOTHREAD(obj);
44
@@ -XXX,XX +XXX,XX @@ static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f,
32
- IOThreadParamInfo *info = opaque;
45
return 0;
33
int64_t *field = (void *)iothread + info->offset;
34
35
visit_type_int64(v, name, field, errp);
46
}
36
}
47
37
48
+static void virtio_resize_cb(void *opaque)
38
static bool iothread_set_param(Object *obj, Visitor *v,
49
+{
39
- const char *name, void *opaque, Error **errp)
50
+ VirtIODevice *vdev = opaque;
40
+ const char *name, IOThreadParamInfo *info, Error **errp)
51
+
52
+ assert(qemu_get_current_aio_context() == qemu_get_aio_context());
53
+ virtio_notify_config(vdev);
54
+}
55
+
56
static void virtio_blk_resize(void *opaque)
57
{
41
{
58
VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
42
IOThread *iothread = IOTHREAD(obj);
59
43
- IOThreadParamInfo *info = opaque;
60
- virtio_notify_config(vdev);
44
int64_t *field = (void *)iothread + info->offset;
61
+ /*
45
int64_t value;
62
+ * virtio_notify_config() needs to acquire the global mutex,
46
63
+ * so it can't be called from an iothread. Instead, schedule
47
@@ -XXX,XX +XXX,XX @@ static bool iothread_set_param(Object *obj, Visitor *v,
64
+ * it to be run in the main context BH.
48
static void iothread_get_poll_param(Object *obj, Visitor *v,
65
+ */
49
const char *name, void *opaque, Error **errp)
66
+ aio_bh_schedule_oneshot(qemu_get_aio_context(), virtio_resize_cb, vdev);
50
{
51
+ IOThreadParamInfo *info = opaque;
52
53
- iothread_get_param(obj, v, name, opaque, errp);
54
+ iothread_get_param(obj, v, name, info, errp);
67
}
55
}
68
56
69
static const BlockDevOps virtio_block_ops = {
57
static void iothread_set_poll_param(Object *obj, Visitor *v,
58
const char *name, void *opaque, Error **errp)
59
{
60
IOThread *iothread = IOTHREAD(obj);
61
+ IOThreadParamInfo *info = opaque;
62
63
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
64
+ if (!iothread_set_param(obj, v, name, info, errp)) {
65
return;
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void iothread_set_poll_param(Object *obj, Visitor *v,
69
static void iothread_get_aio_param(Object *obj, Visitor *v,
70
const char *name, void *opaque, Error **errp)
71
{
72
+ IOThreadParamInfo *info = opaque;
73
74
- iothread_get_param(obj, v, name, opaque, errp);
75
+ iothread_get_param(obj, v, name, info, errp);
76
}
77
78
static void iothread_set_aio_param(Object *obj, Visitor *v,
79
const char *name, void *opaque, Error **errp)
80
{
81
IOThread *iothread = IOTHREAD(obj);
82
+ IOThreadParamInfo *info = opaque;
83
84
- if (!iothread_set_param(obj, v, name, opaque, errp)) {
85
+ if (!iothread_set_param(obj, v, name, info, errp)) {
86
return;
87
}
88
70
--
89
--
71
2.21.0
90
2.31.1
72
91
73
92
diff view generated by jsdifflib