Skip to content

Commit 6c9ae1c

Browse files
committed
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
Block layer patches - virtio-blk: use blk_io_plug_call() instead of notification BH - mirror: allow switching from background to active mode - qemu-img rebase: add compression support - Fix locking in media change monitor commands - Fix a few blockjob-related deadlocks when using iothread # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmVBTkERHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9ZiqRAAqvsWbblmEGJ7TBKYQK3f8QshJ66RxzbC # 4eSjKHrciWNTeeIeU8r8OvFcPPoTcPXxpcmasD2gsAxG5W5N8vkPbBkW+YT4YdDJ # pWJXrbJ15nILC4DmnR1ARVtvxKgv9zy5LSm5bjss1K+OSYJl/nx+ILjmfVZnYDF7 # z1dP/G0JxKKm4JzAIdBE3uZS+6Q5kx/wGYlJv8EQmlH3DYfsJfy6Lthe9jfw8ijg # lSqLoQ+D0lEd6Bk4XbkUqqBxFcYBWTfU6qPZoyIO94zCTwTG9yIjmoivxmmfwQZq # cJUTGGZjcxpJYnvcC6P13WgcWBtcD9L2kYFVH0JyjpwcSg9cCGHMF66n9pSlyEGq # DUikwVzbTwOotwzYQyM88v4ET+2+Qdcwn8pRbv9PllEczh0kAsUAEuxSgtz4NEcN # bZrap/16xHFybNOKkMZcmpqxspT5NXKbDODUP0IvbSYMOYpWS983nBTxwMRpyHog # 2TFDZu4DjNiPkI2BcYM5VOKk6diNowZFShcEKvoaOLX/n9EBhP0tjoH9VUn1800F # myHrhF2jpIf9GhErMWB7N2W3/0aK0pqdQgbpVnd1ARDdIdYkr7G/S+50D9K80b6n # 0q2E7br4S5bcsY0HQzBL9YARSayY+lVOssLoolCWEsYzijdBQmAvs5THajFKcism # /idI6nlp2Vs= # =RdxS # -----END PGP SIGNATURE----- # gpg: Signature made Wed 01 Nov 2023 03:58:09 JST # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * tag 'for-upstream' of https://repo.or.cz/qemu/kevin: (27 commits) iotests: add test for changing mirror's copy_mode mirror: return mirror-specific information upon query blockjob: query driver-specific info via a new 'query' driver method qapi/block-core: turn BlockJobInfo into a union qapi/block-core: use JobType for BlockJobInfo's type mirror: implement mirror_change method block/mirror: determine copy_to_target only once block/mirror: move dirty bitmap to filter block/mirror: set actively_synced even after the job is ready blockjob: introduce block-job-change QMP command virtio-blk: remove batch notification BH virtio: use defer_call() in virtio_irqfd_notify() util/defer-call: move defer_call() to util/ block: rename blk_io_plug_call() API to defer_call() blockdev: mirror: avoid potential deadlock when using iothread block: avoid potential deadlock during bdrv_graph_wrlock() in bdrv_close() blockjob: drop AioContext lock before calling bdrv_graph_wrlock() iotests: Test media change with iothreads block: Fix locking in media change monitor commands iotests: add tests for "qemu-img rebase" with compression ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 parents 997ef29 + 900e7d4 commit 6c9ae1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1437
-331
lines changed

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2755,12 +2755,13 @@ S: Supported
27552755
F: util/async.c
27562756
F: util/aio-*.c
27572757
F: util/aio-*.h
2758+
F: util/defer-call.c
27582759
F: util/fdmon-*.c
27592760
F: block/io.c
2760-
F: block/plug.c
27612761
F: migration/block*
27622762
F: include/block/aio.h
27632763
F: include/block/aio-wait.h
2764+
F: include/qemu/defer-call.h
27642765
F: scripts/qemugdb/aio.py
27652766
F: tests/unit/test-fdmon-epoll.c
27662767
T: git https://github.com/stefanha/qemu.git block

block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5200,7 +5200,7 @@ static void bdrv_close(BlockDriverState *bs)
52005200
bs->drv = NULL;
52015201
}
52025202

5203-
bdrv_graph_wrlock(NULL);
5203+
bdrv_graph_wrlock(bs);
52045204
QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
52055205
bdrv_unref_child(bs, child);
52065206
}

block/blkio.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "block/block_int.h"
1414
#include "exec/memory.h"
1515
#include "exec/cpu-common.h" /* for qemu_ram_get_fd() */
16+
#include "qemu/defer-call.h"
1617
#include "qapi/error.h"
1718
#include "qemu/error-report.h"
1819
#include "qapi/qmp/qdict.h"
@@ -312,10 +313,10 @@ static void blkio_detach_aio_context(BlockDriverState *bs)
312313
}
313314

