get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 95487,
    "url": "http://patchwork.dpdk.org/api/patches/95487/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/02e61fd0109d8f3564175adaa6c2ab5a7c17c6ca.1625654882.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<02e61fd0109d8f3564175adaa6c2ab5a7c17c6ca.1625654882.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/02e61fd0109d8f3564175adaa6c2ab5a7c17c6ca.1625654882.git.anatoly.burakov@intel.com",
    "date": "2021-07-07T10:48:19",
    "name": "[v7,6/7] power: support monitoring multiple Rx queues",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "24db5a233736b5d2a6bffc50a914c96dd38c67b6",
    "submitter": {
        "id": 4,
        "url": "http://patchwork.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/02e61fd0109d8f3564175adaa6c2ab5a7c17c6ca.1625654882.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 17694,
            "url": "http://patchwork.dpdk.org/api/series/17694/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=17694",
            "date": "2021-07-07T10:48:13",
            "name": "Enhancements for PMD power management",
            "version": 7,
            "mbox": "http://patchwork.dpdk.org/series/17694/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/95487/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/95487/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C7E07A0C4A;\n\tWed,  7 Jul 2021 12:49:06 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E7463414E2;\n\tWed,  7 Jul 2021 12:48:38 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n by mails.dpdk.org (Postfix) with ESMTP id 77138414D5\n for <dev@dpdk.org>; Wed,  7 Jul 2021 12:48:36 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 07 Jul 2021 03:48:36 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.223.53])\n by fmsmga005.fm.intel.com with ESMTP; 07 Jul 2021 03:48:34 -0700"
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6200,9189,10037\"; a=\"207456955\"",
            "E=Sophos;i=\"5.83,331,1616482800\"; d=\"scan'208\";a=\"207456955\"",
            "E=Sophos;i=\"5.83,331,1616482800\"; d=\"scan'208\";a=\"647848645\""
        ],
        "X-ExtLoop1": "1",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org,\n\tDavid Hunt <david.hunt@intel.com>",
        "Cc": "konstantin.ananyev@intel.com,\n\tciara.loftus@intel.com",
        "Date": "Wed,  7 Jul 2021 10:48:19 +0000",
        "Message-Id": "\n <02e61fd0109d8f3564175adaa6c2ab5a7c17c6ca.1625654882.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<cover.1625654882.git.anatoly.burakov@intel.com>",
        "References": "<cover.1625498488.git.anatoly.burakov@intel.com>\n <cover.1625654882.git.anatoly.burakov@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v7 6/7] power: support monitoring multiple Rx\n queues",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Use the new multi-monitor intrinsic to allow monitoring multiple ethdev\nRx queues while entering the energy efficient power state. The multi\nversion will be used unconditionally if supported, and the UMWAIT one\nwill only be used when multi-monitor is not supported by the hardware.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v6:\n    - Fix the missed feedback from v5\n    \n    v4:\n    - Fix possible out of bounds access\n    - Added missing index increment\n\n doc/guides/prog_guide/power_man.rst | 15 ++++--\n lib/power/rte_power_pmd_mgmt.c      | 82 ++++++++++++++++++++++++++++-\n 2 files changed, 90 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/doc/guides/prog_guide/power_man.rst b/doc/guides/prog_guide/power_man.rst\nindex 0e66878892..e387d7811e 100644\n--- a/doc/guides/prog_guide/power_man.rst\n+++ b/doc/guides/prog_guide/power_man.rst\n@@ -221,17 +221,22 @@ power saving whenever empty poll count reaches a certain number.\n The \"monitor\" mode is only supported in the following configurations and scenarios:\n \n * On Linux* x86_64, `rte_power_monitor()` requires WAITPKG instruction set being\n-  supported by the CPU. Please refer to your platform documentation for further\n-  information.\n+  supported by the CPU, while `rte_power_monitor_multi()` requires WAITPKG and\n+  RTM instruction sets being supported by the CPU. RTM instruction set may also\n+  require booting the Linux with `tsx=on` command line parameter. Please refer\n+  to your platform documentation for further information.\n \n * If ``rte_cpu_get_intrinsics_support()`` function indicates that\n+  ``rte_power_monitor_multi()`` function is supported by the platform, then\n+  monitoring multiple Ethernet Rx queues for traffic will be supported.\n+\n+* If ``rte_cpu_get_intrinsics_support()`` function indicates that only\n   ``rte_power_monitor()`` is supported by the platform, then monitoring will be\n   limited to a mapping of 1 core 1 queue (thus, each Rx queue will have to be\n   monitored from a different lcore).\n \n-* If ``rte_cpu_get_intrinsics_support()`` function indicates that the\n-  ``rte_power_monitor()`` function is not supported, then monitor mode will not\n-  be supported.\n+* If ``rte_cpu_get_intrinsics_support()`` function indicates that neither of the\n+  two monitoring functions are supported, then monitor mode will not be supported.\n \n * Not all Ethernet drivers support monitoring, even if the underlying\n   platform may support the necessary CPU instructions. Please refer to\ndiff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c\nindex ceaf386d2b..ba5971f827 100644\n--- a/lib/power/rte_power_pmd_mgmt.c\n+++ b/lib/power/rte_power_pmd_mgmt.c\n@@ -126,6 +126,32 @@ queue_list_take(struct pmd_core_cfg *cfg, const union queue *q)\n \treturn found;\n }\n \n+static inline int\n+get_monitor_addresses(struct pmd_core_cfg *cfg,\n+\t\tstruct rte_power_monitor_cond *pmc, size_t len)\n+{\n+\tconst struct queue_list_entry *qle;\n+\tsize_t i = 0;\n+\tint ret;\n+\n+\tTAILQ_FOREACH(qle, &cfg->head, next) {\n+\t\tconst union queue *q = &qle->queue;\n+\t\tstruct rte_power_monitor_cond *cur;\n+\n+\t\t/* attempted out of bounds access */\n+\t\tif (i >= len) {\n+\t\t\tRTE_LOG(ERR, POWER, \"Too many queues being monitored\\n\");\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tcur = &pmc[i++];\n+\t\tret = rte_eth_get_monitor_addr(q->portid, q->qid, cur);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t}\n+\treturn 0;\n+}\n+\n static void\n calc_tsc(void)\n {\n@@ -211,6 +237,46 @@ lcore_can_sleep(struct pmd_core_cfg *cfg)\n \treturn true;\n }\n \n+static uint16_t\n+clb_multiwait(uint16_t port_id __rte_unused, uint16_t qidx __rte_unused,\n+\t\tstruct rte_mbuf **pkts __rte_unused, uint16_t nb_rx,\n+\t\tuint16_t max_pkts __rte_unused, void *arg)\n+{\n+\tconst unsigned int lcore = rte_lcore_id();\n+\tstruct queue_list_entry *queue_conf = arg;\n+\tstruct pmd_core_cfg *lcore_conf;\n+\tconst bool empty = nb_rx == 0;\n+\n+\tlcore_conf = &lcore_cfgs[lcore];\n+\n+\t/* early exit */\n+\tif (likely(!empty))\n+\t\t/* early exit */\n+\t\tqueue_reset(lcore_conf, queue_conf);\n+\telse {\n+\t\tstruct rte_power_monitor_cond pmc[lcore_conf->n_queues];\n+\t\tint ret;\n+\n+\t\t/* can this queue sleep? */\n+\t\tif (!queue_can_sleep(lcore_conf, queue_conf))\n+\t\t\treturn nb_rx;\n+\n+\t\t/* can this lcore sleep? */\n+\t\tif (!lcore_can_sleep(lcore_conf))\n+\t\t\treturn nb_rx;\n+\n+\t\t/* gather all monitoring conditions */\n+\t\tret = get_monitor_addresses(lcore_conf, pmc,\n+\t\t\t\tlcore_conf->n_queues);\n+\t\tif (ret < 0)\n+\t\t\treturn nb_rx;\n+\n+\t\trte_power_monitor_multi(pmc, lcore_conf->n_queues, UINT64_MAX);\n+\t}\n+\n+\treturn nb_rx;\n+}\n+\n static uint16_t\n clb_umwait(uint16_t port_id, uint16_t qidx, struct rte_mbuf **pkts __rte_unused,\n \t\tuint16_t nb_rx, uint16_t max_pkts __rte_unused, void *arg)\n@@ -362,14 +428,19 @@ static int\n check_monitor(struct pmd_core_cfg *cfg, const union queue *qdata)\n {\n \tstruct rte_power_monitor_cond dummy;\n+\tbool multimonitor_supported;\n \n \t/* check if rte_power_monitor is supported */\n \tif (!global_data.intrinsics_support.power_monitor) {\n \t\tRTE_LOG(DEBUG, POWER, \"Monitoring intrinsics are not supported\\n\");\n \t\treturn -ENOTSUP;\n \t}\n+\t/* check if multi-monitor is supported */\n+\tmultimonitor_supported =\n+\t\t\tglobal_data.intrinsics_support.power_monitor_multi;\n \n-\tif (cfg->n_queues > 0) {\n+\t/* if we're adding a new queue, do we support multiple queues? */\n+\tif (cfg->n_queues > 0 && !multimonitor_supported) {\n \t\tRTE_LOG(DEBUG, POWER, \"Monitoring multiple queues is not supported\\n\");\n \t\treturn -ENOTSUP;\n \t}\n@@ -385,6 +456,13 @@ check_monitor(struct pmd_core_cfg *cfg, const union queue *qdata)\n \treturn 0;\n }\n \n+static inline rte_rx_callback_fn\n+get_monitor_callback(void)\n+{\n+\treturn global_data.intrinsics_support.power_monitor_multi ?\n+\t\tclb_multiwait : clb_umwait;\n+}\n+\n int\n rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,\n \t\tuint16_t queue_id, enum rte_power_pmd_mgmt_type mode)\n@@ -449,7 +527,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,\n \t\tif (ret < 0)\n \t\t\tgoto end;\n \n-\t\tclb = clb_umwait;\n+\t\tclb = get_monitor_callback();\n \t\tbreak;\n \tcase RTE_POWER_MGMT_TYPE_SCALE:\n \t\t/* check if we can add a new queue */\n",
    "prefixes": [
        "v7",
        "6/7"
    ]
}