1
The following changes since commit 22c5f446514a2a4bb0dbe1fea26713da92fc85fa:
1
The following changes since commit 15ef89d2a1a7b93845a6b09c2ee8e1979f6eb30b:
2
2
3
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190211' into staging (2019-02-11 17:04:57 +0000)
3
Update version for v7.0.0-rc1 release (2022-03-22 22:58:44 +0000)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
git://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 9a6719d572e99a4e79f589d0b73f7475b86f982d:
9
for you to fetch changes up to 2539eade4f689eda7e9fe45486f18334bfbafaf0:
10
10
11
virtio-blk: cleanup using VirtIOBlock *s and VirtIODevice *vdev (2019-02-12 11:49:17 +0800)
11
hw: Fix misleading hexadecimal format (2022-03-24 10:38:42 +0000)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Pull request
14
Pull request
15
15
16
Philippe found cases where the 0x%d format string was used, leading to
17
misleading output. The patches look harmless and could save people time, so I
18
think it's worth including them in 7.0.
19
16
----------------------------------------------------------------
20
----------------------------------------------------------------
17
21
18
Peter Xu (1):
22
Philippe Mathieu-Daudé (2):
19
iothread: fix iothread hang when stop too soon
23
block: Fix misleading hexadecimal format
24
hw: Fix misleading hexadecimal format
20
25
21
Stefano Garzarella (1):
26
block/parallels-ext.c | 2 +-
22
virtio-blk: cleanup using VirtIOBlock *s and VirtIODevice *vdev
27
hw/i386/sgx.c | 2 +-
23
28
hw/i386/trace-events | 6 +++---
24
Vladimir Sementsov-Ogievskiy (1):
29
hw/misc/trace-events | 4 ++--
25
qemugdb/coroutine: fix arch_prctl has unknown return type
30
hw/scsi/trace-events | 4 ++--
26
31
5 files changed, 9 insertions(+), 9 deletions(-)
27
hw/block/virtio-blk.c | 22 +++++++++-------------
28
iothread.c | 6 +++++-
29
scripts/qemugdb/coroutine.py | 2 +-
30
3 files changed, 15 insertions(+), 15 deletions(-)
31
32
32
--
33
--
33
2.20.1
34
2.35.1
34
35
35
diff view generated by jsdifflib
Deleted patch
1
From: Peter Xu <peterx@redhat.com>
2
1
3
Lukas reported an hard to reproduce QMP iothread hang on s390 that
4
QEMU might hang at pthread_join() of the QMP monitor iothread before
5
quitting:
6
7
Thread 1
8
#0 0x000003ffad10932c in pthread_join
9
#1 0x0000000109e95750 in qemu_thread_join
10
at /home/thuth/devel/qemu/util/qemu-thread-posix.c:570
11
#2 0x0000000109c95a1c in iothread_stop
12
#3 0x0000000109bb0874 in monitor_cleanup
13
#4 0x0000000109b55042 in main
14
15
While the iothread is still in the main loop:
16
17
Thread 4
18
#0 0x000003ffad0010e4 in ??
19
#1 0x000003ffad553958 in g_main_context_iterate.isra.19
20
#2 0x000003ffad553d90 in g_main_loop_run
21
#3 0x0000000109c9585a in iothread_run
22
at /home/thuth/devel/qemu/iothread.c:74
23
#4 0x0000000109e94752 in qemu_thread_start
24
at /home/thuth/devel/qemu/util/qemu-thread-posix.c:502
25
#5 0x000003ffad10825a in start_thread
26
#6 0x000003ffad00dcf2 in thread_start
27
28
IMHO it's because there's a race between the main thread and iothread
29
when stopping the thread in following sequence:
30
31
main thread iothread
32
=========== ==============
33
aio_poll()
34
iothread_get_g_main_context
35
set iothread->worker_context
36
iothread_stop
37
schedule iothread_stop_bh
38
execute iothread_stop_bh [1]
39
set iothread->running=false
40
(since main_loop==NULL so
41
skip to quit main loop.
42
Note: although main_loop is
43
NULL but worker_context is
44
not!)
45
atomic_read(&iothread->worker_context) [2]
46
create main_loop object
47
g_main_loop_run() [3]
48
pthread_join() [4]
49
50
We can see that when execute iothread_stop_bh() at [1] it's possible
51
that main_loop is still NULL because it's only created until the first
52
check of the worker_context later at [2]. Then the iothread will hang
53
in the main loop [3] and it'll starve the main thread too [4].
54
55
Here the simple solution should be that we check again the "running"
56
variable before check against worker_context.
57
58
CC: Thomas Huth <thuth@redhat.com>
59
CC: Dr. David Alan Gilbert <dgilbert@redhat.com>
60
CC: Stefan Hajnoczi <stefanha@redhat.com>
61
CC: Lukáš Doktor <ldoktor@redhat.com>
62
CC: Markus Armbruster <armbru@redhat.com>
63
CC: Eric Blake <eblake@redhat.com>
64
CC: Paolo Bonzini <pbonzini@redhat.com>
65
Reported-by: Lukáš Doktor <ldoktor@redhat.com>
66
Signed-off-by: Peter Xu <peterx@redhat.com>
67
Tested-by: Thomas Huth <thuth@redhat.com>
68
Message-id: 20190129051432.22023-1-peterx@redhat.com
69
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
70
---
71
iothread.c | 6 +++++-
72
1 file changed, 5 insertions(+), 1 deletion(-)
73
74
diff --git a/iothread.c b/iothread.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/iothread.c
77
+++ b/iothread.c
78
@@ -XXX,XX +XXX,XX @@ static void *iothread_run(void *opaque)
79
while (iothread->running) {
80
aio_poll(iothread->ctx, true);
81
82
- if (atomic_read(&iothread->worker_context)) {
83
+ /*
84
+ * We must check the running state again in case it was
85
+ * changed in previous aio_poll()
86
+ */
87
+ if (iothread->running && atomic_read(&iothread->worker_context)) {
88
GMainLoop *loop;
89
90
g_main_context_push_thread_default(iothread->worker_context);
91
--
92
2.20.1
93
94
diff view generated by jsdifflib
1
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
qemu coroutine command results in following error output:
3
"0x%u" format is very misleading, replace by "0x%x".
4
4
5
Python Exception <class 'gdb.error'> 'arch_prctl' has unknown return
5
Found running:
6
type; cast the call to its declared return type: Error occurred in
7
Python command: 'arch_prctl' has unknown return type; cast the call to
8
its declared return type
9
6
10
Fix it by giving it what it wants: arch_prctl return type.
7
$ git grep -E '0x%[0-9]*([lL]*|" ?PRI)[dDuU]' block/
11
8
12
Information on the topic:
9
Inspired-by: Richard Henderson <richard.henderson@linaro.org>
13
https://sourceware.org/gdb/onlinedocs/gdb/Calling.html
10
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
11
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
15
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
12
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
16
Message-id: 20190206151425.105871-1-vsementsov@virtuozzo.com
13
Reviewed-by: Denis V. Lunev <den@openvz.org>
14
Message-id: 20220323114718.58714-2-philippe.mathieu.daude@gmail.com
17
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
18
---
16
---
19
scripts/qemugdb/coroutine.py | 2 +-
17
block/parallels-ext.c | 2 +-
20
1 file changed, 1 insertion(+), 1 deletion(-)
18
1 file changed, 1 insertion(+), 1 deletion(-)
21
19
22
diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py
20
diff --git a/block/parallels-ext.c b/block/parallels-ext.c
23
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
24
--- a/scripts/qemugdb/coroutine.py
22
--- a/block/parallels-ext.c
25
+++ b/scripts/qemugdb/coroutine.py
23
+++ b/block/parallels-ext.c
26
@@ -XXX,XX +XXX,XX @@ def get_fs_base():
24
@@ -XXX,XX +XXX,XX @@ static int parallels_parse_format_extension(BlockDriverState *bs,
27
pthread_self().'''
25
break;
28
# %rsp - 120 is scratch space according to the SystemV ABI
26
29
old = gdb.parse_and_eval('*(uint64_t*)($rsp - 120)')
27
default:
30
- gdb.execute('call arch_prctl(0x1003, $rsp - 120)', False, True)
28
- error_setg(errp, "Unknown feature: 0x%" PRIu64, fh.magic);
31
+ gdb.execute('call (int)arch_prctl(0x1003, $rsp - 120)', False, True)
29
+ error_setg(errp, "Unknown feature: 0x%" PRIx64, fh.magic);
32
fs_base = gdb.parse_and_eval('*(uint64_t*)($rsp - 120)')
30
goto fail;
33
gdb.execute('set *(uint64_t*)($rsp - 120) = %s' % old, False, True)
31
}
34
return fs_base
32
35
--
33
--
36
2.20.1
34
2.35.1
37
35
38
36
diff view generated by jsdifflib
1
From: Stefano Garzarella <sgarzare@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
In several part we still using req->dev or VIRTIO_DEVICE(req->dev)
3
"0x%u" format is very misleading, replace by "0x%x".
4
when we have already defined s and vdev pointers:
5
VirtIOBlock *s = req->dev;
6
VirtIODevice *vdev = VIRTIO_DEVICE(s);
7
4
8
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
5
Found running:
9
Reviewed-by: Liam Merwick <liam.merwick@oracle.com>
6
10
Message-id: 20190208142347.214815-1-sgarzare@redhat.com
7
$ git grep -E '0x%[0-9]*([lL]*|" ?PRI)[dDuU]' hw/
8
9
Inspired-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
12
Message-id: 20220323114718.58714-3-philippe.mathieu.daude@gmail.com
11
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
---
14
---
13
hw/block/virtio-blk.c | 22 +++++++++-------------
15
hw/i386/sgx.c | 2 +-
14
1 file changed, 9 insertions(+), 13 deletions(-)
16
hw/i386/trace-events | 6 +++---
17
hw/misc/trace-events | 4 ++--
18
hw/scsi/trace-events | 4 ++--
19
4 files changed, 8 insertions(+), 8 deletions(-)
15
20
16
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
21
diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
17
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/block/virtio-blk.c
23
--- a/hw/i386/sgx.c
19
+++ b/hw/block/virtio-blk.c
24
+++ b/hw/i386/sgx.c
20
@@ -XXX,XX +XXX,XX @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status)
25
@@ -XXX,XX +XXX,XX @@ void pc_machine_init_sgx_epc(PCMachineState *pcms)
21
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
22
bool is_read)
23
{
24
- BlockErrorAction action = blk_get_error_action(req->dev->blk,
25
- is_read, error);
26
VirtIOBlock *s = req->dev;
27
+ BlockErrorAction action = blk_get_error_action(s->blk, is_read, error);
28
29
if (action == BLOCK_ERROR_ACTION_STOP) {
30
/* Break the link as the next request is going to be parsed from the
31
@@ -XXX,XX +XXX,XX @@ static void virtio_blk_flush_complete(void *opaque, int ret)
32
}
26
}
33
27
34
virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
28
if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) {
35
- block_acct_done(blk_get_stats(req->dev->blk), &req->acct);
29
- error_report("Size of all 'sgx-epc' =0x%"PRIu64" causes EPC to wrap",
36
+ block_acct_done(blk_get_stats(s->blk), &req->acct);
30
+ error_report("Size of all 'sgx-epc' =0x%"PRIx64" causes EPC to wrap",
37
virtio_blk_free_request(req);
31
sgx_epc->size);
38
32
exit(EXIT_FAILURE);
39
out:
33
}
40
@@ -XXX,XX +XXX,XX @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
34
diff --git a/hw/i386/trace-events b/hw/i386/trace-events
41
- sizeof(struct virtio_blk_inhdr);
35
index XXXXXXX..XXXXXXX 100644
42
iov_discard_back(in_iov, &in_num, sizeof(struct virtio_blk_inhdr));
36
--- a/hw/i386/trace-events
43
37
+++ b/hw/i386/trace-events
44
- type = virtio_ldl_p(VIRTIO_DEVICE(req->dev), &req->out.type);
38
@@ -XXX,XX +XXX,XX @@ vtd_fault_disabled(void) "Fault processing disabled for context entry"
45
+ type = virtio_ldl_p(vdev, &req->out.type);
39
vtd_replay_ce_valid(const char *mode, uint8_t bus, uint8_t dev, uint8_t fn, uint16_t domain, uint64_t hi, uint64_t lo) "%s: replay valid context device %02"PRIx8":%02"PRIx8".%02"PRIx8" domain 0x%"PRIx16" hi 0x%"PRIx64" lo 0x%"PRIx64
46
40
vtd_replay_ce_invalid(uint8_t bus, uint8_t dev, uint8_t fn) "replay invalid context device %02"PRIx8":%02"PRIx8".%02"PRIx8
47
/* VIRTIO_BLK_T_OUT defines the command direction. VIRTIO_BLK_T_BARRIER
41
vtd_page_walk_level(uint64_t addr, uint32_t level, uint64_t start, uint64_t end) "walk (base=0x%"PRIx64", level=%"PRIu32") iova range 0x%"PRIx64" - 0x%"PRIx64
48
* is an optional flag. Although a guest should not send this flag if
42
-vtd_page_walk_one(uint16_t domain, uint64_t iova, uint64_t gpa, uint64_t mask, int perm) "domain 0x%"PRIu16" iova 0x%"PRIx64" -> gpa 0x%"PRIx64" mask 0x%"PRIx64" perm %d"
49
@@ -XXX,XX +XXX,XX @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
43
+vtd_page_walk_one(uint16_t domain, uint64_t iova, uint64_t gpa, uint64_t mask, int perm) "domain 0x%"PRIx16" iova 0x%"PRIx64" -> gpa 0x%"PRIx64" mask 0x%"PRIx64" perm %d"
50
case VIRTIO_BLK_T_IN:
44
vtd_page_walk_one_skip_map(uint64_t iova, uint64_t mask, uint64_t translated) "iova 0x%"PRIx64" mask 0x%"PRIx64" translated 0x%"PRIx64
51
{
45
vtd_page_walk_one_skip_unmap(uint64_t iova, uint64_t mask) "iova 0x%"PRIx64" mask 0x%"PRIx64
52
bool is_write = type & VIRTIO_BLK_T_OUT;
46
vtd_page_walk_skip_read(uint64_t iova, uint64_t next) "Page walk skip iova 0x%"PRIx64" - 0x%"PRIx64" due to unable to read"
53
- req->sector_num = virtio_ldq_p(VIRTIO_DEVICE(req->dev),
47
vtd_page_walk_skip_reserve(uint64_t iova, uint64_t next) "Page walk skip iova 0x%"PRIx64" - 0x%"PRIx64" due to rsrv set"
54
- &req->out.sector);
48
vtd_switch_address_space(uint8_t bus, uint8_t slot, uint8_t fn, bool on) "Device %02x:%02x.%x switching address space (iommu enabled=%d)"
55
+ req->sector_num = virtio_ldq_p(vdev, &req->out.sector);
49
vtd_as_unmap_whole(uint8_t bus, uint8_t slot, uint8_t fn, uint64_t iova, uint64_t size) "Device %02x:%02x.%x start 0x%"PRIx64" size 0x%"PRIx64
56
50
-vtd_translate_pt(uint16_t sid, uint64_t addr) "source id 0x%"PRIu16", iova 0x%"PRIx64
57
if (is_write) {
51
-vtd_pt_enable_fast_path(uint16_t sid, bool success) "sid 0x%"PRIu16" %d"
58
qemu_iovec_init_external(&req->qiov, out_iov, out_num);
52
+vtd_translate_pt(uint16_t sid, uint64_t addr) "source id 0x%"PRIx16", iova 0x%"PRIx64
59
@@ -XXX,XX +XXX,XX @@ static int virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
53
+vtd_pt_enable_fast_path(uint16_t sid, bool success) "sid 0x%"PRIx16" %d"
60
req->qiov.size / BDRV_SECTOR_SIZE);
54
vtd_irq_generate(uint64_t addr, uint64_t data) "addr 0x%"PRIx64" data 0x%"PRIx64
61
}
55
vtd_reg_read(uint64_t addr, uint64_t size) "addr 0x%"PRIx64" size 0x%"PRIx64
62
56
vtd_reg_write(uint64_t addr, uint64_t size, uint64_t val) "addr 0x%"PRIx64" size 0x%"PRIx64" value 0x%"PRIx64
63
- if (!virtio_blk_sect_range_ok(req->dev, req->sector_num,
57
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
64
- req->qiov.size)) {
58
index XXXXXXX..XXXXXXX 100644
65
+ if (!virtio_blk_sect_range_ok(s, req->sector_num, req->qiov.size)) {
59
--- a/hw/misc/trace-events
66
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
60
+++ b/hw/misc/trace-events
67
- block_acct_invalid(blk_get_stats(req->dev->blk),
61
@@ -XXX,XX +XXX,XX @@
68
+ block_acct_invalid(blk_get_stats(s->blk),
62
# See docs/devel/tracing.rst for syntax documentation.
69
is_write ? BLOCK_ACCT_WRITE : BLOCK_ACCT_READ);
63
70
virtio_blk_free_request(req);
64
# allwinner-cpucfg.c
71
return 0;
65
-allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIu32
72
}
66
+allwinner_cpucfg_cpu_reset(uint8_t cpu_id, uint32_t reset_addr) "id %u, reset_addr 0x%" PRIx32
73
67
allwinner_cpucfg_read(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32
74
- block_acct_start(blk_get_stats(req->dev->blk),
68
allwinner_cpucfg_write(uint64_t offset, uint64_t data, unsigned size) "offset 0x%" PRIx64 " data 0x%" PRIx64 " size %" PRIu32
75
- &req->acct, req->qiov.size,
69
76
+ block_acct_start(blk_get_stats(s->blk), &req->acct, req->qiov.size,
70
@@ -XXX,XX +XXX,XX @@ imx7_gpr_write(uint64_t offset, uint64_t value) "addr 0x%08" PRIx64 "value 0x%08
77
is_write ? BLOCK_ACCT_WRITE : BLOCK_ACCT_READ);
71
78
72
# mos6522.c
79
/* merge would exceed maximum number of requests or IO direction
73
mos6522_set_counter(int index, unsigned int val) "T%d.counter=%d"
80
* changes */
74
-mos6522_get_next_irq_time(uint16_t latch, int64_t d, int64_t delta) "latch=%d counter=0x%"PRId64 " delta_next=0x%"PRId64
81
if (mrb->num_reqs > 0 && (mrb->num_reqs == VIRTIO_BLK_MAX_MERGE_REQS ||
75
+mos6522_get_next_irq_time(uint16_t latch, int64_t d, int64_t delta) "latch=%d counter=0x%"PRIx64 " delta_next=0x%"PRIx64
82
is_write != mrb->is_write ||
76
mos6522_set_sr_int(void) "set sr_int"
83
- !req->dev->conf.request_merging)) {
77
mos6522_write(uint64_t addr, const char *name, uint64_t val) "reg=0x%"PRIx64 " [%s] val=0x%"PRIx64
84
- virtio_blk_submit_multireq(req->dev->blk, mrb);
78
mos6522_read(uint64_t addr, const char *name, unsigned val) "reg=0x%"PRIx64 " [%s] val=0x%x"
85
+ !s->conf.request_merging)) {
79
diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events
86
+ virtio_blk_submit_multireq(s->blk, mrb);
80
index XXXXXXX..XXXXXXX 100644
87
}
81
--- a/hw/scsi/trace-events
88
82
+++ b/hw/scsi/trace-events
89
assert(mrb->num_reqs < VIRTIO_BLK_MAX_MERGE_REQS);
83
@@ -XXX,XX +XXX,XX @@ lsi_bad_phase_interrupt(void) "Phase mismatch interrupt"
84
lsi_bad_selection(uint32_t id) "Selected absent target %"PRIu32
85
lsi_do_dma_unavailable(void) "DMA no data available"
86
lsi_do_dma(uint64_t addr, int len) "DMA addr=0x%"PRIx64" len=%d"
87
-lsi_queue_command(uint32_t tag) "Queueing tag=0x%"PRId32
88
+lsi_queue_command(uint32_t tag) "Queueing tag=0x%"PRIx32
89
lsi_add_msg_byte_error(void) "MSG IN data too long"
90
lsi_add_msg_byte(uint8_t data) "MSG IN 0x%02x"
91
lsi_reselect(int id) "Reselected target %d"
92
@@ -XXX,XX +XXX,XX @@ lsi_do_msgout_noop(void) "MSG: No Operation"
93
lsi_do_msgout_extended(uint8_t msg, uint8_t len) "Extended message 0x%x (len %d)"
94
lsi_do_msgout_ignored(const char *msg) "%s (ignored)"
95
lsi_do_msgout_simplequeue(uint8_t select_tag) "SIMPLE queue tag=0x%x"
96
-lsi_do_msgout_abort(uint32_t tag) "MSG: ABORT TAG tag=0x%"PRId32
97
+lsi_do_msgout_abort(uint32_t tag) "MSG: ABORT TAG tag=0x%"PRIx32
98
lsi_do_msgout_clearqueue(uint32_t tag) "MSG: CLEAR QUEUE tag=0x%"PRIx32
99
lsi_do_msgout_busdevicereset(uint32_t tag) "MSG: BUS DEVICE RESET tag=0x%"PRIx32
100
lsi_do_msgout_select(int id) "Select LUN %d"
90
--
101
--
91
2.20.1
102
2.35.1
92
103
93
104
diff view generated by jsdifflib