get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 86317,
    "url": "http://patchwork.dpdk.org/api/patches/86317/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/54a11365bf7911b3e11471a89b515a497514fc72.1610377084.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": "<54a11365bf7911b3e11471a89b515a497514fc72.1610377084.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/54a11365bf7911b3e11471a89b515a497514fc72.1610377084.git.anatoly.burakov@intel.com",
    "date": "2021-01-11T14:58:48",
    "name": "[v15,03/11] eal: change API of power intrinsics",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b73929c9cc341e3bf7a1ad630b5813a27ae6a30e",
    "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/54a11365bf7911b3e11471a89b515a497514fc72.1610377084.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 14637,
            "url": "http://patchwork.dpdk.org/api/series/14637/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=14637",
            "date": "2021-01-11T14:58:45",
            "name": "Add PMD power management",
            "version": 15,
            "mbox": "http://patchwork.dpdk.org/series/14637/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/86317/comments/",
    "check": "warning",
    "checks": "http://patchwork.dpdk.org/api/patches/86317/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 E137CA09FF;\n\tMon, 11 Jan 2021 15:59:27 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 7E2F7140EA8;\n\tMon, 11 Jan 2021 15:59:08 +0100 (CET)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id 9B5E0140EA4\n for <dev@dpdk.org>; Mon, 11 Jan 2021 15:59:06 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 11 Jan 2021 06:59:06 -0800",
            "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.222.179])\n by orsmga001.jf.intel.com with ESMTP; 11 Jan 2021 06:59:03 -0800"
        ],
        "IronPort-SDR": [
            "\n hjxR6QfbOjxOOdpDH3yQ1uOG4vgK/bJBuAsSHClvKarrTsyFweFsQFt1tf9r8Wz7ZFHYUB1npG\n +XClFwCc9UgA==",
            "\n 32ucdH0/haZKJdhlpu7ODWIdp0m/7XgEokF+pKZ6ODQcRokD7yqu3VC1IgenkJRR3n3LboTEbu\n PHLOYW5N49rw=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9860\"; a=\"157652997\"",
            "E=Sophos;i=\"5.79,338,1602572400\"; d=\"scan'208\";a=\"157652997\"",
            "E=Sophos;i=\"5.79,338,1602572400\"; d=\"scan'208\";a=\"423816546\""
        ],
        "X-ExtLoop1": "1",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Timothy McDaniel <timothy.mcdaniel@intel.com>,\n Jerin Jacob <jerinj@marvell.com>, Ruifeng Wang <ruifeng.wang@arm.com>,\n Jan Viktorin <viktorin@rehivetech.com>,\n David Christensen <drc@linux.vnet.ibm.com>,\n Bruce Richardson <bruce.richardson@intel.com>,\n Konstantin Ananyev <konstantin.ananyev@intel.com>, thomas@monjalon.net,\n david.hunt@intel.com, chris.macnamara@intel.com",
        "Date": "Mon, 11 Jan 2021 14:58:48 +0000",
        "Message-Id": "\n <54a11365bf7911b3e11471a89b515a497514fc72.1610377084.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<cover.1610377084.git.anatoly.burakov@intel.com>",
        "References": "<cover.1610375528.git.anatoly.burakov@intel.com>\n <cover.1610377084.git.anatoly.burakov@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v15 03/11] eal: change API of power intrinsics",
        "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": "Instead of passing around pointers and integers, collect everything\ninto struct. This makes API design around these intrinsics much easier.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n drivers/event/dlb/dlb.c                       | 10 ++--\n drivers/event/dlb2/dlb2.c                     | 10 ++--\n lib/librte_eal/arm/rte_power_intrinsics.c     | 25 ++++------\n .../include/generic/rte_power_intrinsics.h    | 49 ++++++++-----------\n lib/librte_eal/ppc/rte_power_intrinsics.c     | 25 ++++------\n lib/librte_eal/x86/rte_power_intrinsics.c     | 32 ++++++------\n 6 files changed, 70 insertions(+), 81 deletions(-)",
    "diff": "diff --git a/drivers/event/dlb/dlb.c b/drivers/event/dlb/dlb.c\nindex 0c95c4793d..d2f2026291 100644\n--- a/drivers/event/dlb/dlb.c\n+++ b/drivers/event/dlb/dlb.c\n@@ -3161,6 +3161,7 @@ dlb_dequeue_wait(struct dlb_eventdev *dlb,\n \t\t/* Interrupts not supported by PF PMD */\n \t\treturn 1;\n \t} else if (dlb->umwait_allowed) {\n+\t\tstruct rte_power_monitor_cond pmc;\n \t\tvolatile struct dlb_dequeue_qe *cq_base;\n \t\tunion {\n \t\t\tuint64_t raw_qe[2];\n@@ -3181,9 +3182,12 @@ dlb_dequeue_wait(struct dlb_eventdev *dlb,\n \t\telse\n \t\t\texpected_value = 0;\n \n-\t\trte_power_monitor(monitor_addr, expected_value,\n-\t\t\t\t  qe_mask.raw_qe[1], timeout + start_ticks,\n-\t\t\t\t  sizeof(uint64_t));\n+\t\tpmc.addr = monitor_addr;\n+\t\tpmc.val = expected_value;\n+\t\tpmc.mask = qe_mask.raw_qe[1];\n+\t\tpmc.data_sz = sizeof(uint64_t);\n+\n+\t\trte_power_monitor(&pmc, timeout + start_ticks);\n \n \t\tDLB_INC_STAT(ev_port->stats.traffic.rx_umonitor_umwait, 1);\n \t} else {\ndiff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c\nindex 86724863f2..c9a8a02278 100644\n--- a/drivers/event/dlb2/dlb2.c\n+++ b/drivers/event/dlb2/dlb2.c\n@@ -2870,6 +2870,7 @@ dlb2_dequeue_wait(struct dlb2_eventdev *dlb2,\n \tif (elapsed_ticks >= timeout) {\n \t\treturn 1;\n \t} else if (dlb2->umwait_allowed) {\n+\t\tstruct rte_power_monitor_cond pmc;\n \t\tvolatile struct dlb2_dequeue_qe *cq_base;\n \t\tunion {\n \t\t\tuint64_t raw_qe[2];\n@@ -2890,9 +2891,12 @@ dlb2_dequeue_wait(struct dlb2_eventdev *dlb2,\n \t\telse\n \t\t\texpected_value = 0;\n \n-\t\trte_power_monitor(monitor_addr, expected_value,\n-\t\t\t\t  qe_mask.raw_qe[1], timeout + start_ticks,\n-\t\t\t\t  sizeof(uint64_t));\n+\t\tpmc.addr = monitor_addr;\n+\t\tpmc.val = expected_value;\n+\t\tpmc.mask = qe_mask.raw_qe[1];\n+\t\tpmc.data_sz = sizeof(uint64_t);\n+\n+\t\trte_power_monitor(&pmc, timeout + start_ticks);\n \n \t\tDLB2_INC_STAT(ev_port->stats.traffic.rx_umonitor_umwait, 1);\n \t} else {\ndiff --git a/lib/librte_eal/arm/rte_power_intrinsics.c b/lib/librte_eal/arm/rte_power_intrinsics.c\nindex e5a49facb4..f2c3506b90 100644\n--- a/lib/librte_eal/arm/rte_power_intrinsics.c\n+++ b/lib/librte_eal/arm/rte_power_intrinsics.c\n@@ -7,36 +7,31 @@\n /**\n  * This function is not supported on ARM.\n  */\n-void rte_power_monitor(const volatile void *p, const uint64_t expected_value,\n-\t\tconst uint64_t value_mask, const uint64_t tsc_timestamp,\n-\t\tconst uint8_t data_sz)\n+void\n+rte_power_monitor(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp)\n {\n-\tRTE_SET_USED(p);\n-\tRTE_SET_USED(expected_value);\n-\tRTE_SET_USED(value_mask);\n+\tRTE_SET_USED(pmc);\n \tRTE_SET_USED(tsc_timestamp);\n-\tRTE_SET_USED(data_sz);\n }\n \n /**\n  * This function is not supported on ARM.\n  */\n-void rte_power_monitor_sync(const volatile void *p, const uint64_t expected_value,\n-\t\tconst uint64_t value_mask, const uint64_t tsc_timestamp,\n-\t\tconst uint8_t data_sz, rte_spinlock_t *lck)\n+void\n+rte_power_monitor_sync(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp, rte_spinlock_t *lck)\n {\n-\tRTE_SET_USED(p);\n-\tRTE_SET_USED(expected_value);\n-\tRTE_SET_USED(value_mask);\n+\tRTE_SET_USED(pmc);\n \tRTE_SET_USED(tsc_timestamp);\n \tRTE_SET_USED(lck);\n-\tRTE_SET_USED(data_sz);\n }\n \n /**\n  * This function is not supported on ARM.\n  */\n-void rte_power_pause(const uint64_t tsc_timestamp)\n+void\n+rte_power_pause(const uint64_t tsc_timestamp)\n {\n \tRTE_SET_USED(tsc_timestamp);\n }\ndiff --git a/lib/librte_eal/include/generic/rte_power_intrinsics.h b/lib/librte_eal/include/generic/rte_power_intrinsics.h\nindex ffa72f7578..00c670cb50 100644\n--- a/lib/librte_eal/include/generic/rte_power_intrinsics.h\n+++ b/lib/librte_eal/include/generic/rte_power_intrinsics.h\n@@ -18,6 +18,18 @@\n  * which are architecture-dependent.\n  */\n \n+struct rte_power_monitor_cond {\n+\tvolatile void *addr;  /**< Address to monitor for changes */\n+\tuint64_t val;         /**< Before attempting the monitoring, the address\n+\t                       *   may be read and compared against this value.\n+\t                       **/\n+\tuint64_t mask;   /**< 64-bit mask to extract current value from addr */\n+\tuint8_t data_sz; /**< Data size (in bytes) that will be used to compare\n+\t                  *   expected value with the memory address. Can be 1,\n+\t                  *   2, 4, or 8. Supplying any other value will lead to\n+\t                  *   undefined result. */\n+};\n+\n /**\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice\n@@ -35,25 +47,15 @@\n  * @warning It is responsibility of the user to check if this function is\n  *   supported at runtime using `rte_cpu_get_intrinsics_support()` API call.\n  *\n- * @param p\n- *   Address to monitor for changes.\n- * @param expected_value\n- *   Before attempting the monitoring, the `p` address may be read and compared\n- *   against this value. If `value_mask` is zero, this step will be skipped.\n- * @param value_mask\n- *   The 64-bit mask to use to extract current value from `p`.\n+ * @param pmc\n+ *   The monitoring condition structure.\n  * @param tsc_timestamp\n  *   Maximum TSC timestamp to wait for. Note that the wait behavior is\n  *   architecture-dependent.\n- * @param data_sz\n- *   Data size (in bytes) that will be used to compare expected value with the\n- *   memory address. Can be 1, 2, 4 or 8. Supplying any other value will lead\n- *   to undefined result.\n  */\n __rte_experimental\n-void rte_power_monitor(const volatile void *p,\n-\t\tconst uint64_t expected_value, const uint64_t value_mask,\n-\t\tconst uint64_t tsc_timestamp, const uint8_t data_sz);\n+void rte_power_monitor(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp);\n \n /**\n  * @warning\n@@ -75,30 +77,19 @@ void rte_power_monitor(const volatile void *p,\n  * @warning It is responsibility of the user to check if this function is\n  *   supported at runtime using `rte_cpu_get_intrinsics_support()` API call.\n  *\n- * @param p\n- *   Address to monitor for changes.\n- * @param expected_value\n- *   Before attempting the monitoring, the `p` address may be read and compared\n- *   against this value. If `value_mask` is zero, this step will be skipped.\n- * @param value_mask\n- *   The 64-bit mask to use to extract current value from `p`.\n+ * @param pmc\n+ *   The monitoring condition structure.\n  * @param tsc_timestamp\n  *   Maximum TSC timestamp to wait for. Note that the wait behavior is\n  *   architecture-dependent.\n- * @param data_sz\n- *   Data size (in bytes) that will be used to compare expected value with the\n- *   memory address. Can be 1, 2, 4 or 8. Supplying any other value will lead\n- *   to undefined result.\n  * @param lck\n  *   A spinlock that must be locked before entering the function, will be\n  *   unlocked while the CPU is sleeping, and will be locked again once the CPU\n  *   wakes up.\n  */\n __rte_experimental\n-void rte_power_monitor_sync(const volatile void *p,\n-\t\tconst uint64_t expected_value, const uint64_t value_mask,\n-\t\tconst uint64_t tsc_timestamp, const uint8_t data_sz,\n-\t\trte_spinlock_t *lck);\n+void rte_power_monitor_sync(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp, rte_spinlock_t *lck);\n \n /**\n  * @warning\ndiff --git a/lib/librte_eal/ppc/rte_power_intrinsics.c b/lib/librte_eal/ppc/rte_power_intrinsics.c\nindex 785effabe6..3897d2024d 100644\n--- a/lib/librte_eal/ppc/rte_power_intrinsics.c\n+++ b/lib/librte_eal/ppc/rte_power_intrinsics.c\n@@ -7,36 +7,31 @@\n /**\n  * This function is not supported on PPC64.\n  */\n-void rte_power_monitor(const volatile void *p, const uint64_t expected_value,\n-\t\t       const uint64_t value_mask, const uint64_t tsc_timestamp,\n-\t\t       const uint8_t data_sz)\n+void\n+rte_power_monitor(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp)\n {\n-\tRTE_SET_USED(p);\n-\tRTE_SET_USED(expected_value);\n-\tRTE_SET_USED(value_mask);\n+\tRTE_SET_USED(pmc);\n \tRTE_SET_USED(tsc_timestamp);\n-\tRTE_SET_USED(data_sz);\n }\n \n /**\n  * This function is not supported on PPC64.\n  */\n-void rte_power_monitor_sync(const volatile void *p, const uint64_t expected_value,\n-\t\t\t    const uint64_t value_mask, const uint64_t tsc_timestamp,\n-\t\t\t    const uint8_t data_sz, rte_spinlock_t *lck)\n+void\n+rte_power_monitor_sync(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp, rte_spinlock_t *lck)\n {\n-\tRTE_SET_USED(p);\n-\tRTE_SET_USED(expected_value);\n-\tRTE_SET_USED(value_mask);\n+\tRTE_SET_USED(pmc);\n \tRTE_SET_USED(tsc_timestamp);\n \tRTE_SET_USED(lck);\n-\tRTE_SET_USED(data_sz);\n }\n \n /**\n  * This function is not supported on PPC64.\n  */\n-void rte_power_pause(const uint64_t tsc_timestamp)\n+void\n+rte_power_pause(const uint64_t tsc_timestamp)\n {\n \tRTE_SET_USED(tsc_timestamp);\n }\ndiff --git a/lib/librte_eal/x86/rte_power_intrinsics.c b/lib/librte_eal/x86/rte_power_intrinsics.c\nindex a164ad55fc..9b0638148d 100644\n--- a/lib/librte_eal/x86/rte_power_intrinsics.c\n+++ b/lib/librte_eal/x86/rte_power_intrinsics.c\n@@ -31,9 +31,8 @@ __get_umwait_val(const volatile void *p, const uint8_t sz)\n  * Intel(R) 64 and IA-32 Architectures Software Developer's Manual.\n  */\n void\n-rte_power_monitor(const volatile void *p, const uint64_t expected_value,\n-\t\tconst uint64_t value_mask, const uint64_t tsc_timestamp,\n-\t\tconst uint8_t data_sz)\n+rte_power_monitor(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp)\n {\n \tconst uint32_t tsc_l = (uint32_t)tsc_timestamp;\n \tconst uint32_t tsc_h = (uint32_t)(tsc_timestamp >> 32);\n@@ -50,14 +49,15 @@ rte_power_monitor(const volatile void *p, const uint64_t expected_value,\n \t/* set address for UMONITOR */\n \tasm volatile(\".byte 0xf3, 0x0f, 0xae, 0xf7;\"\n \t\t\t:\n-\t\t\t: \"D\"(p));\n+\t\t\t: \"D\"(pmc->addr));\n \n-\tif (value_mask) {\n-\t\tconst uint64_t cur_value = __get_umwait_val(p, data_sz);\n-\t\tconst uint64_t masked = cur_value & value_mask;\n+\tif (pmc->mask) {\n+\t\tconst uint64_t cur_value = __get_umwait_val(\n+\t\t\t\tpmc->addr, pmc->data_sz);\n+\t\tconst uint64_t masked = cur_value & pmc->mask;\n \n \t\t/* if the masked value is already matching, abort */\n-\t\tif (masked == expected_value)\n+\t\tif (masked == pmc->val)\n \t\t\treturn;\n \t}\n \t/* execute UMWAIT */\n@@ -73,9 +73,8 @@ rte_power_monitor(const volatile void *p, const uint64_t expected_value,\n  * Intel(R) 64 and IA-32 Architectures Software Developer's Manual.\n  */\n void\n-rte_power_monitor_sync(const volatile void *p, const uint64_t expected_value,\n-\t\tconst uint64_t value_mask, const uint64_t tsc_timestamp,\n-\t\tconst uint8_t data_sz, rte_spinlock_t *lck)\n+rte_power_monitor_sync(const struct rte_power_monitor_cond *pmc,\n+\t\tconst uint64_t tsc_timestamp, rte_spinlock_t *lck)\n {\n \tconst uint32_t tsc_l = (uint32_t)tsc_timestamp;\n \tconst uint32_t tsc_h = (uint32_t)(tsc_timestamp >> 32);\n@@ -92,14 +91,15 @@ rte_power_monitor_sync(const volatile void *p, const uint64_t expected_value,\n \t/* set address for UMONITOR */\n \tasm volatile(\".byte 0xf3, 0x0f, 0xae, 0xf7;\"\n \t\t\t:\n-\t\t\t: \"D\"(p));\n+\t\t\t: \"D\"(pmc->addr));\n \n-\tif (value_mask) {\n-\t\tconst uint64_t cur_value = __get_umwait_val(p, data_sz);\n-\t\tconst uint64_t masked = cur_value & value_mask;\n+\tif (pmc->mask) {\n+\t\tconst uint64_t cur_value = __get_umwait_val(\n+\t\t\t\tpmc->addr, pmc->data_sz);\n+\t\tconst uint64_t masked = cur_value & pmc->mask;\n \n \t\t/* if the masked value is already matching, abort */\n-\t\tif (masked == expected_value)\n+\t\tif (masked == pmc->val)\n \t\t\treturn;\n \t}\n \trte_spinlock_unlock(lck);\n",
    "prefixes": [
        "v15",
        "03/11"
    ]
}