get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2197121/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2197121,
    "url": "http://patchwork.ozlabs.org/api/patches/2197121/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260217-alpha-v1-2-0dcc708c9db3@rsg.ci.i.u-tokyo.ac.jp/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/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": "<20260217-alpha-v1-2-0dcc708c9db3@rsg.ci.i.u-tokyo.ac.jp>",
    "list_archive_url": null,
    "date": "2026-02-17T06:34:30",
    "name": "[2/2] Reapply \"rcu: Unify force quiescent state\"",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f2ab21fb0a93e5a842a7e9a56d406d28f82d7f33",
    "submitter": {
        "id": 90980,
        "url": "http://patchwork.ozlabs.org/api/people/90980/?format=api",
        "name": "Akihiko Odaki",
        "email": "odaki@rsg.ci.i.u-tokyo.ac.jp"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260217-alpha-v1-2-0dcc708c9db3@rsg.ci.i.u-tokyo.ac.jp/mbox/",
    "series": [
        {
            "id": 492379,
            "url": "http://patchwork.ozlabs.org/api/series/492379/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=492379",
            "date": "2026-02-17T06:34:29",
            "name": "Reapply \"rcu: Unify force quiescent state\"",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/492379/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2197121/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2197121/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@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"key not found in DNS\" header.d=rsg.ci.i.u-tokyo.ac.jp\n header.i=@rsg.ci.i.u-tokyo.ac.jp header.a=rsa-sha256 header.s=rs20250326\n header.b=I6ibcv2t;\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 (lists.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 4fFVJj6jg0z1xwD\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 17:35:49 +1100 (AEDT)",
            "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 1vsEfr-0006Yg-DB; Tue, 17 Feb 2026 01:35:07 -0500",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <odaki@rsg.ci.i.u-tokyo.ac.jp>)\n id 1vsEfp-0006Wj-EK\n for qemu-devel@nongnu.org; Tue, 17 Feb 2026 01:35:05 -0500",
            "from www3579.sakura.ne.jp ([49.212.243.89])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <odaki@rsg.ci.i.u-tokyo.ac.jp>)\n id 1vsEfn-0004T5-AB\n for qemu-devel@nongnu.org; Tue, 17 Feb 2026 01:35:05 -0500",
            "from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp\n [133.11.54.205]) (authenticated bits=0)\n by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 61H6Yfkh030238\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);\n Tue, 17 Feb 2026 15:34:43 +0900 (JST)\n (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp)"
        ],
        "DKIM-Signature": "a=rsa-sha256; bh=H6ljr/jVCWKO176X63ceZZm1uT0oaOP95joZ3kpX6PE=;\n c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp;\n h=From:Date:Subject:Message-Id:To;\n s=rs20250326; t=1771310083; v=1;\n b=I6ibcv2tH/cxK1WAVj7w1vVYPuCyblBvxIhjoB9Ie8jdOVkH7Iz7UCpjek2k267A\n q6TfDi5WVhibb4on388be7fReS4UQm688TGNFlLJa3PH10VyPS+hDwfARpF9Frqy\n QaDlfw6tPYGcmGBKRpiT5tcWj0D6jsjWLhRiK5nzbSJFFCiqV09v4HBo3sIA/lbL\n dG9N6i85rjXDJu1s8Komvd2367xxxekagRoJKZT4/RjsFHzT+LW9GOFxr2hBGqrK\n EY0Fg9BvbfekKXaGftjg8PRJIzujRhtQN+ZSU8JUEO7amNED8e5FbHFXaNQlUVOI\n ImkI4FP8N7rnaty3Gn3BiA==",
        "From": "Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>",
        "Date": "Tue, 17 Feb 2026 15:34:30 +0900",
        "Subject": "[PATCH 2/2] Reapply \"rcu: Unify force quiescent state\"",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260217-alpha-v1-2-0dcc708c9db3@rsg.ci.i.u-tokyo.ac.jp>",
        "References": "<20260217-alpha-v1-0-0dcc708c9db3@rsg.ci.i.u-tokyo.ac.jp>",
        "In-Reply-To": "<20260217-alpha-v1-0-0dcc708c9db3@rsg.ci.i.u-tokyo.ac.jp>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "Richard Henderson <richard.henderson@linaro.org>,\n Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <thuth@redhat.com>,\n\t=?utf-8?q?Alex_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n Jim MacArthur <jim.macarthur@linaro.org>,\n Yodel Eldar <yodel.eldar@yodel.dev>,\n Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>",
        "X-Mailer": "b4 0.15-dev-67ece",
        "Received-SPF": "pass client-ip=49.212.243.89;\n envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp",
        "X-Spam_score_int": "-16",
        "X-Spam_score": "-1.7",
        "X-Spam_bar": "-",
        "X-Spam_report": "(-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1,\n DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=no 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": "This reverts commit ddb4d9d1748681cfde824d765af6cda4334fcce3.\n\nThe commit says:\n> This reverts commit 55d98e3edeeb17dd8445db27605d2b34f4c3ba85.\n>\n> The commit introduced a regression in the replay functional test\n> on alpha (tests/functional/alpha/test_replay.py), that causes CI\n> failures regularly. Thus revert this change until someone has\n> figured out what is going wrong here.\n\nReapply the change as alpha is fixed.\n\nSigned-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>\n---\n util/rcu.c | 79 ++++++++++++++++++++++++++++++++++++++++----------------------\n 1 file changed, 51 insertions(+), 28 deletions(-)",
    "diff": "diff --git a/util/rcu.c b/util/rcu.c\nindex b703c86f15a3..acac9446ea98 100644\n--- a/util/rcu.c\n+++ b/util/rcu.c\n@@ -43,10 +43,14 @@\n #define RCU_GP_LOCKED           (1UL << 0)\n #define RCU_GP_CTR              (1UL << 1)\n \n+\n+#define RCU_CALL_MIN_SIZE        30\n+\n unsigned long rcu_gp_ctr = RCU_GP_LOCKED;\n \n QemuEvent rcu_gp_event;\n static int in_drain_call_rcu;\n+static int rcu_call_count;\n static QemuMutex rcu_registry_lock;\n static QemuMutex rcu_sync_lock;\n \n@@ -76,15 +80,29 @@ static void wait_for_readers(void)\n {\n     ThreadList qsreaders = QLIST_HEAD_INITIALIZER(qsreaders);\n     struct rcu_reader_data *index, *tmp;\n+    int sleeps = 0;\n+    bool forced = false;\n \n     for (;;) {\n-        /* We want to be notified of changes made to rcu_gp_ongoing\n-         * while we walk the list.\n+        /*\n+         * Force the grace period to end and wait for it if any of the\n+         * following heuristical conditions are satisfied:\n+         * - A decent number of callbacks piled up.\n+         * - It timed out.\n+         * - It is in a drain_call_rcu() call.\n+         *\n+         * Otherwise, periodically poll the grace period, hoping it ends\n+         * promptly.\n          */\n-        qemu_event_reset(&rcu_gp_event);\n+        if (!forced &&\n+            (qatomic_read(&rcu_call_count) >= RCU_CALL_MIN_SIZE ||\n+             sleeps >= 5 || qatomic_read(&in_drain_call_rcu))) {\n+            forced = true;\n \n-        QLIST_FOREACH(index, &registry, node) {\n-            qatomic_set(&index->waiting, true);\n+            QLIST_FOREACH(index, &registry, node) {\n+                notifier_list_notify(&index->force_rcu, NULL);\n+                qatomic_set(&index->waiting, true);\n+            }\n         }\n \n         /* Here, order the stores to index->waiting before the loads of\n@@ -106,8 +124,6 @@ static void wait_for_readers(void)\n                  * get some extra futex wakeups.\n                  */\n                 qatomic_set(&index->waiting, false);\n-            } else if (qatomic_read(&in_drain_call_rcu)) {\n-                notifier_list_notify(&index->force_rcu, NULL);\n             }\n         }\n \n@@ -115,7 +131,8 @@ static void wait_for_readers(void)\n             break;\n         }\n \n-        /* Wait for one thread to report a quiescent state and try again.\n+        /*\n+         * Sleep for a while and try again.\n          * Release rcu_registry_lock, so rcu_(un)register_thread() doesn't\n          * wait too much time.\n          *\n@@ -133,7 +150,20 @@ static void wait_for_readers(void)\n          * rcu_registry_lock is released.\n          */\n         qemu_mutex_unlock(&rcu_registry_lock);\n-        qemu_event_wait(&rcu_gp_event);\n+\n+        if (forced) {\n+            qemu_event_wait(&rcu_gp_event);\n+\n+            /*\n+             * We want to be notified of changes made to rcu_gp_ongoing\n+             * while we walk the list.\n+             */\n+            qemu_event_reset(&rcu_gp_event);\n+        } else {\n+            g_usleep(10000);\n+            sleeps++;\n+        }\n+\n         qemu_mutex_lock(&rcu_registry_lock);\n     }\n \n@@ -173,15 +203,11 @@ void synchronize_rcu(void)\n     }\n }\n \n-\n-#define RCU_CALL_MIN_SIZE        30\n-\n /* Multi-producer, single-consumer queue based on urcu/static/wfqueue.h\n  * from liburcu.  Note that head is only used by the consumer.\n  */\n static struct rcu_head dummy;\n static struct rcu_head *head = &dummy, **tail = &dummy.next;\n-static int rcu_call_count;\n static QemuEvent rcu_call_ready_event;\n \n static void enqueue(struct rcu_head *node)\n@@ -259,30 +285,27 @@ static void *call_rcu_thread(void *opaque)\n     rcu_register_thread();\n \n     for (;;) {\n-        int tries = 0;\n-        int n = qatomic_read(&rcu_call_count);\n+        int n;\n \n-        /* Heuristically wait for a decent number of callbacks to pile up.\n+        /*\n          * Fetch rcu_call_count now, we only must process elements that were\n          * added before synchronize_rcu() starts.\n          */\n-        while (n == 0 || (n < RCU_CALL_MIN_SIZE && ++tries <= 5)) {\n-            g_usleep(10000);\n-            if (n == 0) {\n-                qemu_event_reset(&rcu_call_ready_event);\n-                n = qatomic_read(&rcu_call_count);\n-                if (n == 0) {\n+        for (;;) {\n+            qemu_event_reset(&rcu_call_ready_event);\n+            n = qatomic_read(&rcu_call_count);\n+            if (n) {\n+                break;\n+            }\n+\n #if defined(CONFIG_MALLOC_TRIM)\n-                    malloc_trim(4 * 1024 * 1024);\n+            malloc_trim(4 * 1024 * 1024);\n #endif\n-                    qemu_event_wait(&rcu_call_ready_event);\n-                }\n-            }\n-            n = qatomic_read(&rcu_call_count);\n+            qemu_event_wait(&rcu_call_ready_event);\n         }\n \n-        qatomic_sub(&rcu_call_count, n);\n         synchronize_rcu();\n+        qatomic_sub(&rcu_call_count, n);\n         bql_lock();\n         while (n > 0) {\n             node = try_dequeue();\n",
    "prefixes": [
        "2/2"
    ]
}