1
The following changes since commit 711c0418c8c1ce3a24346f058b001c4c5a2f0f81:
1
The following changes since commit 9af638cc1f665712522608c5d6b8c03d8fa67666:
2
2
3
Merge remote-tracking branch 'remotes/philmd/tags/mips-20210702' into staging (2021-07-04 14:04:12 +0100)
3
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200504' into staging (2020-05-04 13:37:17 +0100)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://gitlab.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 9f460c64e13897117f35ffb61f6f5e0102cabc70:
9
for you to fetch changes up to 08b689aa6b521964b8275dd7a2564aefa5d68129:
10
10
11
block/io: Merge discard request alignments (2021-07-06 14:28:55 +0100)
11
lockable: Replace locks with lock guard macros (2020-05-04 16:07:43 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request
14
Pull request
15
15
16
v2:
17
* Fixed stray slirp submodule change [Peter]
18
19
Fixes for the lock guard macros, code conversions to the lock guard macros, and
20
support for selecting fuzzer targets with argv[0].
21
16
----------------------------------------------------------------
22
----------------------------------------------------------------
17
23
18
Akihiko Odaki (3):
24
Alexander Bulekov (1):
19
block/file-posix: Optimize for macOS
25
fuzz: select fuzz target using executable name
20
block: Add backend_defaults property
21
block/io: Merge discard request alignments
22
26
23
Stefan Hajnoczi (2):
27
Daniel Brodsky (2):
24
util/async: add a human-readable name to BHs for debugging
28
lockable: fix __COUNTER__ macro to be referenced properly
25
util/async: print leaked BH name when AioContext finalizes
29
lockable: replaced locks with lock guard macros where appropriate
26
30
27
include/block/aio.h | 31 ++++++++++++++++++++++---
31
Simran Singhal (1):
28
include/hw/block/block.h | 3 +++
32
lockable: Replace locks with lock guard macros
29
include/qemu/main-loop.h | 4 +++-
33
30
block/file-posix.c | 27 ++++++++++++++++++++--
34
include/qemu/lockable.h | 7 +++---
31
block/io.c | 2 ++
35
include/qemu/rcu.h | 2 +-
32
hw/block/block.c | 42 ++++++++++++++++++++++++++++++----
36
block/iscsi.c | 7 ++----
33
tests/unit/ptimer-test-stubs.c | 2 +-
37
block/nfs.c | 51 +++++++++++++++++++----------------------
34
util/async.c | 25 ++++++++++++++++----
38
cpus-common.c | 14 ++++-------
35
util/main-loop.c | 4 ++--
39
hw/display/qxl.c | 43 ++++++++++++++++------------------
36
tests/qemu-iotests/172.out | 38 ++++++++++++++++++++++++++++++
40
hw/hyperv/hyperv.c | 15 ++++++------
37
10 files changed, 161 insertions(+), 17 deletions(-)
41
hw/rdma/rdma_backend.c | 50 ++++++++++++++++++++--------------------
42
hw/rdma/rdma_rm.c | 3 +--
43
hw/vfio/platform.c | 5 ++--
44
migration/migration.c | 3 +--
45
migration/multifd.c | 8 +++----
46
migration/ram.c | 3 +--
47
monitor/misc.c | 4 +---
48
tests/qtest/fuzz/fuzz.c | 19 ++++++++-------
49
ui/spice-display.c | 14 +++++------
50
util/log.c | 4 ++--
51
util/qemu-timer.c | 17 +++++++-------
52
util/rcu.c | 8 +++----
53
util/thread-pool.c | 3 +--
54
util/vfio-helpers.c | 5 ++--
55
21 files changed, 132 insertions(+), 153 deletions(-)
38
56
39
--
57
--
40
2.31.1
58
2.25.3
41
59
diff view generated by jsdifflib
1
It can be difficult to debug issues with BHs in production environments.
1
From: Alexander Bulekov <alxndr@bu.edu>
2
Although BHs can usually be identified by looking up their ->cb()
3
function pointer, this requires debug information for the program. It is
4
also not possible to print human-readable diagnostics about BHs because
5
they have no identifier.
6
2
7
This patch adds a name to each BH. The name is not unique per instance
3
The fuzzers are built into a binary (e.g. qemu-fuzz-i386). To select the
8
but differentiates between cb() functions, which is usually enough. It's
4
device to fuzz/fuzz target, we usually use the --fuzz-target= argument.
9
done by changing aio_bh_new() and friends to macros that stringify cb.
5
This commit allows the fuzz-target to be specified using the name of the
6
executable. If the executable name ends with -target-FUZZ_TARGET, then
7
we select the fuzz target based on this name, rather than the
8
--fuzz-target argument. This is useful for systems such as oss-fuzz
9
where we don't have control of the arguments passed to the fuzzer.
10
10
11
The next patch will use the name field when reporting leaked BHs.
11
[Fixed incorrect indentation.
12
--Stefan]
12
13
14
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
15
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
16
Message-id: 20200421182230.6313-1-alxndr@bu.edu
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Message-Id: <20210414200247.917496-2-stefanha@redhat.com>
16
---
18
---
17
include/block/aio.h | 31 ++++++++++++++++++++++++++++---
19
tests/qtest/fuzz/fuzz.c | 19 +++++++++++--------
18
include/qemu/main-loop.h | 4 +++-
20
1 file changed, 11 insertions(+), 8 deletions(-)
19
tests/unit/ptimer-test-stubs.c | 2 +-
20
util/async.c | 9 +++++++--
21
util/main-loop.c | 4 ++--
22
5 files changed, 41 insertions(+), 9 deletions(-)
23
21
24
diff --git a/include/block/aio.h b/include/block/aio.h
22
diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
25
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
26
--- a/include/block/aio.h
24
--- a/tests/qtest/fuzz/fuzz.c
27
+++ b/include/block/aio.h
25
+++ b/tests/qtest/fuzz/fuzz.c
28
@@ -XXX,XX +XXX,XX @@ void aio_context_acquire(AioContext *ctx);
26
@@ -XXX,XX +XXX,XX @@ static void usage(char *path)
29
/* Relinquish ownership of the AioContext. */
27
printf(" * %s : %s\n", tmp->target->name,
30
void aio_context_release(AioContext *ctx);
28
tmp->target->description);
31
29
}
32
+/**
30
+ printf("Alternatively, add -target-FUZZ_TARGET to the executable name\n");
33
+ * aio_bh_schedule_oneshot_full: Allocate a new bottom half structure that will
31
exit(0);
34
+ * run only once and as soon as possible.
35
+ *
36
+ * @name: A human-readable identifier for debugging purposes.
37
+ */
38
+void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
39
+ const char *name);
40
+
41
/**
42
* aio_bh_schedule_oneshot: Allocate a new bottom half structure that will run
43
* only once and as soon as possible.
44
+ *
45
+ * A convenience wrapper for aio_bh_schedule_oneshot_full() that uses cb as the
46
+ * name string.
47
*/
48
-void aio_bh_schedule_oneshot(AioContext *ctx, QEMUBHFunc *cb, void *opaque);
49
+#define aio_bh_schedule_oneshot(ctx, cb, opaque) \
50
+ aio_bh_schedule_oneshot_full((ctx), (cb), (opaque), (stringify(cb)))
51
52
/**
53
- * aio_bh_new: Allocate a new bottom half structure.
54
+ * aio_bh_new_full: Allocate a new bottom half structure.
55
*
56
* Bottom halves are lightweight callbacks whose invocation is guaranteed
57
* to be wait-free, thread-safe and signal-safe. The #QEMUBH structure
58
* is opaque and must be allocated prior to its use.
59
+ *
60
+ * @name: A human-readable identifier for debugging purposes.
61
*/
62
-QEMUBH *aio_bh_new(AioContext *ctx, QEMUBHFunc *cb, void *opaque);
63
+QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
64
+ const char *name);
65
+
66
+/**
67
+ * aio_bh_new: Allocate a new bottom half structure
68
+ *
69
+ * A convenience wrapper for aio_bh_new_full() that uses the cb as the name
70
+ * string.
71
+ */
72
+#define aio_bh_new(ctx, cb, opaque) \
73
+ aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)))
74
75
/**
76
* aio_notify: Force processing of pending events.
77
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
78
index XXXXXXX..XXXXXXX 100644
79
--- a/include/qemu/main-loop.h
80
+++ b/include/qemu/main-loop.h
81
@@ -XXX,XX +XXX,XX @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms);
82
83
void qemu_fd_register(int fd);
84
85
-QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
86
+#define qemu_bh_new(cb, opaque) \
87
+ qemu_bh_new_full((cb), (opaque), (stringify(cb)))
88
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name);
89
void qemu_bh_schedule_idle(QEMUBH *bh);
90
91
enum {
92
diff --git a/tests/unit/ptimer-test-stubs.c b/tests/unit/ptimer-test-stubs.c
93
index XXXXXXX..XXXXXXX 100644
94
--- a/tests/unit/ptimer-test-stubs.c
95
+++ b/tests/unit/ptimer-test-stubs.c
96
@@ -XXX,XX +XXX,XX @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
97
return deadline;
98
}
32
}
99
33
100
-QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
34
@@ -XXX,XX +XXX,XX @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
101
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
35
module_call_init(MODULE_INIT_QOM);
102
{
36
module_call_init(MODULE_INIT_LIBQOS);
103
QEMUBH *bh = g_new(QEMUBH, 1);
37
104
38
- if (*argc <= 1) {
105
diff --git a/util/async.c b/util/async.c
39
+ target_name = strstr(**argv, "-target-");
106
index XXXXXXX..XXXXXXX 100644
40
+ if (target_name) { /* The binary name specifies the target */
107
--- a/util/async.c
41
+ target_name += strlen("-target-");
108
+++ b/util/async.c
42
+ } else if (*argc > 1) { /* The target is specified as an argument */
109
@@ -XXX,XX +XXX,XX @@ enum {
43
+ target_name = (*argv)[1];
110
44
+ if (!strstr(target_name, "--fuzz-target=")) {
111
struct QEMUBH {
45
+ usage(**argv);
112
AioContext *ctx;
46
+ }
113
+ const char *name;
47
+ target_name += strlen("--fuzz-target=");
114
QEMUBHFunc *cb;
48
+ } else {
115
void *opaque;
49
usage(**argv);
116
QSLIST_ENTRY(QEMUBH) next;
50
}
117
@@ -XXX,XX +XXX,XX @@ static QEMUBH *aio_bh_dequeue(BHList *head, unsigned *flags)
51
118
return bh;
52
/* Identify the fuzz target */
119
}
53
- target_name = (*argv)[1];
120
54
- if (!strstr(target_name, "--fuzz-target=")) {
121
-void aio_bh_schedule_oneshot(AioContext *ctx, QEMUBHFunc *cb, void *opaque)
55
- usage(**argv);
122
+void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb,
56
- }
123
+ void *opaque, const char *name)
57
-
124
{
58
- target_name += strlen("--fuzz-target=");
125
QEMUBH *bh;
59
-
126
bh = g_new(QEMUBH, 1);
60
fuzz_target = fuzz_get_target(target_name);
127
@@ -XXX,XX +XXX,XX @@ void aio_bh_schedule_oneshot(AioContext *ctx, QEMUBHFunc *cb, void *opaque)
61
if (!fuzz_target) {
128
.ctx = ctx,
62
usage(**argv);
129
.cb = cb,
130
.opaque = opaque,
131
+ .name = name,
132
};
133
aio_bh_enqueue(bh, BH_SCHEDULED | BH_ONESHOT);
134
}
135
136
-QEMUBH *aio_bh_new(AioContext *ctx, QEMUBHFunc *cb, void *opaque)
137
+QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
138
+ const char *name)
139
{
140
QEMUBH *bh;
141
bh = g_new(QEMUBH, 1);
142
@@ -XXX,XX +XXX,XX @@ QEMUBH *aio_bh_new(AioContext *ctx, QEMUBHFunc *cb, void *opaque)
143
.ctx = ctx,
144
.cb = cb,
145
.opaque = opaque,
146
+ .name = name,
147
};
148
return bh;
149
}
150
diff --git a/util/main-loop.c b/util/main-loop.c
151
index XXXXXXX..XXXXXXX 100644
152
--- a/util/main-loop.c
153
+++ b/util/main-loop.c
154
@@ -XXX,XX +XXX,XX @@ void main_loop_wait(int nonblocking)
155
156
/* Functions to operate on the main QEMU AioContext. */
157
158
-QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
159
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
160
{
161
- return aio_bh_new(qemu_aio_context, cb, opaque);
162
+ return aio_bh_new_full(qemu_aio_context, cb, opaque, name);
163
}
164
165
/*
166
--
63
--
167
2.31.1
64
2.25.3
168
65
diff view generated by jsdifflib
Deleted patch
1
BHs must be deleted before the AioContext is finalized. If not, it's a
2
bug and probably indicates that some part of the program still expects
3
the BH to run in the future. That can lead to memory leaks, inconsistent
4
state, or just hangs.
5
1
6
Unfortunately the assert(flags & BH_DELETED) call in aio_ctx_finalize()
7
is difficult to debug because the assertion failure contains no
8
information about the BH!
9
10
Use the QEMUBH name field added in the previous patch to show a useful
11
error when a leaked BH is detected.
12
13
Suggested-by: Eric Ernst <eric.g.ernst@gmail.com>
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
Message-Id: <20210414200247.917496-3-stefanha@redhat.com>
16
---
17
util/async.c | 16 ++++++++++++++--
18
1 file changed, 14 insertions(+), 2 deletions(-)
19
20
diff --git a/util/async.c b/util/async.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/util/async.c
23
+++ b/util/async.c
24
@@ -XXX,XX +XXX,XX @@ aio_ctx_finalize(GSource *source)
25
assert(QSIMPLEQ_EMPTY(&ctx->bh_slice_list));
26
27
while ((bh = aio_bh_dequeue(&ctx->bh_list, &flags))) {
28
- /* qemu_bh_delete() must have been called on BHs in this AioContext */
29
- assert(flags & BH_DELETED);
30
+ /*
31
+ * qemu_bh_delete() must have been called on BHs in this AioContext. In
32
+ * many cases memory leaks, hangs, or inconsistent state occur when a
33
+ * BH is leaked because something still expects it to run.
34
+ *
35
+ * If you hit this, fix the lifecycle of the BH so that
36
+ * qemu_bh_delete() and any associated cleanup is called before the
37
+ * AioContext is finalized.
38
+ */
39
+ if (unlikely(!(flags & BH_DELETED))) {
40
+ fprintf(stderr, "%s: BH '%s' leaked, aborting...\n",
41
+ __func__, bh->name);
42
+ abort();
43
+ }
44
45
g_free(bh);
46
}
47
--
48
2.31.1
49
diff view generated by jsdifflib
1
From: Akihiko Odaki <akihiko.odaki@gmail.com>
1
From: Daniel Brodsky <dnbrdsky@gmail.com>
2
2
3
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
3
- __COUNTER__ doesn't work with ## concat
4
Message-id: 20210705130458.97642-3-akihiko.odaki@gmail.com
4
- replaced ## with glue() macro so __COUNTER__ is evaluated
5
6
Fixes: 3284c3ddc4
7
8
Signed-off-by: Daniel Brodsky <dnbrdsky@gmail.com>
9
Message-id: 20200404042108.389635-2-dnbrdsky@gmail.com
5
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6
---
11
---
7
block/io.c | 2 ++
12
include/qemu/lockable.h | 7 ++++---
8
1 file changed, 2 insertions(+)
13
include/qemu/rcu.h | 2 +-
14
2 files changed, 5 insertions(+), 4 deletions(-)
9
15
10
diff --git a/block/io.c b/block/io.c
16
diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h
11
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
12
--- a/block/io.c
18
--- a/include/qemu/lockable.h
13
+++ b/block/io.c
19
+++ b/include/qemu/lockable.h
14
@@ -XXX,XX +XXX,XX @@ void bdrv_parent_drained_begin_single(BdrvChild *c, bool poll)
20
@@ -XXX,XX +XXX,XX @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuLockable, qemu_lockable_auto_unlock)
15
21
* }
16
static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src)
22
*/
17
{
23
#define WITH_QEMU_LOCK_GUARD(x) \
18
+ dst->pdiscard_alignment = MAX(dst->pdiscard_alignment,
24
- WITH_QEMU_LOCK_GUARD_((x), qemu_lockable_auto##__COUNTER__)
19
+ src->pdiscard_alignment);
25
+ WITH_QEMU_LOCK_GUARD_((x), glue(qemu_lockable_auto, __COUNTER__))
20
dst->opt_transfer = MAX(dst->opt_transfer, src->opt_transfer);
26
21
dst->max_transfer = MIN_NON_ZERO(dst->max_transfer, src->max_transfer);
27
/**
22
dst->max_hw_transfer = MIN_NON_ZERO(dst->max_hw_transfer,
28
* QEMU_LOCK_GUARD - Lock an object until the end of the scope
29
@@ -XXX,XX +XXX,XX @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuLockable, qemu_lockable_auto_unlock)
30
* return; <-- mutex is automatically unlocked
31
* }
32
*/
33
-#define QEMU_LOCK_GUARD(x) \
34
- g_autoptr(QemuLockable) qemu_lockable_auto##__COUNTER__ = \
35
+#define QEMU_LOCK_GUARD(x) \
36
+ g_autoptr(QemuLockable) \
37
+ glue(qemu_lockable_auto, __COUNTER__) G_GNUC_UNUSED = \
38
qemu_lockable_auto_lock(QEMU_MAKE_LOCKABLE((x)))
39
40
#endif
41
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h
42
index XXXXXXX..XXXXXXX 100644
43
--- a/include/qemu/rcu.h
44
+++ b/include/qemu/rcu.h
45
@@ -XXX,XX +XXX,XX @@ static inline void rcu_read_auto_unlock(RCUReadAuto *r)
46
G_DEFINE_AUTOPTR_CLEANUP_FUNC(RCUReadAuto, rcu_read_auto_unlock)
47
48
#define WITH_RCU_READ_LOCK_GUARD() \
49
- WITH_RCU_READ_LOCK_GUARD_(_rcu_read_auto##__COUNTER__)
50
+ WITH_RCU_READ_LOCK_GUARD_(glue(_rcu_read_auto, __COUNTER__))
51
52
#define WITH_RCU_READ_LOCK_GUARD_(var) \
53
for (g_autoptr(RCUReadAuto) var = rcu_read_auto_lock(); \
23
--
54
--
24
2.31.1
55
2.25.3
25
56
diff view generated by jsdifflib
1
From: Akihiko Odaki <akihiko.odaki@gmail.com>
1
From: Daniel Brodsky <dnbrdsky@gmail.com>
2
2
3
This commit introduces "punch hole" operation and optimizes transfer
3
- ran regexp "qemu_mutex_lock\(.*\).*\n.*if" to find targets
4
block size for macOS.
4
- replaced result with QEMU_LOCK_GUARD if all unlocks at function end
5
- replaced result with WITH_QEMU_LOCK_GUARD if unlock not at end
5
6
6
Thanks to Konstantin Nazarov for detailed analysis of a flaw in an
7
Signed-off-by: Daniel Brodsky <dnbrdsky@gmail.com>
7
old version of this change:
8
Reviewed-by: Juan Quintela <quintela@redhat.com>
8
https://gist.github.com/akihikodaki/87df4149e7ca87f18dc56807ec5a1bc5#gistcomment-3654667
9
Message-id: 20200404042108.389635-3-dnbrdsky@gmail.com
9
10
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
11
Message-id: 20210705130458.97642-1-akihiko.odaki@gmail.com
12
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
13
---
11
---
14
block/file-posix.c | 27 +++++++++++++++++++++++++--
12
block/iscsi.c | 7 ++----
15
1 file changed, 25 insertions(+), 2 deletions(-)
13
block/nfs.c | 51 ++++++++++++++++++++-----------------------
14
cpus-common.c | 14 +++++-------
15
hw/display/qxl.c | 43 +++++++++++++++++-------------------
16
hw/vfio/platform.c | 5 ++---
17
migration/migration.c | 3 +--
18
migration/multifd.c | 8 +++----
19
migration/ram.c | 3 +--
20
monitor/misc.c | 4 +---
21
ui/spice-display.c | 14 ++++++------
22
util/log.c | 4 ++--
23
util/qemu-timer.c | 17 +++++++--------
24
util/rcu.c | 8 +++----
25
util/thread-pool.c | 3 +--
26
util/vfio-helpers.c | 5 ++---
27
15 files changed, 83 insertions(+), 106 deletions(-)
16
28
17
diff --git a/block/file-posix.c b/block/file-posix.c
29
diff --git a/block/iscsi.c b/block/iscsi.c
18
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
19
--- a/block/file-posix.c
31
--- a/block/iscsi.c
20
+++ b/block/file-posix.c
32
+++ b/block/iscsi.c
33
@@ -XXX,XX +XXX,XX @@ static void iscsi_nop_timed_event(void *opaque)
34
{
35
IscsiLun *iscsilun = opaque;
36
37
- qemu_mutex_lock(&iscsilun->mutex);
38
+ QEMU_LOCK_GUARD(&iscsilun->mutex);
39
if (iscsi_get_nops_in_flight(iscsilun->iscsi) >= MAX_NOP_FAILURES) {
40
error_report("iSCSI: NOP timeout. Reconnecting...");
41
iscsilun->request_timed_out = true;
42
} else if (iscsi_nop_out_async(iscsilun->iscsi, NULL, NULL, 0, NULL) != 0) {
43
error_report("iSCSI: failed to sent NOP-Out. Disabling NOP messages.");
44
- goto out;
45
+ return;
46
}
47
48
timer_mod(iscsilun->nop_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + NOP_INTERVAL);
49
iscsi_set_events(iscsilun);
50
-
51
-out:
52
- qemu_mutex_unlock(&iscsilun->mutex);
53
}
54
55
static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp)
56
diff --git a/block/nfs.c b/block/nfs.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/block/nfs.c
59
+++ b/block/nfs.c
60
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_preadv(BlockDriverState *bs, uint64_t offset,
61
nfs_co_init_task(bs, &task);
62
task.iov = iov;
63
64
- qemu_mutex_lock(&client->mutex);
65
- if (nfs_pread_async(client->context, client->fh,
66
- offset, bytes, nfs_co_generic_cb, &task) != 0) {
67
- qemu_mutex_unlock(&client->mutex);
68
- return -ENOMEM;
69
- }
70
+ WITH_QEMU_LOCK_GUARD(&client->mutex) {
71
+ if (nfs_pread_async(client->context, client->fh,
72
+ offset, bytes, nfs_co_generic_cb, &task) != 0) {
73
+ return -ENOMEM;
74
+ }
75
76
- nfs_set_events(client);
77
- qemu_mutex_unlock(&client->mutex);
78
+ nfs_set_events(client);
79
+ }
80
while (!task.complete) {
81
qemu_coroutine_yield();
82
}
83
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_pwritev(BlockDriverState *bs, uint64_t offset,
84
buf = iov->iov[0].iov_base;
85
}
86
87
- qemu_mutex_lock(&client->mutex);
88
- if (nfs_pwrite_async(client->context, client->fh,
89
- offset, bytes, buf,
90
- nfs_co_generic_cb, &task) != 0) {
91
- qemu_mutex_unlock(&client->mutex);
92
- if (my_buffer) {
93
- g_free(buf);
94
+ WITH_QEMU_LOCK_GUARD(&client->mutex) {
95
+ if (nfs_pwrite_async(client->context, client->fh,
96
+ offset, bytes, buf,
97
+ nfs_co_generic_cb, &task) != 0) {
98
+ if (my_buffer) {
99
+ g_free(buf);
100
+ }
101
+ return -ENOMEM;
102
}
103
- return -ENOMEM;
104
- }
105
106
- nfs_set_events(client);
107
- qemu_mutex_unlock(&client->mutex);
108
+ nfs_set_events(client);
109
+ }
110
while (!task.complete) {
111
qemu_coroutine_yield();
112
}
113
@@ -XXX,XX +XXX,XX @@ static int coroutine_fn nfs_co_flush(BlockDriverState *bs)
114
115
nfs_co_init_task(bs, &task);
116
117
- qemu_mutex_lock(&client->mutex);
118
- if (nfs_fsync_async(client->context, client->fh, nfs_co_generic_cb,
119
- &task) != 0) {
120
- qemu_mutex_unlock(&client->mutex);
121
- return -ENOMEM;
122
- }
123
+ WITH_QEMU_LOCK_GUARD(&client->mutex) {
124
+ if (nfs_fsync_async(client->context, client->fh, nfs_co_generic_cb,
125
+ &task) != 0) {
126
+ return -ENOMEM;
127
+ }
128
129
- nfs_set_events(client);
130
- qemu_mutex_unlock(&client->mutex);
131
+ nfs_set_events(client);
132
+ }
133
while (!task.complete) {
134
qemu_coroutine_yield();
135
}
136
diff --git a/cpus-common.c b/cpus-common.c
137
index XXXXXXX..XXXXXXX 100644
138
--- a/cpus-common.c
139
+++ b/cpus-common.c
21
@@ -XXX,XX +XXX,XX @@
140
@@ -XXX,XX +XXX,XX @@
22
#if defined(HAVE_HOST_BLOCK_DEVICE)
141
#include "exec/cpu-common.h"
23
#include <paths.h>
142
#include "hw/core/cpu.h"
24
#include <sys/param.h>
143
#include "sysemu/cpus.h"
25
+#include <sys/mount.h>
144
+#include "qemu/lockable.h"
26
#include <IOKit/IOKitLib.h>
145
27
#include <IOKit/IOBSD.h>
146
static QemuMutex qemu_cpu_list_lock;
28
#include <IOKit/storage/IOMediaBSDClient.h>
147
static QemuCond exclusive_cond;
29
@@ -XXX,XX +XXX,XX @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
148
@@ -XXX,XX +XXX,XX @@ static int cpu_get_free_index(void)
149
150
void cpu_list_add(CPUState *cpu)
151
{
152
- qemu_mutex_lock(&qemu_cpu_list_lock);
153
+ QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
154
if (cpu->cpu_index == UNASSIGNED_CPU_INDEX) {
155
cpu->cpu_index = cpu_get_free_index();
156
assert(cpu->cpu_index != UNASSIGNED_CPU_INDEX);
157
@@ -XXX,XX +XXX,XX @@ void cpu_list_add(CPUState *cpu)
158
assert(!cpu_index_auto_assigned);
159
}
160
QTAILQ_INSERT_TAIL_RCU(&cpus, cpu, node);
161
- qemu_mutex_unlock(&qemu_cpu_list_lock);
162
}
163
164
void cpu_list_remove(CPUState *cpu)
165
{
166
- qemu_mutex_lock(&qemu_cpu_list_lock);
167
+ QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
168
if (!QTAILQ_IN_USE(cpu, node)) {
169
/* there is nothing to undo since cpu_exec_init() hasn't been called */
170
- qemu_mutex_unlock(&qemu_cpu_list_lock);
30
return;
171
return;
31
}
172
}
32
173
33
+#if defined(__APPLE__) && (__MACH__)
174
@@ -XXX,XX +XXX,XX @@ void cpu_list_remove(CPUState *cpu)
34
+ struct statfs buf;
175
35
+
176
QTAILQ_REMOVE_RCU(&cpus, cpu, node);
36
+ if (!fstatfs(s->fd, &buf)) {
177
cpu->cpu_index = UNASSIGNED_CPU_INDEX;
37
+ bs->bl.opt_transfer = buf.f_iosize;
178
- qemu_mutex_unlock(&qemu_cpu_list_lock);
38
+ bs->bl.pdiscard_alignment = buf.f_bsize;
179
}
39
+ }
180
40
+#endif
181
struct qemu_work_item {
41
+
182
@@ -XXX,XX +XXX,XX @@ void cpu_exec_start(CPUState *cpu)
42
if (bs->sg || S_ISBLK(st.st_mode)) {
183
* see cpu->running == true, and it will kick the CPU.
43
int ret = hdev_get_max_hw_transfer(s->fd, &st);
184
*/
44
185
if (unlikely(atomic_read(&pending_cpus))) {
45
@@ -XXX,XX +XXX,XX @@ out:
186
- qemu_mutex_lock(&qemu_cpu_list_lock);
46
}
187
+ QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
47
}
188
if (!cpu->has_waiter) {
48
189
/* Not counted in pending_cpus, let the exclusive item
49
+#if defined(CONFIG_FALLOCATE) || defined(BLKZEROOUT) || defined(BLKDISCARD)
190
* run. Since we have the lock, just set cpu->running to true
50
static int translate_err(int err)
191
@@ -XXX,XX +XXX,XX @@ void cpu_exec_start(CPUState *cpu)
192
* waiter at cpu_exec_end.
193
*/
194
}
195
- qemu_mutex_unlock(&qemu_cpu_list_lock);
196
}
197
}
198
199
@@ -XXX,XX +XXX,XX @@ void cpu_exec_end(CPUState *cpu)
200
* next cpu_exec_start.
201
*/
202
if (unlikely(atomic_read(&pending_cpus))) {
203
- qemu_mutex_lock(&qemu_cpu_list_lock);
204
+ QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
205
if (cpu->has_waiter) {
206
cpu->has_waiter = false;
207
atomic_set(&pending_cpus, pending_cpus - 1);
208
@@ -XXX,XX +XXX,XX @@ void cpu_exec_end(CPUState *cpu)
209
qemu_cond_signal(&exclusive_cond);
210
}
211
}
212
- qemu_mutex_unlock(&qemu_cpu_list_lock);
213
}
214
}
215
216
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
217
index XXXXXXX..XXXXXXX 100644
218
--- a/hw/display/qxl.c
219
+++ b/hw/display/qxl.c
220
@@ -XXX,XX +XXX,XX @@ static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext)
221
cmd->u.surface_create.stride);
222
return 1;
223
}
224
- qemu_mutex_lock(&qxl->track_lock);
225
- if (cmd->type == QXL_SURFACE_CMD_CREATE) {
226
- qxl->guest_surfaces.cmds[id] = ext->cmd.data;
227
- qxl->guest_surfaces.count++;
228
- if (qxl->guest_surfaces.max < qxl->guest_surfaces.count)
229
- qxl->guest_surfaces.max = qxl->guest_surfaces.count;
230
+ WITH_QEMU_LOCK_GUARD(&qxl->track_lock) {
231
+ if (cmd->type == QXL_SURFACE_CMD_CREATE) {
232
+ qxl->guest_surfaces.cmds[id] = ext->cmd.data;
233
+ qxl->guest_surfaces.count++;
234
+ if (qxl->guest_surfaces.max < qxl->guest_surfaces.count) {
235
+ qxl->guest_surfaces.max = qxl->guest_surfaces.count;
236
+ }
237
+ }
238
+ if (cmd->type == QXL_SURFACE_CMD_DESTROY) {
239
+ qxl->guest_surfaces.cmds[id] = 0;
240
+ qxl->guest_surfaces.count--;
241
+ }
242
}
243
- if (cmd->type == QXL_SURFACE_CMD_DESTROY) {
244
- qxl->guest_surfaces.cmds[id] = 0;
245
- qxl->guest_surfaces.count--;
246
- }
247
- qemu_mutex_unlock(&qxl->track_lock);
248
break;
249
}
250
case QXL_CMD_CURSOR:
251
@@ -XXX,XX +XXX,XX @@ static void interface_update_area_complete(QXLInstance *sin,
252
int i;
253
int qxl_i;
254
255
- qemu_mutex_lock(&qxl->ssd.lock);
256
+ QEMU_LOCK_GUARD(&qxl->ssd.lock);
257
if (surface_id != 0 || !num_updated_rects ||
258
!qxl->render_update_cookie_num) {
259
- qemu_mutex_unlock(&qxl->ssd.lock);
260
return;
261
}
262
trace_qxl_interface_update_area_complete(qxl->id, surface_id, dirty->left,
263
@@ -XXX,XX +XXX,XX @@ static void interface_update_area_complete(QXLInstance *sin,
264
* Don't bother copying or scheduling the bh since we will flip
265
* the whole area anyway on completion of the update_area async call
266
*/
267
- qemu_mutex_unlock(&qxl->ssd.lock);
268
return;
269
}
270
qxl_i = qxl->num_dirty_rects;
271
@@ -XXX,XX +XXX,XX @@ static void interface_update_area_complete(QXLInstance *sin,
272
trace_qxl_interface_update_area_complete_schedule_bh(qxl->id,
273
qxl->num_dirty_rects);
274
qemu_bh_schedule(qxl->update_area_bh);
275
- qemu_mutex_unlock(&qxl->ssd.lock);
276
}
277
278
/* called from spice server thread context only */
279
@@ -XXX,XX +XXX,XX @@ static void ioport_write(void *opaque, hwaddr addr,
280
case QXL_IO_MONITORS_CONFIG_ASYNC:
281
async_common:
282
async = QXL_ASYNC;
283
- qemu_mutex_lock(&d->async_lock);
284
- if (d->current_async != QXL_UNDEFINED_IO) {
285
- qxl_set_guest_bug(d, "%d async started before last (%d) complete",
286
- io_port, d->current_async);
287
- qemu_mutex_unlock(&d->async_lock);
288
- return;
289
+ WITH_QEMU_LOCK_GUARD(&d->async_lock) {
290
+ if (d->current_async != QXL_UNDEFINED_IO) {
291
+ qxl_set_guest_bug(d, "%d async started before last (%d) complete",
292
+ io_port, d->current_async);
293
+ return;
294
+ }
295
+ d->current_async = orig_io_port;
296
}
297
- d->current_async = orig_io_port;
298
- qemu_mutex_unlock(&d->async_lock);
299
break;
300
default:
301
break;
302
diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
303
index XXXXXXX..XXXXXXX 100644
304
--- a/hw/vfio/platform.c
305
+++ b/hw/vfio/platform.c
306
@@ -XXX,XX +XXX,XX @@
307
#include "hw/vfio/vfio-platform.h"
308
#include "migration/vmstate.h"
309
#include "qemu/error-report.h"
310
+#include "qemu/lockable.h"
311
#include "qemu/main-loop.h"
312
#include "qemu/module.h"
313
#include "qemu/range.h"
314
@@ -XXX,XX +XXX,XX @@ static void vfio_intp_interrupt(VFIOINTp *intp)
315
VFIOPlatformDevice *vdev = intp->vdev;
316
bool delay_handling = false;
317
318
- qemu_mutex_lock(&vdev->intp_mutex);
319
+ QEMU_LOCK_GUARD(&vdev->intp_mutex);
320
if (intp->state == VFIO_IRQ_INACTIVE) {
321
QLIST_FOREACH(tmp, &vdev->intp_list, next) {
322
if (tmp->state == VFIO_IRQ_ACTIVE ||
323
@@ -XXX,XX +XXX,XX @@ static void vfio_intp_interrupt(VFIOINTp *intp)
324
QSIMPLEQ_INSERT_TAIL(&vdev->pending_intp_queue,
325
intp, pqnext);
326
ret = event_notifier_test_and_clear(intp->interrupt);
327
- qemu_mutex_unlock(&vdev->intp_mutex);
328
return;
329
}
330
331
@@ -XXX,XX +XXX,XX @@ static void vfio_intp_interrupt(VFIOINTp *intp)
332
qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
333
vdev->mmap_timeout);
334
}
335
- qemu_mutex_unlock(&vdev->intp_mutex);
336
}
337
338
/**
339
diff --git a/migration/migration.c b/migration/migration.c
340
index XXXXXXX..XXXXXXX 100644
341
--- a/migration/migration.c
342
+++ b/migration/migration.c
343
@@ -XXX,XX +XXX,XX @@ static void migrate_fd_cleanup_bh(void *opaque)
344
345
void migrate_set_error(MigrationState *s, const Error *error)
51
{
346
{
52
if (err == -ENODEV || err == -ENOSYS || err == -EOPNOTSUPP ||
347
- qemu_mutex_lock(&s->error_mutex);
53
@@ -XXX,XX +XXX,XX @@ static int translate_err(int err)
348
+ QEMU_LOCK_GUARD(&s->error_mutex);
54
}
349
if (!s->error) {
55
return err;
350
s->error = error_copy(error);
56
}
351
}
57
+#endif
352
- qemu_mutex_unlock(&s->error_mutex);
58
353
}
59
#ifdef CONFIG_FALLOCATE
354
60
static int do_fallocate(int fd, int mode, off_t offset, off_t len)
355
void migrate_fd_error(MigrationState *s, const Error *error)
61
@@ -XXX,XX +XXX,XX @@ static int handle_aiocb_discard(void *opaque)
356
diff --git a/migration/multifd.c b/migration/multifd.c
357
index XXXXXXX..XXXXXXX 100644
358
--- a/migration/multifd.c
359
+++ b/migration/multifd.c
360
@@ -XXX,XX +XXX,XX @@ void multifd_recv_sync_main(void)
361
for (i = 0; i < migrate_multifd_channels(); i++) {
362
MultiFDRecvParams *p = &multifd_recv_state->params[i];
363
364
- qemu_mutex_lock(&p->mutex);
365
- if (multifd_recv_state->packet_num < p->packet_num) {
366
- multifd_recv_state->packet_num = p->packet_num;
367
+ WITH_QEMU_LOCK_GUARD(&p->mutex) {
368
+ if (multifd_recv_state->packet_num < p->packet_num) {
369
+ multifd_recv_state->packet_num = p->packet_num;
370
+ }
371
}
372
- qemu_mutex_unlock(&p->mutex);
373
trace_multifd_recv_sync_main_signal(p->id);
374
qemu_sem_post(&p->sem_sync);
375
}
376
diff --git a/migration/ram.c b/migration/ram.c
377
index XXXXXXX..XXXXXXX 100644
378
--- a/migration/ram.c
379
+++ b/migration/ram.c
380
@@ -XXX,XX +XXX,XX @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset)
381
return NULL;
382
}
383
384
- qemu_mutex_lock(&rs->src_page_req_mutex);
385
+ QEMU_LOCK_GUARD(&rs->src_page_req_mutex);
386
if (!QSIMPLEQ_EMPTY(&rs->src_page_requests)) {
387
struct RAMSrcPageRequest *entry =
388
QSIMPLEQ_FIRST(&rs->src_page_requests);
389
@@ -XXX,XX +XXX,XX @@ static RAMBlock *unqueue_page(RAMState *rs, ram_addr_t *offset)
390
migration_consume_urgent_request();
391
}
392
}
393
- qemu_mutex_unlock(&rs->src_page_req_mutex);
394
395
return block;
396
}
397
diff --git a/monitor/misc.c b/monitor/misc.c
398
index XXXXXXX..XXXXXXX 100644
399
--- a/monitor/misc.c
400
+++ b/monitor/misc.c
401
@@ -XXX,XX +XXX,XX @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
402
MonFdsetFd *mon_fdset_fd;
403
AddfdInfo *fdinfo;
404
405
- qemu_mutex_lock(&mon_fdsets_lock);
406
+ QEMU_LOCK_GUARD(&mon_fdsets_lock);
407
if (has_fdset_id) {
408
QLIST_FOREACH(mon_fdset, &mon_fdsets, next) {
409
/* Break if match found or match impossible due to ordering by ID */
410
@@ -XXX,XX +XXX,XX @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
411
if (fdset_id < 0) {
412
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "fdset-id",
413
"a non-negative value");
414
- qemu_mutex_unlock(&mon_fdsets_lock);
415
return NULL;
62
}
416
}
63
} while (errno == EINTR);
417
/* Use specified fdset ID */
64
418
@@ -XXX,XX +XXX,XX @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
65
- ret = -errno;
419
fdinfo->fdset_id = mon_fdset->id;
66
+ ret = translate_err(-errno);
420
fdinfo->fd = mon_fdset_fd->fd;
421
422
- qemu_mutex_unlock(&mon_fdsets_lock);
423
return fdinfo;
424
}
425
426
diff --git a/ui/spice-display.c b/ui/spice-display.c
427
index XXXXXXX..XXXXXXX 100644
428
--- a/ui/spice-display.c
429
+++ b/ui/spice-display.c
430
@@ -XXX,XX +XXX,XX @@
431
#include "qemu/osdep.h"
432
#include "ui/qemu-spice.h"
433
#include "qemu/timer.h"
434
+#include "qemu/lockable.h"
435
#include "qemu/main-loop.h"
436
#include "qemu/option.h"
437
#include "qemu/queue.h"
438
@@ -XXX,XX +XXX,XX @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
439
{
440
graphic_hw_update(ssd->dcl.con);
441
442
- qemu_mutex_lock(&ssd->lock);
443
- if (QTAILQ_EMPTY(&ssd->updates) && ssd->ds) {
444
- qemu_spice_create_update(ssd);
445
- ssd->notify++;
446
+ WITH_QEMU_LOCK_GUARD(&ssd->lock) {
447
+ if (QTAILQ_EMPTY(&ssd->updates) && ssd->ds) {
448
+ qemu_spice_create_update(ssd);
449
+ ssd->notify++;
450
+ }
451
}
452
- qemu_mutex_unlock(&ssd->lock);
453
454
trace_qemu_spice_display_refresh(ssd->qxl.id, ssd->notify);
455
if (ssd->notify) {
456
@@ -XXX,XX +XXX,XX @@ static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext)
457
SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
458
int ret;
459
460
- qemu_mutex_lock(&ssd->lock);
461
+ QEMU_LOCK_GUARD(&ssd->lock);
462
if (ssd->ptr_define) {
463
*ext = ssd->ptr_define->ext;
464
ssd->ptr_define = NULL;
465
@@ -XXX,XX +XXX,XX @@ static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext)
466
} else {
467
ret = false;
468
}
469
- qemu_mutex_unlock(&ssd->lock);
470
return ret;
471
}
472
473
diff --git a/util/log.c b/util/log.c
474
index XXXXXXX..XXXXXXX 100644
475
--- a/util/log.c
476
+++ b/util/log.c
477
@@ -XXX,XX +XXX,XX @@
478
#include "qemu/cutils.h"
479
#include "trace/control.h"
480
#include "qemu/thread.h"
481
+#include "qemu/lockable.h"
482
483
static char *logfilename;
484
static QemuMutex qemu_logfile_mutex;
485
@@ -XXX,XX +XXX,XX @@ void qemu_set_log(int log_flags)
486
if (qemu_loglevel && (!is_daemonized() || logfilename)) {
487
need_to_open_file = true;
488
}
489
- qemu_mutex_lock(&qemu_logfile_mutex);
490
+ QEMU_LOCK_GUARD(&qemu_logfile_mutex);
491
if (qemu_logfile && !need_to_open_file) {
492
logfile = qemu_logfile;
493
atomic_rcu_set(&qemu_logfile, NULL);
494
@@ -XXX,XX +XXX,XX @@ void qemu_set_log(int log_flags)
495
}
496
atomic_rcu_set(&qemu_logfile, logfile);
497
}
498
- qemu_mutex_unlock(&qemu_logfile_mutex);
499
}
500
501
void qemu_log_needs_buffers(void)
502
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
503
index XXXXXXX..XXXXXXX 100644
504
--- a/util/qemu-timer.c
505
+++ b/util/qemu-timer.c
506
@@ -XXX,XX +XXX,XX @@ void timer_mod_anticipate_ns(QEMUTimer *ts, int64_t expire_time)
507
QEMUTimerList *timer_list = ts->timer_list;
508
bool rearm;
509
510
- qemu_mutex_lock(&timer_list->active_timers_lock);
511
- if (ts->expire_time == -1 || ts->expire_time > expire_time) {
512
- if (ts->expire_time != -1) {
513
- timer_del_locked(timer_list, ts);
514
+ WITH_QEMU_LOCK_GUARD(&timer_list->active_timers_lock) {
515
+ if (ts->expire_time == -1 || ts->expire_time > expire_time) {
516
+ if (ts->expire_time != -1) {
517
+ timer_del_locked(timer_list, ts);
518
+ }
519
+ rearm = timer_mod_ns_locked(timer_list, ts, expire_time);
520
+ } else {
521
+ rearm = false;
522
}
523
- rearm = timer_mod_ns_locked(timer_list, ts, expire_time);
524
- } else {
525
- rearm = false;
526
}
527
- qemu_mutex_unlock(&timer_list->active_timers_lock);
528
-
529
if (rearm) {
530
timerlist_rearm(timer_list);
531
}
532
diff --git a/util/rcu.c b/util/rcu.c
533
index XXXXXXX..XXXXXXX 100644
534
--- a/util/rcu.c
535
+++ b/util/rcu.c
536
@@ -XXX,XX +XXX,XX @@
537
#include "qemu/atomic.h"
538
#include "qemu/thread.h"
539
#include "qemu/main-loop.h"
540
+#include "qemu/lockable.h"
541
#if defined(CONFIG_MALLOC_TRIM)
542
#include <malloc.h>
67
#endif
543
#endif
68
} else {
544
@@ -XXX,XX +XXX,XX @@ static void wait_for_readers(void)
69
#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
545
70
ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
546
void synchronize_rcu(void)
71
aiocb->aio_offset, aiocb->aio_nbytes);
547
{
72
+ ret = translate_err(-errno);
548
- qemu_mutex_lock(&rcu_sync_lock);
73
+#elif defined(__APPLE__) && (__MACH__)
549
+ QEMU_LOCK_GUARD(&rcu_sync_lock);
74
+ fpunchhole_t fpunchhole;
550
75
+ fpunchhole.fp_flags = 0;
551
/* Write RCU-protected pointers before reading p_rcu_reader->ctr.
76
+ fpunchhole.reserved = 0;
552
* Pairs with smp_mb_placeholder() in rcu_read_lock().
77
+ fpunchhole.fp_offset = aiocb->aio_offset;
553
*/
78
+ fpunchhole.fp_length = aiocb->aio_nbytes;
554
smp_mb_global();
79
+ if (fcntl(s->fd, F_PUNCHHOLE, &fpunchhole) == -1) {
555
80
+ ret = errno == ENODEV ? -ENOTSUP : -errno;
556
- qemu_mutex_lock(&rcu_registry_lock);
81
+ } else {
557
+ QEMU_LOCK_GUARD(&rcu_registry_lock);
82
+ ret = 0;
558
if (!QLIST_EMPTY(&registry)) {
83
+ }
559
/* In either case, the atomic_mb_set below blocks stores that free
84
#endif
560
* old RCU-protected pointers.
85
}
561
@@ -XXX,XX +XXX,XX @@ void synchronize_rcu(void)
86
562
87
- ret = translate_err(ret);
563
wait_for_readers();
88
if (ret == -ENOTSUP) {
564
}
89
s->has_discard = false;
565
-
90
}
566
- qemu_mutex_unlock(&rcu_registry_lock);
567
- qemu_mutex_unlock(&rcu_sync_lock);
568
}
569
570
571
diff --git a/util/thread-pool.c b/util/thread-pool.c
572
index XXXXXXX..XXXXXXX 100644
573
--- a/util/thread-pool.c
574
+++ b/util/thread-pool.c
575
@@ -XXX,XX +XXX,XX @@ static void thread_pool_cancel(BlockAIOCB *acb)
576
577
trace_thread_pool_cancel(elem, elem->common.opaque);
578
579
- qemu_mutex_lock(&pool->lock);
580
+ QEMU_LOCK_GUARD(&pool->lock);
581
if (elem->state == THREAD_QUEUED &&
582
/* No thread has yet started working on elem. we can try to "steal"
583
* the item from the worker if we can get a signal from the
584
@@ -XXX,XX +XXX,XX @@ static void thread_pool_cancel(BlockAIOCB *acb)
585
elem->ret = -ECANCELED;
586
}
587
588
- qemu_mutex_unlock(&pool->lock);
589
}
590
591
static AioContext *thread_pool_get_aio_context(BlockAIOCB *acb)
592
diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
593
index XXXXXXX..XXXXXXX 100644
594
--- a/util/vfio-helpers.c
595
+++ b/util/vfio-helpers.c
596
@@ -XXX,XX +XXX,XX @@
597
#include "standard-headers/linux/pci_regs.h"
598
#include "qemu/event_notifier.h"
599
#include "qemu/vfio-helpers.h"
600
+#include "qemu/lockable.h"
601
#include "trace.h"
602
603
#define QEMU_VFIO_DEBUG 0
604
@@ -XXX,XX +XXX,XX @@ int qemu_vfio_dma_reset_temporary(QEMUVFIOState *s)
605
.size = QEMU_VFIO_IOVA_MAX - s->high_water_mark,
606
};
607
trace_qemu_vfio_dma_reset_temporary(s);
608
- qemu_mutex_lock(&s->lock);
609
+ QEMU_LOCK_GUARD(&s->lock);
610
if (ioctl(s->container, VFIO_IOMMU_UNMAP_DMA, &unmap)) {
611
error_report("VFIO_UNMAP_DMA failed: %s", strerror(errno));
612
- qemu_mutex_unlock(&s->lock);
613
return -errno;
614
}
615
s->high_water_mark = QEMU_VFIO_IOVA_MAX;
616
- qemu_mutex_unlock(&s->lock);
617
return 0;
618
}
619
91
--
620
--
92
2.31.1
621
2.25.3
93
622
diff view generated by jsdifflib
1
From: Akihiko Odaki <akihiko.odaki@gmail.com>
1
From: Simran Singhal <singhalsimran0@gmail.com>
2
2
3
backend_defaults property allow users to control if default block
3
Replace manual lock()/unlock() calls with lock guard macros
4
properties should be decided with backend information.
4
(QEMU_LOCK_GUARD/WITH_QEMU_LOCK_GUARD).
5
5
6
If it is off, any backend information will be discarded, which is
6
Signed-off-by: Simran Singhal <singhalsimran0@gmail.com>
7
suitable if you plan to perform live migration to a different disk backend.
7
Reviewed-by: Yuval Shaia <yuval.shaia.ml@gmail.com>
8
8
Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com>
9
If it is on, a block device may utilize backend information more
9
Tested-by: Yuval Shaia <yuval.shaia.ml@gmail.com>
10
aggressively.
10
Message-id: 20200402065035.GA15477@simran-Inspiron-5558
11
12
By default, it is auto, which uses backend information for block
13
sizes and ignores the others, which is consistent with the older
14
versions.
15
16
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
17
Message-id: 20210705130458.97642-2-akihiko.odaki@gmail.com
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
19
---
12
---
20
include/hw/block/block.h | 3 +++
13
hw/hyperv/hyperv.c | 15 ++++++-------
21
hw/block/block.c | 42 ++++++++++++++++++++++++++++++++++----
14
hw/rdma/rdma_backend.c | 50 +++++++++++++++++++++---------------------
22
tests/qemu-iotests/172.out | 38 ++++++++++++++++++++++++++++++++++
15
hw/rdma/rdma_rm.c | 3 +--
23
3 files changed, 79 insertions(+), 4 deletions(-)
16
3 files changed, 33 insertions(+), 35 deletions(-)
24
17
25
diff --git a/include/hw/block/block.h b/include/hw/block/block.h
18
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
26
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
27
--- a/include/hw/block/block.h
20
--- a/hw/hyperv/hyperv.c
28
+++ b/include/hw/block/block.h
21
+++ b/hw/hyperv/hyperv.c
29
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@
30
23
#include "sysemu/kvm.h"
31
typedef struct BlockConf {
24
#include "qemu/bitops.h"
32
BlockBackend *blk;
25
#include "qemu/error-report.h"
33
+ OnOffAuto backend_defaults;
26
+#include "qemu/lockable.h"
34
uint32_t physical_block_size;
27
#include "qemu/queue.h"
35
uint32_t logical_block_size;
28
#include "qemu/rcu.h"
36
uint32_t min_io_size;
29
#include "qemu/rcu_queue.h"
37
@@ -XXX,XX +XXX,XX @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
30
@@ -XXX,XX +XXX,XX @@ int hyperv_set_msg_handler(uint32_t conn_id, HvMsgHandler handler, void *data)
38
}
31
int ret;
39
32
MsgHandler *mh;
40
#define DEFINE_BLOCK_PROPERTIES_BASE(_state, _conf) \
33
41
+ DEFINE_PROP_ON_OFF_AUTO("backend_defaults", _state, \
34
- qemu_mutex_lock(&handlers_mutex);
42
+ _conf.backend_defaults, ON_OFF_AUTO_AUTO), \
35
+ QEMU_LOCK_GUARD(&handlers_mutex);
43
DEFINE_PROP_BLOCKSIZE("logical_block_size", _state, \
36
QLIST_FOREACH(mh, &msg_handlers, link) {
44
_conf.logical_block_size), \
37
if (mh->conn_id == conn_id) {
45
DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \
38
if (handler) {
46
diff --git a/hw/block/block.c b/hw/block/block.c
39
@@ -XXX,XX +XXX,XX @@ int hyperv_set_msg_handler(uint32_t conn_id, HvMsgHandler handler, void *data)
47
index XXXXXXX..XXXXXXX 100644
40
g_free_rcu(mh, rcu);
48
--- a/hw/block/block.c
41
ret = 0;
49
+++ b/hw/block/block.c
42
}
50
@@ -XXX,XX +XXX,XX @@ bool blkconf_blocksizes(BlockConf *conf, Error **errp)
43
- goto unlock;
51
{
44
+ return ret;
52
BlockBackend *blk = conf->blk;
53
BlockSizes blocksizes;
54
- int backend_ret;
55
+ BlockDriverState *bs;
56
+ bool use_blocksizes;
57
+ bool use_bs;
58
+
59
+ switch (conf->backend_defaults) {
60
+ case ON_OFF_AUTO_AUTO:
61
+ use_blocksizes = !blk_probe_blocksizes(blk, &blocksizes);
62
+ use_bs = false;
63
+ break;
64
+
65
+ case ON_OFF_AUTO_ON:
66
+ use_blocksizes = !blk_probe_blocksizes(blk, &blocksizes);
67
+ bs = blk_bs(blk);
68
+ use_bs = bs;
69
+ break;
70
+
71
+ case ON_OFF_AUTO_OFF:
72
+ use_blocksizes = false;
73
+ use_bs = false;
74
+ break;
75
+
76
+ default:
77
+ abort();
78
+ }
79
80
- backend_ret = blk_probe_blocksizes(blk, &blocksizes);
81
/* fill in detected values if they are not defined via qemu command line */
82
if (!conf->physical_block_size) {
83
- if (!backend_ret) {
84
+ if (use_blocksizes) {
85
conf->physical_block_size = blocksizes.phys;
86
} else {
87
conf->physical_block_size = BDRV_SECTOR_SIZE;
88
}
45
}
89
}
46
}
90
if (!conf->logical_block_size) {
47
91
- if (!backend_ret) {
48
@@ -XXX,XX +XXX,XX @@ int hyperv_set_msg_handler(uint32_t conn_id, HvMsgHandler handler, void *data)
92
+ if (use_blocksizes) {
49
} else {
93
conf->logical_block_size = blocksizes.log;
50
ret = -ENOENT;
94
} else {
51
}
95
conf->logical_block_size = BDRV_SECTOR_SIZE;
52
-unlock:
53
- qemu_mutex_unlock(&handlers_mutex);
54
+
55
return ret;
56
}
57
58
@@ -XXX,XX +XXX,XX @@ static int set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier)
59
int ret;
60
EventFlagHandler *handler;
61
62
- qemu_mutex_lock(&handlers_mutex);
63
+ QEMU_LOCK_GUARD(&handlers_mutex);
64
QLIST_FOREACH(handler, &event_flag_handlers, link) {
65
if (handler->conn_id == conn_id) {
66
if (notifier) {
67
@@ -XXX,XX +XXX,XX @@ static int set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier)
68
g_free_rcu(handler, rcu);
69
ret = 0;
70
}
71
- goto unlock;
72
+ return ret;
96
}
73
}
97
}
74
}
98
+ if (use_bs) {
75
99
+ if (!conf->opt_io_size) {
76
@@ -XXX,XX +XXX,XX @@ static int set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier)
100
+ conf->opt_io_size = bs->bl.opt_transfer;
77
} else {
101
+ }
78
ret = -ENOENT;
102
+ if (conf->discard_granularity == -1) {
79
}
103
+ if (bs->bl.pdiscard_alignment) {
80
-unlock:
104
+ conf->discard_granularity = bs->bl.pdiscard_alignment;
81
- qemu_mutex_unlock(&handlers_mutex);
105
+ } else if (bs->bl.request_alignment != 1) {
82
+
106
+ conf->discard_granularity = bs->bl.request_alignment;
83
return ret;
84
}
85
86
diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/hw/rdma/rdma_backend.c
89
+++ b/hw/rdma/rdma_backend.c
90
@@ -XXX,XX +XXX,XX @@ static int rdma_poll_cq(RdmaDeviceResources *rdma_dev_res, struct ibv_cq *ibcq)
91
struct ibv_wc wc[2];
92
RdmaProtectedGSList *cqe_ctx_list;
93
94
- qemu_mutex_lock(&rdma_dev_res->lock);
95
- do {
96
- ne = ibv_poll_cq(ibcq, ARRAY_SIZE(wc), wc);
97
+ WITH_QEMU_LOCK_GUARD(&rdma_dev_res->lock) {
98
+ do {
99
+ ne = ibv_poll_cq(ibcq, ARRAY_SIZE(wc), wc);
100
101
- trace_rdma_poll_cq(ne, ibcq);
102
+ trace_rdma_poll_cq(ne, ibcq);
103
104
- for (i = 0; i < ne; i++) {
105
- bctx = rdma_rm_get_cqe_ctx(rdma_dev_res, wc[i].wr_id);
106
- if (unlikely(!bctx)) {
107
- rdma_error_report("No matching ctx for req %"PRId64,
108
- wc[i].wr_id);
109
- continue;
110
- }
111
+ for (i = 0; i < ne; i++) {
112
+ bctx = rdma_rm_get_cqe_ctx(rdma_dev_res, wc[i].wr_id);
113
+ if (unlikely(!bctx)) {
114
+ rdma_error_report("No matching ctx for req %"PRId64,
115
+ wc[i].wr_id);
116
+ continue;
117
+ }
118
119
- comp_handler(bctx->up_ctx, &wc[i]);
120
+ comp_handler(bctx->up_ctx, &wc[i]);
121
122
- if (bctx->backend_qp) {
123
- cqe_ctx_list = &bctx->backend_qp->cqe_ctx_list;
124
- } else {
125
- cqe_ctx_list = &bctx->backend_srq->cqe_ctx_list;
126
- }
127
+ if (bctx->backend_qp) {
128
+ cqe_ctx_list = &bctx->backend_qp->cqe_ctx_list;
129
+ } else {
130
+ cqe_ctx_list = &bctx->backend_srq->cqe_ctx_list;
131
+ }
132
133
- rdma_protected_gslist_remove_int32(cqe_ctx_list, wc[i].wr_id);
134
- rdma_rm_dealloc_cqe_ctx(rdma_dev_res, wc[i].wr_id);
135
- g_free(bctx);
136
- }
137
- total_ne += ne;
138
- } while (ne > 0);
139
- atomic_sub(&rdma_dev_res->stats.missing_cqe, total_ne);
140
- qemu_mutex_unlock(&rdma_dev_res->lock);
141
+ rdma_protected_gslist_remove_int32(cqe_ctx_list, wc[i].wr_id);
142
+ rdma_rm_dealloc_cqe_ctx(rdma_dev_res, wc[i].wr_id);
143
+ g_free(bctx);
107
+ }
144
+ }
108
+ }
145
+ total_ne += ne;
146
+ } while (ne > 0);
147
+ atomic_sub(&rdma_dev_res->stats.missing_cqe, total_ne);
109
+ }
148
+ }
110
149
111
if (conf->logical_block_size > conf->physical_block_size) {
150
if (ne < 0) {
112
error_setg(errp,
151
rdma_error_report("ibv_poll_cq fail, rc=%d, errno=%d", ne, errno);
113
diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out
152
diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c
114
index XXXXXXX..XXXXXXX 100644
153
index XXXXXXX..XXXXXXX 100644
115
--- a/tests/qemu-iotests/172.out
154
--- a/hw/rdma/rdma_rm.c
116
+++ b/tests/qemu-iotests/172.out
155
+++ b/hw/rdma/rdma_rm.c
117
@@ -XXX,XX +XXX,XX @@ Testing:
156
@@ -XXX,XX +XXX,XX @@ static inline void rdma_res_tbl_dealloc(RdmaRmResTbl *tbl, uint32_t handle)
118
dev: floppy, id ""
157
{
119
unit = 0 (0x0)
158
trace_rdma_res_tbl_dealloc(tbl->name, handle);
120
drive = "floppy0"
159
121
+ backend_defaults = "auto"
160
- qemu_mutex_lock(&tbl->lock);
122
logical_block_size = 512 (512 B)
161
+ QEMU_LOCK_GUARD(&tbl->lock);
123
physical_block_size = 512 (512 B)
162
124
min_io_size = 0 (0 B)
163
if (handle < tbl->tbl_sz) {
125
@@ -XXX,XX +XXX,XX @@ Testing: -fda TEST_DIR/t.qcow2
164
clear_bit(handle, tbl->bitmap);
126
dev: floppy, id ""
165
tbl->used--;
127
unit = 0 (0x0)
166
}
128
drive = "floppy0"
167
129
+ backend_defaults = "auto"
168
- qemu_mutex_unlock(&tbl->lock);
130
logical_block_size = 512 (512 B)
169
}
131
physical_block_size = 512 (512 B)
170
132
min_io_size = 0 (0 B)
171
int rdma_rm_alloc_pd(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev,
133
@@ -XXX,XX +XXX,XX @@ Testing: -fdb TEST_DIR/t.qcow2
134
dev: floppy, id ""
135
unit = 1 (0x1)
136
drive = "floppy1"
137
+ backend_defaults = "auto"
138
logical_block_size = 512 (512 B)
139
physical_block_size = 512 (512 B)
140
min_io_size = 0 (0 B)
141
@@ -XXX,XX +XXX,XX @@ Testing: -fdb TEST_DIR/t.qcow2
142
dev: floppy, id ""
143
unit = 0 (0x0)
144
drive = "floppy0"
145
+ backend_defaults = "auto"
146
logical_block_size = 512 (512 B)
147
physical_block_size = 512 (512 B)
148
min_io_size = 0 (0 B)
149
@@ -XXX,XX +XXX,XX @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
150
dev: floppy, id ""
151
unit = 1 (0x1)
152
drive = "floppy1"
153
+ backend_defaults = "auto"
154
logical_block_size = 512 (512 B)
155
physical_block_size = 512 (512 B)
156
min_io_size = 0 (0 B)
157
@@ -XXX,XX +XXX,XX @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
158
dev: floppy, id ""
159
unit = 0 (0x0)
160
drive = "floppy0"
161
+ backend_defaults = "auto"
162
logical_block_size = 512 (512 B)
163
physical_block_size = 512 (512 B)
164
min_io_size = 0 (0 B)
165
@@ -XXX,XX +XXX,XX @@ Testing: -fdb
166
dev: floppy, id ""
167
unit = 1 (0x1)
168
drive = "floppy1"
169
+ backend_defaults = "auto"
170
logical_block_size = 512 (512 B)
171
physical_block_size = 512 (512 B)
172
min_io_size = 0 (0 B)
173
@@ -XXX,XX +XXX,XX @@ Testing: -fdb
174
dev: floppy, id ""
175
unit = 0 (0x0)
176
drive = "floppy0"
177
+ backend_defaults = "auto"
178
logical_block_size = 512 (512 B)
179
physical_block_size = 512 (512 B)
180
min_io_size = 0 (0 B)
181
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2
182
dev: floppy, id ""
183
unit = 0 (0x0)
184
drive = "floppy0"
185
+ backend_defaults = "auto"
186
logical_block_size = 512 (512 B)
187
physical_block_size = 512 (512 B)
188
min_io_size = 0 (0 B)
189
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
190
dev: floppy, id ""
191
unit = 1 (0x1)
192
drive = "floppy1"
193
+ backend_defaults = "auto"
194
logical_block_size = 512 (512 B)
195
physical_block_size = 512 (512 B)
196
min_io_size = 0 (0 B)
197
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
198
dev: floppy, id ""
199
unit = 0 (0x0)
200
drive = "floppy0"
201
+ backend_defaults = "auto"
202
logical_block_size = 512 (512 B)
203
physical_block_size = 512 (512 B)
204
min_io_size = 0 (0 B)
205
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t
206
dev: floppy, id ""
207
unit = 1 (0x1)
208
drive = "floppy1"
209
+ backend_defaults = "auto"
210
logical_block_size = 512 (512 B)
211
physical_block_size = 512 (512 B)
212
min_io_size = 0 (0 B)
213
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t
214
dev: floppy, id ""
215
unit = 0 (0x0)
216
drive = "floppy0"
217
+ backend_defaults = "auto"
218
logical_block_size = 512 (512 B)
219
physical_block_size = 512 (512 B)
220
min_io_size = 0 (0 B)
221
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0
222
dev: floppy, id ""
223
unit = 0 (0x0)
224
drive = "none0"
225
+ backend_defaults = "auto"
226
logical_block_size = 512 (512 B)
227
physical_block_size = 512 (512 B)
228
min_io_size = 0 (0 B)
229
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,unit=1
230
dev: floppy, id ""
231
unit = 1 (0x1)
232
drive = "none0"
233
+ backend_defaults = "auto"
234
logical_block_size = 512 (512 B)
235
physical_block_size = 512 (512 B)
236
min_io_size = 0 (0 B)
237
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
238
dev: floppy, id ""
239
unit = 1 (0x1)
240
drive = "none1"
241
+ backend_defaults = "auto"
242
logical_block_size = 512 (512 B)
243
physical_block_size = 512 (512 B)
244
min_io_size = 0 (0 B)
245
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
246
dev: floppy, id ""
247
unit = 0 (0x0)
248
drive = "none0"
249
+ backend_defaults = "auto"
250
logical_block_size = 512 (512 B)
251
physical_block_size = 512 (512 B)
252
min_io_size = 0 (0 B)
253
@@ -XXX,XX +XXX,XX @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
254
dev: floppy, id ""
255
unit = 1 (0x1)
256
drive = "none0"
257
+ backend_defaults = "auto"
258
logical_block_size = 512 (512 B)
259
physical_block_size = 512 (512 B)
260
min_io_size = 0 (0 B)
261
@@ -XXX,XX +XXX,XX @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
262
dev: floppy, id ""
263
unit = 0 (0x0)
264
drive = "floppy0"
265
+ backend_defaults = "auto"
266
logical_block_size = 512 (512 B)
267
physical_block_size = 512 (512 B)
268
min_io_size = 0 (0 B)
269
@@ -XXX,XX +XXX,XX @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
270
dev: floppy, id ""
271
unit = 1 (0x1)
272
drive = "none0"
273
+ backend_defaults = "auto"
274
logical_block_size = 512 (512 B)
275
physical_block_size = 512 (512 B)
276
min_io_size = 0 (0 B)
277
@@ -XXX,XX +XXX,XX @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
278
dev: floppy, id ""
279
unit = 0 (0x0)
280
drive = "floppy0"
281
+ backend_defaults = "auto"
282
logical_block_size = 512 (512 B)
283
physical_block_size = 512 (512 B)
284
min_io_size = 0 (0 B)
285
@@ -XXX,XX +XXX,XX @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
286
dev: floppy, id ""
287
unit = 0 (0x0)
288
drive = "none0"
289
+ backend_defaults = "auto"
290
logical_block_size = 512 (512 B)
291
physical_block_size = 512 (512 B)
292
min_io_size = 0 (0 B)
293
@@ -XXX,XX +XXX,XX @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
294
dev: floppy, id ""
295
unit = 1 (0x1)
296
drive = "floppy1"
297
+ backend_defaults = "auto"
298
logical_block_size = 512 (512 B)
299
physical_block_size = 512 (512 B)
300
min_io_size = 0 (0 B)
301
@@ -XXX,XX +XXX,XX @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
302
dev: floppy, id ""
303
unit = 0 (0x0)
304
drive = "none0"
305
+ backend_defaults = "auto"
306
logical_block_size = 512 (512 B)
307
physical_block_size = 512 (512 B)
308
min_io_size = 0 (0 B)
309
@@ -XXX,XX +XXX,XX @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
310
dev: floppy, id ""
311
unit = 1 (0x1)
312
drive = "floppy1"
313
+ backend_defaults = "auto"
314
logical_block_size = 512 (512 B)
315
physical_block_size = 512 (512 B)
316
min_io_size = 0 (0 B)
317
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
318
dev: floppy, id ""
319
unit = 1 (0x1)
320
drive = "none0"
321
+ backend_defaults = "auto"
322
logical_block_size = 512 (512 B)
323
physical_block_size = 512 (512 B)
324
min_io_size = 0 (0 B)
325
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
326
dev: floppy, id ""
327
unit = 0 (0x0)
328
drive = "floppy0"
329
+ backend_defaults = "auto"
330
logical_block_size = 512 (512 B)
331
physical_block_size = 512 (512 B)
332
min_io_size = 0 (0 B)
333
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
334
dev: floppy, id ""
335
unit = 1 (0x1)
336
drive = "none0"
337
+ backend_defaults = "auto"
338
logical_block_size = 512 (512 B)
339
physical_block_size = 512 (512 B)
340
min_io_size = 0 (0 B)
341
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
342
dev: floppy, id ""
343
unit = 0 (0x0)
344
drive = "floppy0"
345
+ backend_defaults = "auto"
346
logical_block_size = 512 (512 B)
347
physical_block_size = 512 (512 B)
348
min_io_size = 0 (0 B)
349
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global floppy.drive=none0 -device
350
dev: floppy, id ""
351
unit = 0 (0x0)
352
drive = "none0"
353
+ backend_defaults = "auto"
354
logical_block_size = 512 (512 B)
355
physical_block_size = 512 (512 B)
356
min_io_size = 0 (0 B)
357
@@ -XXX,XX +XXX,XX @@ Testing: -device floppy
358
dev: floppy, id ""
359
unit = 0 (0x0)
360
drive = ""
361
+ backend_defaults = "auto"
362
logical_block_size = 512 (512 B)
363
physical_block_size = 512 (512 B)
364
min_io_size = 0 (0 B)
365
@@ -XXX,XX +XXX,XX @@ Testing: -device floppy,drive-type=120
366
dev: floppy, id ""
367
unit = 0 (0x0)
368
drive = ""
369
+ backend_defaults = "auto"
370
logical_block_size = 512 (512 B)
371
physical_block_size = 512 (512 B)
372
min_io_size = 0 (0 B)
373
@@ -XXX,XX +XXX,XX @@ Testing: -device floppy,drive-type=144
374
dev: floppy, id ""
375
unit = 0 (0x0)
376
drive = ""
377
+ backend_defaults = "auto"
378
logical_block_size = 512 (512 B)
379
physical_block_size = 512 (512 B)
380
min_io_size = 0 (0 B)
381
@@ -XXX,XX +XXX,XX @@ Testing: -device floppy,drive-type=288
382
dev: floppy, id ""
383
unit = 0 (0x0)
384
drive = ""
385
+ backend_defaults = "auto"
386
logical_block_size = 512 (512 B)
387
physical_block_size = 512 (512 B)
388
min_io_size = 0 (0 B)
389
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
390
dev: floppy, id ""
391
unit = 0 (0x0)
392
drive = "none0"
393
+ backend_defaults = "auto"
394
logical_block_size = 512 (512 B)
395
physical_block_size = 512 (512 B)
396
min_io_size = 0 (0 B)
397
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
398
dev: floppy, id ""
399
unit = 0 (0x0)
400
drive = "none0"
401
+ backend_defaults = "auto"
402
logical_block_size = 512 (512 B)
403
physical_block_size = 512 (512 B)
404
min_io_size = 0 (0 B)
405
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,logical
406
dev: floppy, id ""
407
unit = 0 (0x0)
408
drive = "none0"
409
+ backend_defaults = "auto"
410
logical_block_size = 512 (512 B)
411
physical_block_size = 512 (512 B)
412
min_io_size = 0 (0 B)
413
@@ -XXX,XX +XXX,XX @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,physica
414
dev: floppy, id ""
415
unit = 0 (0x0)
416
drive = "none0"
417
+ backend_defaults = "auto"
418
logical_block_size = 512 (512 B)
419
physical_block_size = 512 (512 B)
420
min_io_size = 0 (0 B)
421
--
172
--
422
2.31.1
173
2.25.3
423
174
diff view generated by jsdifflib