1
The following changes since commit 64175afc695c0672876fbbfc31b299c86d562cb4:
1
The following changes since commit d147f7e815f97cb477e223586bcb80c316ae10ea:
2
2
3
arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented (2017-06-07 17:21:44 +0100)
3
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging (2017-10-03 16:27:24 +0100)
4
4
5
are available in the git repository at:
5
are available in the git repository at:
6
6
7
git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request
7
git://github.com/stefanha/qemu.git tags/block-pull-request
8
8
9
for you to fetch changes up to 56faeb9bb6872b3f926b3b3e0452a70beea10af2:
9
for you to fetch changes up to f708a5e71cba0d784e307334c07ade5f56f827ab:
10
10
11
block/gluster.c: Handle qdict_array_entries() failure (2017-06-09 08:41:29 -0400)
11
aio: fix assert when remove poll during destroy (2017-10-03 14:36:19 -0400)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Gluster patch
14
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
16
17
Peter Maydell (1):
17
Peter Xu (4):
18
block/gluster.c: Handle qdict_array_entries() failure
18
qom: provide root container for internal objs
19
iothread: provide helpers for internal use
20
iothread: export iothread_stop()
21
iothread: delay the context release to finalize
19
22
20
block/gluster.c | 3 +--
23
Stefan Hajnoczi (1):
21
1 file changed, 1 insertion(+), 2 deletions(-)
24
aio: fix assert when remove poll during destroy
25
26
include/qom/object.h | 11 +++++++++++
27
include/sysemu/iothread.h | 9 +++++++++
28
iothread.c | 46 ++++++++++++++++++++++++++++++++++++----------
29
qom/object.c | 11 +++++++++++
30
util/aio-posix.c | 9 ++++++++-
31
5 files changed, 75 insertions(+), 11 deletions(-)
22
32
23
--
33
--
24
2.9.3
34
2.13.6
25
35
26
36
diff view generated by jsdifflib
New patch
1
From: Peter Xu <peterx@redhat.com>
1
2
3
We have object_get_objects_root() to keep user created objects, however
4
no place for objects that will be used internally. Create such a
5
container for internal objects.
6
7
CC: Andreas Färber <afaerber@suse.de>
8
CC: Markus Armbruster <armbru@redhat.com>
9
CC: Paolo Bonzini <pbonzini@redhat.com>
10
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
11
Signed-off-by: Peter Xu <peterx@redhat.com>
12
Reviewed-by: Fam Zheng <famz@redhat.com>
13
Message-id: 20170928025958.1420-2-peterx@redhat.com
14
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
15
---
16
include/qom/object.h | 11 +++++++++++
17
qom/object.c | 11 +++++++++++
18
2 files changed, 22 insertions(+)
19
20
diff --git a/include/qom/object.h b/include/qom/object.h
21
index XXXXXXX..XXXXXXX 100644
22
--- a/include/qom/object.h
23
+++ b/include/qom/object.h
24
@@ -XXX,XX +XXX,XX @@ Object *object_get_root(void);
25
Object *object_get_objects_root(void);
26
27
/**
28
+ * object_get_internal_root:
29
+ *
30
+ * Get the container object that holds internally used object
31
+ * instances. Any object which is put into this container must not be
32
+ * user visible, and it will not be exposed in the QOM tree.
33
+ *
34
+ * Returns: the internal object container
35
+ */
36
+Object *object_get_internal_root(void);
37
+
38
+/**
39
* object_get_canonical_path_component:
40
*
41
* Returns: The final component in the object's canonical path. The canonical
42
diff --git a/qom/object.c b/qom/object.c
43
index XXXXXXX..XXXXXXX 100644
44
--- a/qom/object.c
45
+++ b/qom/object.c
46
@@ -XXX,XX +XXX,XX @@ Object *object_get_objects_root(void)
47
return container_get(object_get_root(), "/objects");
48
}
49
50
+Object *object_get_internal_root(void)
51
+{
52
+ static Object *internal_root;
53
+
54
+ if (!internal_root) {
55
+ internal_root = object_new("container");
56
+ }
57
+
58
+ return internal_root;
59
+}
60
+
61
static void object_get_child_property(Object *obj, Visitor *v,
62
const char *name, void *opaque,
63
Error **errp)
64
--
65
2.13.6
66
67
diff view generated by jsdifflib
New patch
1
From: Peter Xu <peterx@redhat.com>
1
2
3
IOThread is a general framework that contains IO loop environment and a
4
real thread behind. It's also good to be used internally inside qemu.
5
Provide some helpers for it to create iothreads to be used internally.
6
7
Put all the internal used iothreads into the internal object container.
8
9
Reviewed-by: Fam Zheng <famz@redhat.com>
10
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
11
Signed-off-by: Peter Xu <peterx@redhat.com>
12
Message-id: 20170928025958.1420-3-peterx@redhat.com
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
14
---
15
include/sysemu/iothread.h | 8 ++++++++
16
iothread.c | 16 ++++++++++++++++
17
2 files changed, 24 insertions(+)
18
19
diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/sysemu/iothread.h
22
+++ b/include/sysemu/iothread.h
23
@@ -XXX,XX +XXX,XX @@ AioContext *iothread_get_aio_context(IOThread *iothread);
24
void iothread_stop_all(void);
25
GMainContext *iothread_get_g_main_context(IOThread *iothread);
26
27
+/*
28
+ * Helpers used to allocate iothreads for internal use. These
29
+ * iothreads will not be seen by monitor clients when query using
30
+ * "query-iothreads".
31
+ */
32
+IOThread *iothread_create(const char *id, Error **errp);
33
+void iothread_destroy(IOThread *iothread);
34
+
35
#endif /* IOTHREAD_H */
36
diff --git a/iothread.c b/iothread.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/iothread.c
39
+++ b/iothread.c
40
@@ -XXX,XX +XXX,XX @@ GMainContext *iothread_get_g_main_context(IOThread *iothread)
41
42
return iothread->worker_context;
43
}
44
+
45
+IOThread *iothread_create(const char *id, Error **errp)
46
+{
47
+ Object *obj;
48
+
49
+ obj = object_new_with_props(TYPE_IOTHREAD,
50
+ object_get_internal_root(),
51
+ id, errp, NULL);
52
+
53
+ return IOTHREAD(obj);
54
+}
55
+
56
+void iothread_destroy(IOThread *iothread)
57
+{
58
+ object_unparent(OBJECT(iothread));
59
+}
60
--
61
2.13.6
62
63
diff view generated by jsdifflib
New patch
1
From: Peter Xu <peterx@redhat.com>
1
2
3
So that internal iothread users can explicitly stop one iothread without
4
destroying it.
5
6
Since at it, fix iothread_stop() to allow it to be called multiple
7
times. Before this patch we may call iothread_stop() more than once on
8
single iothread, while that may not be correct since qemu_thread_join()
9
is not allowed to run twice. From manual of pthread_join():
10
11
Joining with a thread that has previously been joined results in
12
undefined behavior.
13
14
Reviewed-by: Fam Zheng <famz@redhat.com>
15
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
16
Signed-off-by: Peter Xu <peterx@redhat.com>
17
Message-id: 20170928025958.1420-4-peterx@redhat.com
18
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
19
---
20
include/sysemu/iothread.h | 1 +
21
iothread.c | 24 ++++++++++++++++--------
22
2 files changed, 17 insertions(+), 8 deletions(-)
23
24
diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/include/sysemu/iothread.h
27
+++ b/include/sysemu/iothread.h
28
@@ -XXX,XX +XXX,XX @@ GMainContext *iothread_get_g_main_context(IOThread *iothread);
29
* "query-iothreads".
30
*/
31
IOThread *iothread_create(const char *id, Error **errp);
32
+void iothread_stop(IOThread *iothread);
33
void iothread_destroy(IOThread *iothread);
34
35
#endif /* IOTHREAD_H */
36
diff --git a/iothread.c b/iothread.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/iothread.c
39
+++ b/iothread.c
40
@@ -XXX,XX +XXX,XX @@ static void *iothread_run(void *opaque)
41
return NULL;
42
}
43
44
-static int iothread_stop(Object *object, void *opaque)
45
+void iothread_stop(IOThread *iothread)
46
{
47
- IOThread *iothread;
48
-
49
- iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD);
50
- if (!iothread || !iothread->ctx || iothread->stopping) {
51
- return 0;
52
+ if (!iothread->ctx || iothread->stopping) {
53
+ return;
54
}
55
iothread->stopping = true;
56
aio_notify(iothread->ctx);
57
@@ -XXX,XX +XXX,XX @@ static int iothread_stop(Object *object, void *opaque)
58
g_main_loop_quit(iothread->main_loop);
59
}
60
qemu_thread_join(&iothread->thread);
61
+}
62
+
63
+static int iothread_stop_iter(Object *object, void *opaque)
64
+{
65
+ IOThread *iothread;
66
+
67
+ iothread = (IOThread *)object_dynamic_cast(object, TYPE_IOTHREAD);
68
+ if (!iothread) {
69
+ return 0;
70
+ }
71
+ iothread_stop(iothread);
72
return 0;
73
}
74
75
@@ -XXX,XX +XXX,XX @@ static void iothread_instance_finalize(Object *obj)
76
{
77
IOThread *iothread = IOTHREAD(obj);
78
79
- iothread_stop(obj, NULL);
80
+ iothread_stop(iothread);
81
qemu_cond_destroy(&iothread->init_done_cond);
82
qemu_mutex_destroy(&iothread->init_done_lock);
83
if (!iothread->ctx) {
84
@@ -XXX,XX +XXX,XX @@ void iothread_stop_all(void)
85
aio_context_release(ctx);
86
}
87
88
- object_child_foreach(container, iothread_stop, NULL);
89
+ object_child_foreach(container, iothread_stop_iter, NULL);
90
}
91
92
static gpointer iothread_g_main_context_init(gpointer opaque)
93
--
94
2.13.6
95
96
diff view generated by jsdifflib
New patch
1
From: Peter Xu <peterx@redhat.com>
1
2
3
When gcontext is used with iothread, the context will be destroyed
4
during iothread_stop(). That's not good since sometimes we would like
5
to keep the resources until iothread is destroyed, but we may want to
6
stop the thread before that point.
7
8
Delay the destruction of gcontext to iothread finalize. Then we can do:
9
10
iothread_stop(thread);
11
some_cleanup_on_resources();
12
iothread_destroy(thread);
13
14
We may need this patch if we want to run chardev IOs in iothreads and
15
hopefully clean them up correctly. For more specific information,
16
please see 2b316774f6 ("qemu-char: do not operate on sources from
17
finalize callbacks").
18
19
Reviewed-by: Fam Zheng <famz@redhat.com>
20
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
21
Signed-off-by: Peter Xu <peterx@redhat.com>
22
Message-id: 20170928025958.1420-5-peterx@redhat.com
23
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
24
---
25
iothread.c | 6 ++++--
26
1 file changed, 4 insertions(+), 2 deletions(-)
27
28
diff --git a/iothread.c b/iothread.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/iothread.c
31
+++ b/iothread.c
32
@@ -XXX,XX +XXX,XX @@ static void *iothread_run(void *opaque)
33
g_main_loop_unref(loop);
34
35
g_main_context_pop_thread_default(iothread->worker_context);
36
- g_main_context_unref(iothread->worker_context);
37
- iothread->worker_context = NULL;
38
}
39
}
40
41
@@ -XXX,XX +XXX,XX @@ static void iothread_instance_finalize(Object *obj)
42
IOThread *iothread = IOTHREAD(obj);
43
44
iothread_stop(iothread);
45
+ if (iothread->worker_context) {
46
+ g_main_context_unref(iothread->worker_context);
47
+ iothread->worker_context = NULL;
48
+ }
49
qemu_cond_destroy(&iothread->init_done_cond);
50
qemu_mutex_destroy(&iothread->init_done_lock);
51
if (!iothread->ctx) {
52
--
53
2.13.6
54
55
diff view generated by jsdifflib
1
From: Peter Maydell <peter.maydell@linaro.org>
1
After iothread is enabled internally inside QEMU with GMainContext, we
2
may encounter this warning when destroying the iothread:
2
3
3
In qemu_gluster_parse_json(), the call to qdict_array_entries()
4
(qemu-system-x86_64:19925): GLib-CRITICAL **: g_source_remove_poll:
4
could return a negative error code, which we were ignoring
5
assertion '!SOURCE_DESTROYED (source)' failed
5
because we assigned the result to an unsigned variable.
6
Fix this by using the 'int' type instead, which matches the
7
return type of qdict_array_entries() and also the type
8
we use for the loop enumeration variable 'i'.
9
6
10
(Spotted by Coverity, CID 1360960.)
7
The problem is that g_source_remove_poll() does not allow to remove one
8
source from array if the source is detached from its owner
9
context. (peterx: which IMHO does not make much sense)
11
10
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Fix it on QEMU side by avoid calling g_source_remove_poll() if we know
13
Reviewed-by: Eric Blake <eblake@redhat.com>
12
the object is during destruction, and we won't leak anything after all
14
Reviewed-by: Jeff Cody <jcody@redhat.com>
13
since the array will be gone soon cleanly even with that fd.
15
Message-id: 1496682098-1540-1-git-send-email-peter.maydell@linaro.org
14
16
Signed-off-by: Jeff Cody <jcody@redhat.com>
15
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
16
Reviewed-by: Fam Zheng <famz@redhat.com>
17
Signed-off-by: Peter Xu <peterx@redhat.com>
18
Message-id: 20170928025958.1420-6-peterx@redhat.com
19
[peterx: write the commit message]
20
Signed-off-by: Peter Xu <peterx@redhat.com>
21
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
---
22
---
18
block/gluster.c | 3 +--
23
util/aio-posix.c | 9 ++++++++-
19
1 file changed, 1 insertion(+), 2 deletions(-)
24
1 file changed, 8 insertions(+), 1 deletion(-)
20
25
21
diff --git a/block/gluster.c b/block/gluster.c
26
diff --git a/util/aio-posix.c b/util/aio-posix.c
22
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
23
--- a/block/gluster.c
28
--- a/util/aio-posix.c
24
+++ b/block/gluster.c
29
+++ b/util/aio-posix.c
25
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
30
@@ -XXX,XX +XXX,XX @@ void aio_set_fd_handler(AioContext *ctx,
26
Error *local_err = NULL;
31
return;
27
char *str = NULL;
32
}
28
const char *ptr;
33
29
- size_t num_servers;
34
- g_source_remove_poll(&ctx->source, &node->pfd);
30
- int i, type;
35
+ /* If the GSource is in the process of being destroyed then
31
+ int i, type, num_servers;
36
+ * g_source_remove_poll() causes an assertion failure. Skip
32
37
+ * removal in that case, because glib cleans up its state during
33
/* create opts info from runtime_json_opts list */
38
+ * destruction anyway.
34
opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort);
39
+ */
40
+ if (!g_source_is_destroyed(&ctx->source)) {
41
+ g_source_remove_poll(&ctx->source, &node->pfd);
42
+ }
43
44
/* If the lock is held, just mark the node as deleted */
45
if (qemu_lockcnt_count(&ctx->list_lock)) {
35
--
46
--
36
2.9.3
47
2.13.6
37
48
38
49
diff view generated by jsdifflib