314315
/*
315-
* Called by blk_io_unplug() or immediately if not plugged. Called without
316-
* blkio_lock.
316+
* Called by defer_call_end() or immediately if not in a deferred section.
317+
* Called without blkio_lock.
317318
*/
318-
static void blkio_unplug_fn(void *opaque)
319+
static void blkio_deferred_fn(void *opaque)
319320
{
320321
BDRVBlkioState *s = opaque;
321322

@@ -332,7 +333,7 @@ static void blkio_submit_io(BlockDriverState *bs)
332333
{
333334
BDRVBlkioState *s = bs->opaque;
334335

335-
blk_io_plug_call(blkio_unplug_fn, s);
336+
defer_call(blkio_deferred_fn, s);
336337
}
337338

338339
static int coroutine_fn

block/io_uring.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "block/block.h"
1616
#include "block/raw-aio.h"
1717
#include "qemu/coroutine.h"
18+
#include "qemu/defer-call.h"
1819
#include "qapi/error.h"
1920
#include "sysemu/block-backend.h"
2021
#include "trace.h"
@@ -124,6 +125,9 @@ static void luring_process_completions(LuringState *s)
124125
{
125126
struct io_uring_cqe *cqes;
126127
int total_bytes;
128+
129+
defer_call_begin();
130+
127131
/*
128132
* Request completion callbacks can run the nested event loop.
129133
* Schedule ourselves so the nested event loop will "see" remaining
@@ -216,7 +220,10 @@ static void luring_process_completions(LuringState *s)
216220
aio_co_wake(luringcb->co);
217221
}
218222
}
223+
219224
qemu_bh_cancel(s->completion_bh);
225+
226+
defer_call_end();
220227
}
221228

222229
static int ioq_submit(LuringState *s)
@@ -306,7 +313,7 @@ static void ioq_init(LuringQueue *io_q)
306313
io_q->blocked = false;
307314
}
308315

309-
static void luring_unplug_fn(void *opaque)
316+
static void luring_deferred_fn(void *opaque)
310317
{
311318
LuringState *s = opaque;
312319
trace_luring_unplug_fn(s, s->io_q.blocked, s->io_q.in_queue,
@@ -367,7 +374,7 @@ static int luring_do_submit(int fd, LuringAIOCB *luringcb, LuringState *s,
367374
return ret;
368375
}
369376

370-
blk_io_plug_call(luring_unplug_fn, s);
377+
defer_call(luring_deferred_fn, s);
371378
}
372379
return 0;
373380
}

block/linux-aio.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "block/raw-aio.h"
1515
#include "qemu/event_notifier.h"
1616
#include "qemu/coroutine.h"
17+
#include "qemu/defer-call.h"
1718
#include "qapi/error.h"
1819
#include "sysemu/block-backend.h"
1920

@@ -204,6 +205,8 @@ static void qemu_laio_process_completions(LinuxAioState *s)
204205
{
205206
struct io_event *events;
206207

208+
defer_call_begin();
209+
207210
/* Reschedule so nested event loops see currently pending completions */
208211
qemu_bh_schedule(s->completion_bh);
209212

@@ -230,6 +233,8 @@ static void qemu_laio_process_completions(LinuxAioState *s)
230233
* own `for` loop. If we are the last all counters dropped to zero. */
231234
s->event_max = 0;
232235
s->event_idx = 0;
236+
237+
defer_call_end();
233238
}
234239

235240
static void qemu_laio_process_completions_and_submit(LinuxAioState *s)
@@ -353,7 +358,7 @@ static uint64_t laio_max_batch(LinuxAioState *s, uint64_t dev_max_batch)
353358
return max_batch;
354359
}
355360

356-
static void laio_unplug_fn(void *opaque)
361+
static void laio_deferred_fn(void *opaque)
357362
{
358363
LinuxAioState *s = opaque;
359364

@@ -393,7 +398,7 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset,
393398
if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch)) {
394399
ioq_submit(s);
395400
} else {
396-
blk_io_plug_call(laio_unplug_fn, s);
401+
defer_call(laio_deferred_fn, s);
397402
}
398403
}
399404

block/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ block_ss.add(files(
2121
'mirror.c',
2222
'nbd.c',
2323
'null.c',
24-
'plug.c',
2524
'preallocate.c',
2625
'progress_meter.c',
2726
'qapi.c',

0 commit comments

Comments
 (0)