1
The following changes since commit 8f2d7c341184a95d05476ea3c45dbae2b9ddbe51:
1
The following changes since commit 887cba855bb6ff4775256f7968409281350b568c:
2
2
3
Merge remote-tracking branch 'remotes/berrange/tags/pull-qcrypto-2017-02-27-1' into staging (2017-02-27 15:33:21 +0000)
3
configure: Fix cross-building for RISCV host (v5) (2023-07-11 17:56:09 +0100)
4
4
5
are available in the git repository at:
5
are available in the Git repository at:
6
6
7
https://github.com/codyprime/qemu-kvm-jtc.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 51654aa52a94612edfaf76dcb51c0a0b7821c90d:
9
for you to fetch changes up to 75dcb4d790bbe5327169fd72b185960ca58e2fa6:
10
10
11
iscsi: add missing colons to the qapi docs (2017-02-27 23:33:41 -0500)
11
virtio-blk: fix host notifier issues during dataplane start/stop (2023-07-12 15:20:32 -0400)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Block patches for 2.9
14
Pull request
15
15
----------------------------------------------------------------
16
----------------------------------------------------------------
16
17
17
Jeff Cody (1):
18
Stefan Hajnoczi (1):
18
iscsi: add missing colons to the qapi docs
19
virtio-blk: fix host notifier issues during dataplane start/stop
19
20
20
John Snow (1):
21
hw/block/dataplane/virtio-blk.c | 67 +++++++++++++++++++--------------
21
block/mirror: fix broken sparseness detection
22
1 file changed, 38 insertions(+), 29 deletions(-)
22
23
block/mirror.c | 2 +-
24
qapi/block-core.json | 18 +++++++++---------
25
2 files changed, 10 insertions(+), 10 deletions(-)
26
23
27
--
24
--
28
2.9.3
25
2.40.1
29
30
diff view generated by jsdifflib
Deleted patch
1
From: John Snow <jsnow@redhat.com>
2
1
3
int64_t is in all likelihood the actual scalar type we want.
4
Yep, really.
5
6
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1219541
7
8
Signed-off-by: John Snow <jsnow@redhat.com>
9
Reviewed-by: Jeff Cody <jcody@redhat.com>
10
Signed-off-by: Jeff Cody <jcody@redhat.com>
11
---
12
block/mirror.c | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
14
15
diff --git a/block/mirror.c b/block/mirror.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/block/mirror.c
18
+++ b/block/mirror.c
19
@@ -XXX,XX +XXX,XX @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
20
nb_chunks * sectors_per_chunk);
21
bitmap_set(s->in_flight_bitmap, sector_num / sectors_per_chunk, nb_chunks);
22
while (nb_chunks > 0 && sector_num < end) {
23
- int ret;
24
+ int64_t ret;
25
int io_sectors, io_sectors_acct;
26
BlockDriverState *file;
27
enum MirrorMethod {
28
--
29
2.9.3
30
31
diff view generated by jsdifflib
1
The missing colons make the iscsi part of the documentation not render
1
The main loop thread can consume 100% CPU when using --device
2
quite as nicely, so add those in.
2
virtio-blk-pci,iothread=<iothread>. ppoll() constantly returns but
3
reading virtqueue host notifiers fails with EAGAIN. The file descriptors
4
are stale and remain registered with the AioContext because of bugs in
5
the virtio-blk dataplane start/stop code.
3
6
4
Signed-off-by: Jeff Cody <jcody@redhat.com>
7
The problem is that the dataplane start/stop code involves drain
8
operations, which call virtio_blk_drained_begin() and
9
virtio_blk_drained_end() at points where the host notifier is not
10
operational:
11
- In virtio_blk_data_plane_start(), blk_set_aio_context() drains after
12
vblk->dataplane_started has been set to true but the host notifier has
13
not been attached yet.
14
- In virtio_blk_data_plane_stop(), blk_drain() and blk_set_aio_context()
15
drain after the host notifier has already been detached but with
16
vblk->dataplane_started still set to true.
17
18
I would like to simplify ->ioeventfd_start/stop() to avoid interactions
19
with drain entirely, but couldn't find a way to do that. Instead, this
20
patch accepts the fragile nature of the code and reorders it so that
21
vblk->dataplane_started is false during drain operations. This way the
22
virtio_blk_drained_begin() and virtio_blk_drained_end() calls don't
23
touch the host notifier. The result is that
24
virtio_blk_data_plane_start() and virtio_blk_data_plane_stop() have
25
complete control over the host notifier and stale file descriptors are
26
no longer left in the AioContext.
27
28
This patch fixes the 100% CPU consumption in the main loop thread and
29
correctly moves host notifier processing to the IOThread.
30
31
Fixes: 1665d9326fd2 ("virtio-blk: implement BlockDevOps->drained_begin()")
32
Reported-by: Lukáš Doktor <ldoktor@redhat.com>
33
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
34
Tested-by: Lukas Doktor <ldoktor@redhat.com>
35
Message-id: 20230704151527.193586-1-stefanha@redhat.com
36
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
5
---
37
---
6
qapi/block-core.json | 18 +++++++++---------
38
hw/block/dataplane/virtio-blk.c | 67 +++++++++++++++++++--------------
7
1 file changed, 9 insertions(+), 9 deletions(-)
39
1 file changed, 38 insertions(+), 29 deletions(-)
8
40
9
diff --git a/qapi/block-core.json b/qapi/block-core.json
41
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
10
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
11
--- a/qapi/block-core.json
43
--- a/hw/block/dataplane/virtio-blk.c
12
+++ b/qapi/block-core.json
44
+++ b/hw/block/dataplane/virtio-blk.c
13
@@ -XXX,XX +XXX,XX @@
45
@@ -XXX,XX +XXX,XX @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
14
##
46
15
# @BlockdevOptionsIscsi:
47
memory_region_transaction_commit();
16
#
48
17
-# @transport The iscsi transport type
49
- /*
18
+# @transport: The iscsi transport type
50
- * These fields are visible to the IOThread so we rely on implicit barriers
19
#
51
- * in aio_context_acquire() on the write side and aio_notify_accept() on
20
-# @portal The address of the iscsi portal
52
- * the read side.
21
+# @portal: The address of the iscsi portal
53
- */
22
#
54
- s->starting = false;
23
-# @target The target iqn name
55
- vblk->dataplane_started = true;
24
+# @target: The target iqn name
56
trace_virtio_blk_data_plane_start(s);
25
#
57
26
-# @lun #optional LUN to connect to. Defaults to 0.
58
old_context = blk_get_aio_context(s->conf->conf.blk);
27
+# @lun: #optional LUN to connect to. Defaults to 0.
59
@@ -XXX,XX +XXX,XX @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
28
#
60
event_notifier_set(virtio_queue_get_host_notifier(vq));
29
-# @user #optional User name to log in with. If omitted, no CHAP
61
}
30
+# @user: #optional User name to log in with. If omitted, no CHAP
62
31
# authentication is performed.
63
+ /*
32
#
64
+ * These fields must be visible to the IOThread when it processes the
33
-# @password-secret #optional The ID of a QCryptoSecret object providing
65
+ * virtqueue, otherwise it will think dataplane has not started yet.
34
+# @password-secret: #optional The ID of a QCryptoSecret object providing
66
+ *
35
# the password for the login. This option is required if
67
+ * Make sure ->dataplane_started is false when blk_set_aio_context() is
36
# @user is specified.
68
+ * called above so that draining does not cause the host notifier to be
37
#
69
+ * detached/attached prematurely.
38
-# @initiator-name #optional The iqn name we want to identify to the target
70
+ */
39
+# @initiator-name: #optional The iqn name we want to identify to the target
71
+ s->starting = false;
40
# as. If this option is not specified, an initiator name is
72
+ vblk->dataplane_started = true;
41
# generated automatically.
73
+ smp_wmb(); /* paired with aio_notify_accept() on the read side */
42
#
74
+
43
-# @header-digest #optional The desired header digest. Defaults to
75
/* Get this show started by hooking up our callbacks */
44
+# @header-digest: #optional The desired header digest. Defaults to
76
if (!blk_in_drain(s->conf->conf.blk)) {
45
# none-crc32c.
77
aio_context_acquire(s->ctx);
46
#
78
@@ -XXX,XX +XXX,XX @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
47
-# @timeout #optional Timeout in seconds after which a request will
79
fail_guest_notifiers:
48
+# @timeout: #optional Timeout in seconds after which a request will
80
vblk->dataplane_disabled = true;
49
# timeout. 0 means no timeout and is the default.
81
s->starting = false;
50
#
82
- vblk->dataplane_started = true;
51
# Driver specific block device options for iscsi
83
return -ENOSYS;
84
}
85
86
@@ -XXX,XX +XXX,XX @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev)
87
aio_wait_bh_oneshot(s->ctx, virtio_blk_data_plane_stop_bh, s);
88
}
89
90
+ /*
91
+ * Batch all the host notifiers in a single transaction to avoid
92
+ * quadratic time complexity in address_space_update_ioeventfds().
93
+ */
94
+ memory_region_transaction_begin();
95
+
96
+ for (i = 0; i < nvqs; i++) {
97
+ virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
98
+ }
99
+
100
+ /*
101
+ * The transaction expects the ioeventfds to be open when it
102
+ * commits. Do it now, before the cleanup loop.
103
+ */
104
+ memory_region_transaction_commit();
105
+
106
+ for (i = 0; i < nvqs; i++) {
107
+ virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
108
+ }
109
+
110
+ /*
111
+ * Set ->dataplane_started to false before draining so that host notifiers
112
+ * are not detached/attached anymore.
113
+ */
114
+ vblk->dataplane_started = false;
115
+
116
aio_context_acquire(s->ctx);
117
118
/* Wait for virtio_blk_dma_restart_bh() and in flight I/O to complete */
119
@@ -XXX,XX +XXX,XX @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev)
120
121
aio_context_release(s->ctx);
122
123
- /*
124
- * Batch all the host notifiers in a single transaction to avoid
125
- * quadratic time complexity in address_space_update_ioeventfds().
126
- */
127
- memory_region_transaction_begin();
128
-
129
- for (i = 0; i < nvqs; i++) {
130
- virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
131
- }
132
-
133
- /*
134
- * The transaction expects the ioeventfds to be open when it
135
- * commits. Do it now, before the cleanup loop.
136
- */
137
- memory_region_transaction_commit();
138
-
139
- for (i = 0; i < nvqs; i++) {
140
- virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), i);
141
- }
142
-
143
qemu_bh_cancel(s->bh);
144
notify_guest_bh(s); /* final chance to notify guest */
145
146
/* Clean up guest notifier (irq) */
147
k->set_guest_notifiers(qbus->parent, nvqs, false);
148
149
- vblk->dataplane_started = false;
150
s->stopping = false;
151
}
52
--
152
--
53
2.9.3
153
2.40.1
54
154
55
155
diff view generated by jsdifflib