Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/811301/?format=api
{ "id": 811301, "url": "http://patchwork.ozlabs.org/api/1.2/patches/811301/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1504836324-4871-17-git-send-email-jasowang@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1504836324-4871-17-git-send-email-jasowang@redhat.com>", "list_archive_url": null, "date": "2017-09-08T02:05:22", "name": "[PULL,16/18] qemu-iothread: IOThread supports the GMainContext event loop", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "bda6b94977554d0f1a592685aa900eb020539834", "submitter": { "id": 5225, "url": "http://patchwork.ozlabs.org/api/1.2/people/5225/?format=api", "name": "Jason Wang", "email": "jasowang@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1504836324-4871-17-git-send-email-jasowang@redhat.com/mbox/", "series": [ { "id": 2087, "url": "http://patchwork.ozlabs.org/api/1.2/series/2087/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2087", "date": "2017-09-08T02:05:06", "name": "[PULL,01/18] net/filter-rewriter.c: Fix rewirter checksum bug when use virtio-net", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2087/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811301/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811301/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jasowang@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpLZF0ql7z9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 8 Sep 2017 12:17:41 +1000 (AEST)", "from localhost ([::1]:42992 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dq8rT-0004zP-3g\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 22:17:39 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:32995)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <jasowang@redhat.com>) id 1dq8gu-0003nG-As\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 22:06:49 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <jasowang@redhat.com>) id 1dq8gp-0002gW-8k\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 22:06:44 -0400", "from mx1.redhat.com ([209.132.183.28]:37230)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <jasowang@redhat.com>) id 1dq8gp-0002fm-07\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 22:06:39 -0400", "from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id E81BB356C0;\n\tFri, 8 Sep 2017 02:06:37 +0000 (UTC)", "from jason-ThinkPad-T450s.redhat.com (ovpn-12-98.pek2.redhat.com\n\t[10.72.12.98])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 0C57F600C2;\n\tFri, 8 Sep 2017 02:06:34 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com E81BB356C0", "From": "Jason Wang <jasowang@redhat.com>", "To": "peter.maydell@linaro.org,\n\tqemu-devel@nongnu.org", "Date": "Fri, 8 Sep 2017 10:05:22 +0800", "Message-Id": "<1504836324-4871-17-git-send-email-jasowang@redhat.com>", "In-Reply-To": "<1504836324-4871-1-git-send-email-jasowang@redhat.com>", "References": "<1504836324-4871-1-git-send-email-jasowang@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tFri, 08 Sep 2017 02:06:38 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [PULL 16/18] qemu-iothread: IOThread supports the\n\tGMainContext event loop", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "Jason Wang <jasowang@redhat.com>, Wang Yong <wang.yong155@zte.com.cn>,\n\tWang Guang <wang.guang55@zte.com.cn>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "From: Wang Yong <wang.yong155@zte.com.cn>\n\nIOThread uses AioContext event loop and does not run a GMainContext.\nTherefore,chardev cannot work in IOThread,such as the chardev is\nused for colo-compare packets reception.\n\nThis patch makes the IOThread run the GMainContext event loop,\nchardev and IOThread can work together.\n\nReviewed-by: Fam Zheng <famz@redhat.com>\nSigned-off-by: Wang Yong <wang.yong155@zte.com.cn>\nSigned-off-by: Wang Guang <wang.guang55@zte.com.cn>\nSigned-off-by: Jason Wang <jasowang@redhat.com>\n---\n include/sysemu/iothread.h | 4 ++++\n iothread.c | 45 +++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 49 insertions(+)", "diff": "diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h\nindex e6da1a4..d2985b3 100644\n--- a/include/sysemu/iothread.h\n+++ b/include/sysemu/iothread.h\n@@ -24,6 +24,9 @@ typedef struct {\n \n QemuThread thread;\n AioContext *ctx;\n+ GMainContext *worker_context;\n+ GMainLoop *main_loop;\n+ GOnce once;\n QemuMutex init_done_lock;\n QemuCond init_done_cond; /* is thread initialization done? */\n bool stopping;\n@@ -41,5 +44,6 @@ typedef struct {\n char *iothread_get_id(IOThread *iothread);\n AioContext *iothread_get_aio_context(IOThread *iothread);\n void iothread_stop_all(void);\n+GMainContext *iothread_get_g_main_context(IOThread *iothread);\n \n #endif /* IOTHREAD_H */\ndiff --git a/iothread.c b/iothread.c\nindex beeb870..44c8944 100644\n--- a/iothread.c\n+++ b/iothread.c\n@@ -57,6 +57,23 @@ static void *iothread_run(void *opaque)\n \n while (!atomic_read(&iothread->stopping)) {\n aio_poll(iothread->ctx, true);\n+\n+ if (atomic_read(&iothread->worker_context)) {\n+ GMainLoop *loop;\n+\n+ g_main_context_push_thread_default(iothread->worker_context);\n+ iothread->main_loop =\n+ g_main_loop_new(iothread->worker_context, TRUE);\n+ loop = iothread->main_loop;\n+\n+ g_main_loop_run(iothread->main_loop);\n+ iothread->main_loop = NULL;\n+ g_main_loop_unref(loop);\n+\n+ g_main_context_pop_thread_default(iothread->worker_context);\n+ g_main_context_unref(iothread->worker_context);\n+ iothread->worker_context = NULL;\n+ }\n }\n \n rcu_unregister_thread();\n@@ -73,6 +90,9 @@ static int iothread_stop(Object *object, void *opaque)\n }\n iothread->stopping = true;\n aio_notify(iothread->ctx);\n+ if (atomic_read(&iothread->main_loop)) {\n+ g_main_loop_quit(iothread->main_loop);\n+ }\n qemu_thread_join(&iothread->thread);\n return 0;\n }\n@@ -125,6 +145,7 @@ static void iothread_complete(UserCreatable *obj, Error **errp)\n \n qemu_mutex_init(&iothread->init_done_lock);\n qemu_cond_init(&iothread->init_done_cond);\n+ iothread->once = (GOnce) G_ONCE_INIT;\n \n /* This assumes we are called from a thread with useful CPU affinity for us\n * to inherit.\n@@ -309,3 +330,27 @@ void iothread_stop_all(void)\n \n object_child_foreach(container, iothread_stop, NULL);\n }\n+\n+static gpointer iothread_g_main_context_init(gpointer opaque)\n+{\n+ AioContext *ctx;\n+ IOThread *iothread = opaque;\n+ GSource *source;\n+\n+ iothread->worker_context = g_main_context_new();\n+\n+ ctx = iothread_get_aio_context(iothread);\n+ source = aio_get_g_source(ctx);\n+ g_source_attach(source, iothread->worker_context);\n+ g_source_unref(source);\n+\n+ aio_notify(iothread->ctx);\n+ return NULL;\n+}\n+\n+GMainContext *iothread_get_g_main_context(IOThread *iothread)\n+{\n+ g_once(&iothread->once, iothread_g_main_context_init, iothread);\n+\n+ return iothread->worker_context;\n+}\n", "prefixes": [ "PULL", "16/18" ] }