Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2221996/?format=api
{ "id": 2221996, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2221996/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260410150457.85190-4-zhangckid@gmail.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/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": "" }, "msgid": "<20260410150457.85190-4-zhangckid@gmail.com>", "date": "2026-04-10T15:04:46", "name": "[V6,03/14] iothread: tracking iothread users with holder name", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "45601b618f5da21ef61ed3eb82fbd90a3d27d2e4", "submitter": { "id": 72278, "url": "http://patchwork.ozlabs.org/api/1.1/people/72278/?format=api", "name": "Zhang Chen", "email": "zhangckid@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260410150457.85190-4-zhangckid@gmail.com/mbox/", "series": [ { "id": 499477, "url": "http://patchwork.ozlabs.org/api/1.1/series/499477/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499477", "date": "2026-04-10T15:04:43", "name": "iothread: Support tracking and querying IOThread holders", "version": 6, "mbox": "http://patchwork.ozlabs.org/series/499477/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2221996/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2221996/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=S4RVruJF;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsg9l2l8Xz20HT\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 01:06:19 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBDQF-0006dl-OW; Fri, 10 Apr 2026 11:05:27 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zhangckid@gmail.com>)\n id 1wBDQB-0006YX-UW\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 11:05:24 -0400", "from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <zhangckid@gmail.com>)\n id 1wBDQA-0002Ce-3y\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 11:05:23 -0400", "by mail-pj1-x1030.google.com with SMTP id\n 98e67ed59e1d1-35da2d35eccso1777732a91.0\n for <qemu-devel@nongnu.org>; Fri, 10 Apr 2026 08:05:21 -0700 (PDT)", "from ZBMac-LWN10QXKQ0.taila0cd24.ts.net ([104.168.88.121])\n by smtp.gmail.com with ESMTPSA id\n 98e67ed59e1d1-35e4131cfacsm3565785a91.10.2026.04.10.08.05.16\n (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n Fri, 10 Apr 2026 08:05:19 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775833520; x=1776438320; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=mPLKHQIKiWNj5QAnc2OyjCMMfWZ4IzzJUVCAIUexiKU=;\n b=S4RVruJFr2YltKKsJ8tuhTFK1lUaKEYB0biUEaMxZbiZrJV/i/7PZXisQgfICSsBeR\n XPJgwL6OcuDRgmmL67KXXLfHMB/d59/p2wbXy9by9Z7eTzBx8Rn7BkuyeDKGkCrxg8hW\n h3NMZNbCZGCp6o914sBH7NBuADyhsfmeK0isbgNZMnI5XQXkcEsgHxvBryjleOVKmNMP\n mCIHuEjNqmBAnHG4kahzkYOaklWurTKTWc4/x/lvW4CmHaL3cdIrwrM7uIrO0RwweAsw\n 5ZH+k3BA1GqYmsYIj6QSR9FiyD/zQcfug7mE678bvWcT6GNhjT36QSAWiA0MeOEGxK/U\n K0rA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775833520; x=1776438320;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=mPLKHQIKiWNj5QAnc2OyjCMMfWZ4IzzJUVCAIUexiKU=;\n b=W1OjpdfDlJ5yrtqQ3OdOgK5fFSZNnSuL1QirjdiMNILZI0lAqlKjbj5QZWlSOt1hgK\n 1fQVcyFY8x5HtSsQp9uIU/Phyvm/zuMDrKfsLakkDCcYa+WV6z/+EiqSRC7Ng5W1+mXV\n Zynnl/4eZ1W9ptO3wYd7PjZ5JZ8b30TGTbY/l2ALgPYSaIlu9uu0Ew+l2En1+n0YPxmZ\n 4el2O57yX0m8X8p8EJ+RUA8jEF8AIrxIgSWyoJfhB5ZIN9aZQTH8uu5oCj+vyeb/oSNh\n VZDPK/Yx2DTaa0HgvrdAsOFcxEFEzIx6JsUGVHNasIJM6Phoj6xpaYxFVycV1wxTeZ9P\n nw3Q==", "X-Gm-Message-State": "AOJu0YyJrV/1c+5lF0IyteyMtzSAZ8sqhwAoH/fRZSOW0mg/cXGJo+kH\n Jv73TF5MzZXp5rhL/FBqyKNyhhpuA+wws0N8x9lvu1bxuk50HQvIfFvWDwJkLa3o", "X-Gm-Gg": "AeBDietEQO5u6oUkyG570QCU8p8x4fSRllSgVROOHKFp4Nqm32L2sRqAA3Abt3OkEAT\n APsUcRDGTjLMb4xCMaU4w9xQOYqpBv59JM6Xf0EdTu/d1s2Ez9mgKOu15tjJJKxrKNhIYOhJAfm\n eGVvsmqz/0BCTwadfnwPpi+Y2tgiEanSo7XEsmZurmkuUfG0F//Ncq+OuoWrN//WAe1b1F5EBBa\n YOors4s2qz0atZpFACqrs4Y4X/BQi7LwYe1/Th1Brt97NwBDNCKy5HJoWOqigDWY+8JRXKR+B/R\n 8q7V5x+cS1ea2mjF6PU14is8+KwYOIxW4AmODsZu4dHfHCfgjflIAJUzl+BagcPzlX7EXDVFQjY\n CkDfCwJRsc6PD2tof6AMv7JZptINJM2s5XojXO+HZkYtCWeS8HDyRZS4+v8S17XijGDFiEneXZN\n ba0zNo+X0+WHoihhir+mCgtJHlmISkxWaNwK15k+44KLnNlHx9KU0YIiEuDjj2Cv0=", "X-Received": "by 2002:a17:90b:350b:b0:35d:a2d3:5c44 with SMTP id\n 98e67ed59e1d1-35e428581f9mr3562718a91.28.1775833519753;\n Fri, 10 Apr 2026 08:05:19 -0700 (PDT)", "From": "Zhang Chen <zhangckid@gmail.com>", "To": "qemu-devel <qemu-devel@nongnu.org>,\n \"Dr . David Alan Gilbert\" <dave@treblig.org>,\n Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>,\n \"Michael S . Tsirkin\" <mst@redhat.com>,\n Stefan Hajnoczi <stefanha@redhat.com>", "Cc": "Zhang Chen <zhangckid@gmail.com>", "Subject": "[PATCH V6 03/14] iothread: tracking iothread users with holder name", "Date": "Fri, 10 Apr 2026 23:04:46 +0800", "Message-ID": "<20260410150457.85190-4-zhangckid@gmail.com>", "X-Mailer": "git-send-email 2.49.0", "In-Reply-To": "<20260410150457.85190-1-zhangckid@gmail.com>", "References": "<20260410150457.85190-1-zhangckid@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=2607:f8b0:4864:20::1030;\n envelope-from=zhangckid@gmail.com; helo=mail-pj1-x1030.google.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Introduce iothread_get_aio_context() with a 'holder' argument and its\ncounterpart iothread_put_aio_context().\n\nPreviously, users of an IOThread's AioContext did not explicitly\nrecord their identity, making it difficult to debug which devices or\nsubsystems were pinning an IOThread.\n\nThis patch enhances the reference counting mechanism by:\n1. Automatically incrementing the object reference count when a context\n is retrieved.\n2. Tracking holders by name using iothread_ref() and iothread_unref().\n\nIn iothread_instance_finalize(), we now retrieve the source name from\nthe GMainContext to correctly unref the initial internal holder.\n\nSigned-off-by: Zhang Chen <zhangckid@gmail.com>\n---\n include/system/iothread.h | 3 +++\n iothread.c | 33 +++++++++++++++++++++++++++++----\n 2 files changed, 32 insertions(+), 4 deletions(-)", "diff": "diff --git a/include/system/iothread.h b/include/system/iothread.h\nindex 21a76bd70d..dbada8249c 100644\n--- a/include/system/iothread.h\n+++ b/include/system/iothread.h\n@@ -48,6 +48,9 @@ DECLARE_INSTANCE_CHECKER(IOThread, IOTHREAD,\n char *iothread_get_id(IOThread *iothread);\n IOThread *iothread_by_id(const char *id);\n AioContext *iothread_get_aio_context(IOThread *iothread);\n+AioContext *iothread_ref_and_get_aio_context(IOThread *iothread,\n+ const char *holder);\n+void iothread_put_aio_context(IOThread *iothread, const char *holder);\n GMainContext *iothread_get_g_main_context(IOThread *iothread);\n \n /*\ndiff --git a/iothread.c b/iothread.c\nindex c43266b191..60a024f770 100644\n--- a/iothread.c\n+++ b/iothread.c\n@@ -52,6 +52,12 @@ static void iothread_ref(IOThread *iothread, const char *holder)\n }\n \n iothread->holders = g_list_prepend(iothread->holders, h);\n+\n+ /*\n+ * This guarantees that the IOThread and its AioContext remain alive\n+ * as long as there is a holder.\n+ */\n+ object_ref(OBJECT(iothread));\n }\n \n static int iothread_holder_compare(gconstpointer a, gconstpointer b)\n@@ -83,6 +89,8 @@ static void iothread_unref(IOThread *iothread, const char *holder)\n IoThreadHolder *h = (IoThreadHolder *)link->data;\n qapi_free_IoThreadHolder(h);\n iothread->holders = g_list_delete_link(iothread->holders, link);\n+\n+ object_unref(OBJECT(iothread));\n }\n \n static void *iothread_run(void *opaque)\n@@ -196,7 +204,7 @@ static void iothread_init_gcontext(IOThread *iothread, const char *thread_name)\n g_autofree char *name = g_strdup_printf(\"%s aio-context\", thread_name);\n \n iothread->worker_context = g_main_context_new();\n- source = aio_get_g_source(iothread_get_aio_context(iothread));\n+ source = aio_get_g_source(iothread->ctx);\n g_source_set_name(source, name);\n g_source_attach(source, iothread->worker_context);\n g_source_unref(source);\n@@ -388,13 +396,30 @@ char *iothread_get_id(IOThread *iothread)\n \n AioContext *iothread_get_aio_context(IOThread *iothread)\n {\n- /* Remove in next patch for build */\n- iothread_ref(iothread, \"tmp\");\n- iothread_unref(iothread, \"tmp\");\n+ return iothread->ctx;\n+}\n+\n+AioContext *iothread_ref_and_get_aio_context(IOThread *iothread,\n+ const char *holder)\n+{\n+ /*\n+ * In some cases, iothread user need the ctx to clearup other resource.\n+ * When holder is empty, back to the legacy way.\n+ */\n+ if (holder) {\n+ /* Add holder device path to the list */\n+ iothread_ref(iothread, holder);\n+ }\n \n return iothread->ctx;\n }\n \n+void iothread_put_aio_context(IOThread *iothread, const char *holder)\n+{\n+ /* Delete holder device path from the list */\n+ iothread_unref(iothread, holder);\n+}\n+\n static int query_one_iothread(Object *object, void *opaque)\n {\n IOThreadInfoList ***tail = opaque;\n", "prefixes": [ "V6", "03/14" ] }