get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1525273,
    "url": "http://patchwork.ozlabs.org/api/patches/1525273/",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/20210907111725.43672-4-cian.ferriter@intel.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20210907111725.43672-4-cian.ferriter@intel.com>",
    "list_archive_url": null,
    "date": "2021-09-07T11:17:25",
    "name": "[ovs-dev,v2,3/3] dpif-netdev: Add a configurable delay to work deferral",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": false,
    "hash": "661d89b87a50039c6ffd00d4878cdbea4079c443",
    "submitter": {
        "id": 70444,
        "url": "http://patchwork.ozlabs.org/api/people/70444/",
        "name": "Ferriter, Cian",
        "email": "cian.ferriter@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/20210907111725.43672-4-cian.ferriter@intel.com/mbox/",
    "series": [
        {
            "id": 261267,
            "url": "http://patchwork.ozlabs.org/api/series/261267/",
            "web_url": "http://patchwork.ozlabs.org/project/openvswitch/list/?series=261267",
            "date": "2021-09-07T11:17:22",
            "name": "Userspace deferral of work",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/261267/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1525273/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1525273/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "ovs-dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
        "Received": [
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H3jRG63F9z9sXk\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  7 Sep 2021 21:17:30 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp3.osuosl.org (Postfix) with ESMTP id E91516125A;\n\tTue,  7 Sep 2021 11:17:25 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n\tby localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id LcRXDJCVXuut; Tue,  7 Sep 2021 11:17:24 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp3.osuosl.org (Postfix) with ESMTPS id 8C77F60BF7;\n\tTue,  7 Sep 2021 11:17:22 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 068B3C002D;\n\tTue,  7 Sep 2021 11:17:20 +0000 (UTC)",
            "from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 0157CC0020\n for <ovs-dev@openvswitch.org>; Tue,  7 Sep 2021 11:17:19 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id B2D204026C\n for <ovs-dev@openvswitch.org>; Tue,  7 Sep 2021 11:17:17 +0000 (UTC)",
            "from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id hlFG6Y8l3OJV for <ovs-dev@openvswitch.org>;\n Tue,  7 Sep 2021 11:17:17 +0000 (UTC)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 0D57E4039F\n for <ovs-dev@openvswitch.org>; Tue,  7 Sep 2021 11:17:17 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 Sep 2021 04:17:16 -0700",
            "from silpixa00399779.ir.intel.com (HELO\n silpixa00399779.ger.corp.intel.com) ([10.237.222.105])\n by FMSMGA003.fm.intel.com with ESMTP; 07 Sep 2021 04:17:15 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.8.0",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10099\"; a=\"200378307\"",
            "E=Sophos;i=\"5.85,274,1624345200\"; d=\"scan'208\";a=\"200378307\"",
            "E=Sophos;i=\"5.85,274,1624345200\"; d=\"scan'208\";a=\"537926500\""
        ],
        "X-ExtLoop1": "1",
        "From": "Cian Ferriter <cian.ferriter@intel.com>",
        "To": "ovs-dev@openvswitch.org",
        "Date": "Tue,  7 Sep 2021 12:17:25 +0100",
        "Message-Id": "<20210907111725.43672-4-cian.ferriter@intel.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210907111725.43672-1-cian.ferriter@intel.com>",
        "References": "<20210907111725.43672-1-cian.ferriter@intel.com>",
        "MIME-Version": "1.0",
        "Subject": "[ovs-dev] [PATCH v2 3/3] dpif-netdev: Add a configurable delay to\n\twork deferral",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "Delay checking the completion of deferred work by a number of iterations\nof pmd_thread_main(). The PMD iteration count is used to track when a\nwork item is deferred and when it should be attempted.\n\nThe below command is used to set the number of iterations before a work\nitem should be attempted.\n\novs-vsctl set Open_vSwitch . other_config:async-iteration-delay=2\n\nSigned-off-by: Cian Ferriter <cian.ferriter@intel.com>\n\n---\n\nv2:\n- Add this commit.\n---\n lib/dpif-netdev-private-defer.h |  9 +++++++\n lib/dpif-netdev.c               | 45 +++++++++++++++++++++++++++++++--\n 2 files changed, 52 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/dpif-netdev-private-defer.h b/lib/dpif-netdev-private-defer.h\nindex a77216ce7..03eff16f0 100644\n--- a/lib/dpif-netdev-private-defer.h\n+++ b/lib/dpif-netdev-private-defer.h\n@@ -39,6 +39,11 @@ struct dp_defer_work_item {\n     uint32_t attempts;\n     int pkt_cnt;\n     struct dp_netdev_rxq **output_pkts_rxqs;\n+\n+    /* The pmd_iteration_cnt at which to the work item was deferred.  It's used\n+     * along with the async-iteration-delay to decide whether to attempt doing\n+     * a work item. */\n+    uint64_t pmd_iteration_cnt;\n };\n \n #define WORK_RING_SIZE 128\n@@ -46,6 +51,10 @@ struct dp_defer_work_item {\n \n #define ATTEMPT_LIMIT 1000\n \n+/* How many iterations of pmd_thread_main() to delay checking for the\n+ * completion of deferred work. */\n+#define DEFAULT_ASYNC_ITERATION_DELAY 0\n+\n /* The read and write indexes are between 0 and 2^32, and we mask their value\n  * when we access the work_ring[] array. */\n struct dp_defer {\ndiff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c\nindex 5930fbada..b2e7ec0ec 100644\n--- a/lib/dpif-netdev.c\n+++ b/lib/dpif-netdev.c\n@@ -274,6 +274,10 @@ struct dp_netdev {\n     /* Enable the SMC cache from ovsdb config */\n     atomic_bool smc_enable_db;\n \n+    /* How many iterations of pmd_thread_main() to delay checking for the\n+     * completion of deferred work. */\n+    OVS_ALIGNED_VAR(CACHE_LINE_SIZE) atomic_uint8_t async_iteration_delay;\n+\n     /* Protects access to ofproto-dpif-upcall interface during revalidator\n      * thread synchronization. */\n     struct fat_rwlock upcall_rwlock;\n@@ -1753,6 +1757,8 @@ create_dp_netdev(const char *name, const struct dpif_class *class,\n     atomic_init(&dp->emc_insert_min, DEFAULT_EM_FLOW_INSERT_MIN);\n     atomic_init(&dp->tx_flush_interval, DEFAULT_TX_FLUSH_INTERVAL);\n \n+    atomic_init(&dp->async_iteration_delay, DEFAULT_ASYNC_ITERATION_DELAY);\n+\n     cmap_init(&dp->poll_threads);\n     dp->pmd_rxq_assign_type = SCHED_CYCLES;\n \n@@ -4215,6 +4221,20 @@ dpif_netdev_set_config(struct dpif *dpif, const struct smap *other_config)\n         dp_netdev_request_reconfigure(dp);\n     }\n \n+    int async_delay = smap_get_int(other_config, \"async-iteration-delay\",\n+                                   DEFAULT_ASYNC_ITERATION_DELAY);\n+    uint8_t cur_async_delay;\n+    atomic_read_relaxed(&dp->async_iteration_delay, &cur_async_delay);\n+    if (async_delay <= UINT8_MAX && async_delay >= 0) {\n+        if (async_delay != cur_async_delay) {\n+            atomic_store_relaxed(&dp->async_iteration_delay, async_delay);\n+            VLOG_INFO(\"Asynchronous iteration delay changed to %d.\",\n+                      async_delay);\n+        }\n+    } else {\n+        VLOG_ERR(\"Asynchronous delay value must be between 0 and 255.\");\n+    }\n+\n     atomic_read_relaxed(&dp->emc_insert_min, &cur_min);\n     if (insert_prob <= UINT32_MAX) {\n         insert_min = insert_prob == 0 ? 0 : UINT32_MAX / insert_prob;\n@@ -4592,6 +4612,21 @@ pmd_perf_metrics_enabled(const struct dp_netdev_pmd_thread *pmd OVS_UNUSED)\n }\n #endif\n \n+/* Check whether a sufficient number of iterations of pmd_thread_main() have\n+ * occurred in order to attempt the next work item.  The number of iterations\n+ * is equal to async_delay. */\n+static inline bool\n+iteration_reached(struct dp_defer *defer, uint64_t current_iteration_cnt,\n+                  uint8_t async_delay)\n+{\n+    uint32_t read_idx = defer->read_idx & WORK_RING_MASK;\n+    struct dp_defer_work_item *current_work = &defer->work_ring[read_idx];\n+    uint64_t item_iteration_cnt = current_work->pmd_iteration_cnt;\n+\n+    /*return (current_iteration_cnt >= item_iteration_cnt);*/\n+    return item_iteration_cnt <= (current_iteration_cnt - async_delay);\n+}\n+\n /* Try to do one piece of work from the work ring.\n  *\n  * Returns:\n@@ -4691,6 +4726,7 @@ dp_defer_work(struct dp_defer *defer, struct pmd_perf_stats *perf_stats,\n     ring_item->attempts = 0;\n     ring_item->pkt_cnt = work->pkt_cnt;\n     ring_item->output_pkts_rxqs = work->output_pkts_rxqs;\n+    ring_item->pmd_iteration_cnt = work->pmd_iteration_cnt;\n \n     defer->write_idx++;\n \n@@ -4742,6 +4778,7 @@ dp_netdev_pmd_flush_output_on_port(struct dp_netdev_pmd_thread *pmd,\n             .qid = tx_qid,\n             .pkt_cnt = output_cnt,\n             .output_pkts_rxqs = p->output_pkts_rxqs,\n+            .pmd_iteration_cnt = perf_stats->iteration_cnt,\n         };\n \n         /* Defer the work. */\n@@ -6364,10 +6401,14 @@ reload:\n             tx_packets = dp_netdev_pmd_flush_output_packets(pmd, false);\n         }\n \n+        uint8_t async_delay;\n+        atomic_read_relaxed(&pmd->dp->async_iteration_delay, &async_delay);\n+\n         /* Try to clear the work ring. If a piece of work is still in progress,\n          * don't attempt to do the remaining work items. They will be postponed\n-         * to the next interation of pmd_thread_main(). */\n-        while (!dp_defer_do_work(defer, s)) {\n+         * to the next iteration of pmd_thread_main(). */\n+        while (iteration_reached(defer, s->iteration_cnt, async_delay)\n+               && !dp_defer_do_work(defer, s)) {\n             continue;\n         }\n \n",
    "prefixes": [
        "ovs-dev",
        "v2",
        "3/3"
    ]
}