get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 85327,
    "url": "http://patchwork.dpdk.org/api/patches/85327/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/454e4700bc2b9b9de5520533ff6af9dbe0023c58.1608213657.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": "<454e4700bc2b9b9de5520533ff6af9dbe0023c58.1608213657.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/454e4700bc2b9b9de5520533ff6af9dbe0023c58.1608213657.git.anatoly.burakov@intel.com",
    "date": "2020-12-17T14:05:32",
    "name": "[v12,02/11] eal: avoid invalid API usage in power intrinsics",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e14c14d2558c6d99c3b9d3d3098dae2e455bb023",
    "submitter": {
        "id": 4,
        "url": "http://patchwork.dpdk.org/api/people/4/?format=api",
        "name": "Burakov, Anatoly",
        "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/454e4700bc2b9b9de5520533ff6af9dbe0023c58.1608213657.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 14349,
            "url": "http://patchwork.dpdk.org/api/series/14349/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=14349",
            "date": "2020-12-17T14:05:30",
            "name": "Add PMD power management",
            "version": 12,
            "mbox": "http://patchwork.dpdk.org/series/14349/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/85327/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/85327/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 687EEA09F6;\n\tThu, 17 Dec 2020 15:06:57 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 1B10ECA2E;\n\tThu, 17 Dec 2020 15:06:21 +0100 (CET)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n by dpdk.org (Postfix) with ESMTP id 43D0FCA12\n for <dev@dpdk.org>; Thu, 17 Dec 2020 15:06:17 +0100 (CET)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Dec 2020 06:05:46 -0800",
            "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.222.52])\n by fmsmga006.fm.intel.com with ESMTP; 17 Dec 2020 06:05:43 -0800"
        ],
        "IronPort-SDR": [
            "\n Nns8c9VmdYvLIWILRefdDfjMpqfK5+nJ/ooouFysXbqSf8DoiYJu9+4M2pvIes6XG1qIuLl+N6\n cxX3leZGomTQ==",
            "\n lAJ8ERoJfpkgcckb88BrxCoTz+8Q5+IqQ/KnL4KubmOk8hcuco/SnPIwTSB1K1zOtksqBnWzUT\n JCiIv+3uw3AA=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9837\"; a=\"175398775\"",
            "E=Sophos;i=\"5.78,428,1599548400\"; d=\"scan'208\";a=\"175398775\"",
            "E=Sophos;i=\"5.78,428,1599548400\"; d=\"scan'208\";a=\"557886895\""
        ],
        "X-ExtLoop1": "1",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>,\n Konstantin Ananyev <konstantin.ananyev@intel.com>, thomas@monjalon.net,\n gage.eads@intel.com, timothy.mcdaniel@intel.com, david.hunt@intel.com,\n chris.macnamara@intel.com",
        "Date": "Thu, 17 Dec 2020 14:05:32 +0000",
        "Message-Id": "\n <454e4700bc2b9b9de5520533ff6af9dbe0023c58.1608213657.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": [
            "<cover.1608213657.git.anatoly.burakov@intel.com>",
            "<cover.1608213657.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1608213657.git.anatoly.burakov@intel.com>",
            "<1604315406-27669-1-git-send-email-liang.j.ma@intel.com>\n <cover.1608213657.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v12 02/11] eal: avoid invalid API usage in power\n\tintrinsics",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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": "Currently, the API documentation mandates that if the user wants to use\nthe power management intrinsics, they need to call the\n`rte_cpu_get_intrinsics_support` API and check support for specific\nintrinsics.\n\nHowever, if the user does not do that, it is possible to get illegal\ninstruction error because we're using raw instruction opcodes, which may\nor may not be supported at runtime.\n\nNow that we have everything in a C file, we can check for support at\nstartup and prevent the user from possibly encountering illegal\ninstruction errors.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n .../include/generic/rte_power_intrinsics.h    |  3 --\n lib/librte_eal/x86/rte_power_intrinsics.c     | 31 +++++++++++++++++--\n 2 files changed, 28 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/include/generic/rte_power_intrinsics.h b/lib/librte_eal/include/generic/rte_power_intrinsics.h\nindex 67977bd511..ffa72f7578 100644\n--- a/lib/librte_eal/include/generic/rte_power_intrinsics.h\n+++ b/lib/librte_eal/include/generic/rte_power_intrinsics.h\n@@ -34,7 +34,6 @@\n  *\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- *   Failing to do so may result in an illegal CPU instruction error.\n  *\n  * @param p\n  *   Address to monitor for changes.\n@@ -75,7 +74,6 @@ void rte_power_monitor(const volatile void *p,\n  *\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- *   Failing to do so may result in an illegal CPU instruction error.\n  *\n  * @param p\n  *   Address to monitor for changes.\n@@ -111,7 +109,6 @@ void rte_power_monitor_sync(const volatile void *p,\n  *\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- *   Failing to do so may result in an illegal CPU instruction error.\n  *\n  * @param tsc_timestamp\n  *   Maximum TSC timestamp to wait for. Note that the wait behavior is\ndiff --git a/lib/librte_eal/x86/rte_power_intrinsics.c b/lib/librte_eal/x86/rte_power_intrinsics.c\nindex 34c5fd9c3e..b48a54ec7f 100644\n--- a/lib/librte_eal/x86/rte_power_intrinsics.c\n+++ b/lib/librte_eal/x86/rte_power_intrinsics.c\n@@ -4,6 +4,8 @@\n \n #include \"rte_power_intrinsics.h\"\n \n+static uint8_t wait_supported;\n+\n static inline uint64_t\n __get_umwait_val(const volatile void *p, const uint8_t sz)\n {\n@@ -35,6 +37,11 @@ rte_power_monitor(const volatile void *p, const uint64_t expected_value,\n {\n \tconst uint32_t tsc_l = (uint32_t)tsc_timestamp;\n \tconst uint32_t tsc_h = (uint32_t)(tsc_timestamp >> 32);\n+\n+\t/* prevent user from running this instruction if it's not supported */\n+\tif (!wait_supported)\n+\t\treturn;\n+\n \t/*\n \t * we're using raw byte codes for now as only the newest compiler\n \t * versions support this instruction natively.\n@@ -72,6 +79,11 @@ rte_power_monitor_sync(const volatile void *p, const uint64_t expected_value,\n {\n \tconst uint32_t tsc_l = (uint32_t)tsc_timestamp;\n \tconst uint32_t tsc_h = (uint32_t)(tsc_timestamp >> 32);\n+\n+\t/* prevent user from running this instruction if it's not supported */\n+\tif (!wait_supported)\n+\t\treturn;\n+\n \t/*\n \t * we're using raw byte codes for now as only the newest compiler\n \t * versions support this instruction natively.\n@@ -112,9 +124,22 @@ rte_power_pause(const uint64_t tsc_timestamp)\n \tconst uint32_t tsc_l = (uint32_t)tsc_timestamp;\n \tconst uint32_t tsc_h = (uint32_t)(tsc_timestamp >> 32);\n \n+\t/* prevent user from running this instruction if it's not supported */\n+\tif (!wait_supported)\n+\t\treturn;\n+\n \t/* execute TPAUSE */\n \tasm volatile(\".byte 0x66, 0x0f, 0xae, 0xf7;\"\n-\t\t\t: /* ignore rflags */\n-\t\t\t: \"D\"(0), /* enter C0.2 */\n-\t\t\t\"a\"(tsc_l), \"d\"(tsc_h));\n+\t\t: /* ignore rflags */\n+\t\t: \"D\"(0), /* enter C0.2 */\n+\t\t  \"a\"(tsc_l), \"d\"(tsc_h));\n+}\n+\n+RTE_INIT(rte_power_intrinsics_init) {\n+\tstruct rte_cpu_intrinsics i;\n+\n+\trte_cpu_get_intrinsics_support(&i);\n+\n+\tif (i.power_monitor && i.power_pause)\n+\t\twait_supported = 1;\n }\n",
    "prefixes": [
        "v12",
        "02/11"
    ]
}