get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 71191,
    "url": "http://patches.dpdk.org/api/patches/71191/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200610142730.31376-11-dmitry.kozliuk@gmail.com/",
    "project": {
        "id": 1,
        "url": "http://patches.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": "<20200610142730.31376-11-dmitry.kozliuk@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200610142730.31376-11-dmitry.kozliuk@gmail.com",
    "date": "2020-06-10T14:27:29",
    "name": "[v8,10/11] eal/windows: initialize hugepage info",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "6461dd2153cc9af3e2af36f168d2648abe5f331c",
    "submitter": {
        "id": 1581,
        "url": "http://patches.dpdk.org/api/people/1581/?format=api",
        "name": "Dmitry Kozlyuk",
        "email": "dmitry.kozliuk@gmail.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200610142730.31376-11-dmitry.kozliuk@gmail.com/mbox/",
    "series": [
        {
            "id": 10386,
            "url": "http://patches.dpdk.org/api/series/10386/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=10386",
            "date": "2020-06-10T14:27:19",
            "name": "Windows basic memory management",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/10386/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/71191/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/71191/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 D4229A0520;\n\tWed, 10 Jun 2020 16:29:45 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id EAAD51BFB3;\n\tWed, 10 Jun 2020 16:28:07 +0200 (CEST)",
            "from mail-lj1-f195.google.com (mail-lj1-f195.google.com\n [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id CB3F71BE8A\n for <dev@dpdk.org>; Wed, 10 Jun 2020 16:28:01 +0200 (CEST)",
            "by mail-lj1-f195.google.com with SMTP id q19so2755577lji.2\n for <dev@dpdk.org>; Wed, 10 Jun 2020 07:28:01 -0700 (PDT)",
            "from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru.\n [37.110.65.23])\n by smtp.gmail.com with ESMTPSA id j12sm5051733ljg.15.2020.06.10.07.28.00\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 10 Jun 2020 07:28:00 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=eQIz1TjqvvIrbTDWtOxz2uGyl0XFVNAqwItLUCgSdHQ=;\n b=rsRSNLOPlsPdRBrRgHRjtVkDifKmYH2b7gG18D5U3p8RD+zu6f93jtdopUfkyZmAUG\n DBqdx2gY/o42Ghg4KTsk5EsrrtfxHB+0pgRtD4X605frzQc8bzklj0wzrJJqhsdn7sLu\n /DTU2+vHIaZwWG6NzKbTkoUArGEFoYSkhDjXzopIMObT9fUG21NA5RPyBbZHyj8C34PI\n GiG+OsuzdAWoHEGCQg4d6EC9UBynhF3MqPtuMSPVFULqZBk/hzJRAW2JRELDekXzGHHu\n 5mArpcDUYjVZil+7DpTFDPITX16ECLNZAwVVUnyWKs3pyPEDaNtSAVAcA/efWr9kGzoL\n q2Ng==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=eQIz1TjqvvIrbTDWtOxz2uGyl0XFVNAqwItLUCgSdHQ=;\n b=Km3BGPathOunCxfOvrJuo+k/QZ78rz9lCTiMBDzGsuOMexx9mpPePUdpqTlGXWJEHC\n ZNDfXncpkG6+nm3FJxEjdAq7tThnMSyG48aZSqsl2jlxrrV2jD+DYb3Oq9drOhSVIwm7\n hcis7jcVdGiDsU1VMf/2ix5N3By60qyRC3uin15tRDBUdqOqnJBuv3XIkBRFH4osDXSD\n K9p6ywiEBns1LSsClQ7SS0Up3uFjCxk3ly28kZsY1jC0Ehpl64ZtoKNFzRztUTHeSBQa\n osVCV5rr6X1NWwmY/FcF5zaKg4lnnmxJ/MZliou1+ZjDb2ePT0OBvPJx4ri9Q1G2iZqW\n JZ1Q==",
        "X-Gm-Message-State": "AOAM5304kcWMRKXP5DrMBuSpw4NaWJ9+nSeT1GXHlB1YE6741AFLCAx4\n qOMLECIcCy0n538P0G+SSMJRuj7AwK5GbA==",
        "X-Google-Smtp-Source": "\n ABdhPJwUXkpfpRFoZk3GyyEP/lW/S7BAXUYEUtBfZ9e5WF0OOyXTMIPlTQQyT79oGdMBOJNHlwRlOQ==",
        "X-Received": "by 2002:a2e:b529:: with SMTP id z9mr2025773ljm.390.1591799281032;\n Wed, 10 Jun 2020 07:28:01 -0700 (PDT)",
        "From": "Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>",
        "To": "dev@dpdk.org",
        "Cc": "Dmitry Malloy <dmitrym@microsoft.com>,\n Narcisa Ana Maria Vasile <Narcisa.Vasile@microsoft.com>,\n Fady Bader <fady@mellanox.com>, Tal Shnaiderman <talshn@mellanox.com>,\n Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Thomas Monjalon <thomas@monjalon.net>,\n Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>,\n Omar Cardona <ocardona@microsoft.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>,\n Ranjit Menon <ranjit.menon@intel.com>,\n John McNamara <john.mcnamara@intel.com>,\n Marko Kovacevic <marko.kovacevic@intel.com>",
        "Date": "Wed, 10 Jun 2020 17:27:29 +0300",
        "Message-Id": "<20200610142730.31376-11-dmitry.kozliuk@gmail.com>",
        "X-Mailer": "git-send-email 2.25.4",
        "In-Reply-To": "<20200610142730.31376-1-dmitry.kozliuk@gmail.com>",
        "References": "<20200608074153.29611-1-dmitry.kozliuk@gmail.com>\n <20200610142730.31376-1-dmitry.kozliuk@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v8 10/11] eal/windows: initialize hugepage info",
        "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": "Add hugepages discovery (\"large pages\" in Windows terminology)\nand update documentation for required privilege setup. Only 2MB\nhugepages are supported and their number is estimated roughly\ndue to the lack or unstable status of suitable OS APIs.\nAssign myself as maintainer for the implementation file.\n\nSigned-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>\n---\n MAINTAINERS                            |   4 +\n config/meson.build                     |   2 +\n doc/guides/windows_gsg/build_dpdk.rst  |  20 -----\n doc/guides/windows_gsg/index.rst       |   1 +\n doc/guides/windows_gsg/run_apps.rst    |  47 +++++++++++\n lib/librte_eal/windows/eal.c           |  14 ++++\n lib/librte_eal/windows/eal_hugepages.c | 108 +++++++++++++++++++++++++\n lib/librte_eal/windows/meson.build     |   1 +\n 8 files changed, 177 insertions(+), 20 deletions(-)\n create mode 100644 doc/guides/windows_gsg/run_apps.rst\n create mode 100644 lib/librte_eal/windows/eal_hugepages.c",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex a1722ca73..19b818f69 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -336,6 +336,10 @@ F: lib/librte_eal/windows/\n F: lib/librte_eal/rte_eal_exports.def\n F: doc/guides/windows_gsg/\n \n+Windows memory allocation\n+M: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>\n+F: lib/librte_eal/eal_hugepages.c\n+\n \n Core Libraries\n --------------\ndiff --git a/config/meson.build b/config/meson.build\nindex 43ab11310..c1e80de4b 100644\n--- a/config/meson.build\n+++ b/config/meson.build\n@@ -268,6 +268,8 @@ if is_windows\n \tif cc.get_id() == 'gcc'\n \t\tadd_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c')\n \tendif\n+\n+\tadd_project_link_arguments('-ladvapi32', language: 'c')\n endif\n \n if get_option('b_lto')\ndiff --git a/doc/guides/windows_gsg/build_dpdk.rst b/doc/guides/windows_gsg/build_dpdk.rst\nindex d46e84e3f..650483e3b 100644\n--- a/doc/guides/windows_gsg/build_dpdk.rst\n+++ b/doc/guides/windows_gsg/build_dpdk.rst\n@@ -111,23 +111,3 @@ Depending on the distribution, paths in this file may need adjustments.\n \n     meson --cross-file config/x86/meson_mingw.txt -Dexamples=helloworld build\n     ninja -C build\n-\n-\n-Run the helloworld example\n-==========================\n-\n-Navigate to the examples in the build directory and run `dpdk-helloworld.exe`.\n-\n-.. code-block:: console\n-\n-    cd C:\\Users\\me\\dpdk\\build\\examples\n-    dpdk-helloworld.exe\n-    hello from core 1\n-    hello from core 3\n-    hello from core 0\n-    hello from core 2\n-\n-Note for MinGW-w64: applications are linked to ``libwinpthread-1.dll``\n-by default. To run the example, either add toolchain executables directory\n-to the PATH or copy the library to the working directory.\n-Alternatively, static linking may be used (mind the LGPLv2.1 license).\ndiff --git a/doc/guides/windows_gsg/index.rst b/doc/guides/windows_gsg/index.rst\nindex d9b7990a8..e94593572 100644\n--- a/doc/guides/windows_gsg/index.rst\n+++ b/doc/guides/windows_gsg/index.rst\n@@ -12,3 +12,4 @@ Getting Started Guide for Windows\n \n     intro\n     build_dpdk\n+    run_apps\ndiff --git a/doc/guides/windows_gsg/run_apps.rst b/doc/guides/windows_gsg/run_apps.rst\nnew file mode 100644\nindex 000000000..21ac7f6c1\n--- /dev/null\n+++ b/doc/guides/windows_gsg/run_apps.rst\n@@ -0,0 +1,47 @@\n+..  SPDX-License-Identifier: BSD-3-Clause\n+    Copyright(c) 2020 Dmitry Kozlyuk\n+\n+Running DPDK Applications\n+=========================\n+\n+Grant *Lock pages in memory* Privilege\n+--------------------------------------\n+\n+Use of hugepages (\"large pages\" in Windows terminolocy) requires\n+``SeLockMemoryPrivilege`` for the user running an application.\n+\n+1. Open *Local Security Policy* snap in, either:\n+\n+   * Control Panel / Computer Management / Local Security Policy;\n+   * or Win+R, type ``secpol``, press Enter.\n+\n+2. Open *Local Policies / User Rights Assignment / Lock pages in memory.*\n+\n+3. Add desired users or groups to the list of grantees.\n+\n+4. Privilege is applied upon next logon. In particular, if privilege has been\n+   granted to current user, a logoff is required before it is available.\n+\n+See `Large-Page Support`_ in MSDN for details.\n+\n+.. _Large-page Support: https://docs.microsoft.com/en-us/windows/win32/memory/large-page-support\n+\n+\n+Run the ``helloworld`` Example\n+------------------------------\n+\n+Navigate to the examples in the build directory and run `dpdk-helloworld.exe`.\n+\n+.. code-block:: console\n+\n+    cd C:\\Users\\me\\dpdk\\build\\examples\n+    dpdk-helloworld.exe\n+    hello from core 1\n+    hello from core 3\n+    hello from core 0\n+    hello from core 2\n+\n+Note for MinGW-w64: applications are linked to ``libwinpthread-1.dll``\n+by default. To run the example, either add toolchain executables directory\n+to the PATH or copy the library to the working directory.\n+Alternatively, static linking may be used (mind the LGPLv2.1 license).\ndiff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c\nindex e7461f731..7c2fcc860 100644\n--- a/lib/librte_eal/windows/eal.c\n+++ b/lib/librte_eal/windows/eal.c\n@@ -19,8 +19,11 @@\n #include <eal_private.h>\n #include <rte_trace_point.h>\n \n+#include \"eal_hugepages.h\"\n #include \"eal_windows.h\"\n \n+#define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)\n+\n  /* Allow the application to print its usage message too if set */\n static rte_usage_hook_t\trte_application_usage_hook;\n \n@@ -276,6 +279,17 @@ rte_eal_init(int argc, char **argv)\n \tif (fctret < 0)\n \t\texit(1);\n \n+\tif (!internal_config.no_hugetlbfs && (eal_hugepage_info_init() < 0)) {\n+\t\trte_eal_init_alert(\"Cannot get hugepage information\");\n+\t\trte_errno = EACCES;\n+\t\treturn -1;\n+\t}\n+\n+\tif (internal_config.memory == 0 && !internal_config.force_sockets) {\n+\t\tif (internal_config.no_hugetlbfs)\n+\t\t\tinternal_config.memory = MEMSIZE_IF_NO_HUGE_PAGE;\n+\t}\n+\n \teal_thread_init_master(rte_config.master_lcore);\n \n \tRTE_LCORE_FOREACH_SLAVE(i) {\ndiff --git a/lib/librte_eal/windows/eal_hugepages.c b/lib/librte_eal/windows/eal_hugepages.c\nnew file mode 100644\nindex 000000000..61d0dcd3c\n--- /dev/null\n+++ b/lib/librte_eal/windows/eal_hugepages.c\n@@ -0,0 +1,108 @@\n+#include <rte_errno.h>\n+#include <rte_log.h>\n+#include <rte_memory.h>\n+#include <rte_memzone.h>\n+#include <rte_os.h>\n+\n+#include \"eal_filesystem.h\"\n+#include \"eal_hugepages.h\"\n+#include \"eal_internal_cfg.h\"\n+#include \"eal_windows.h\"\n+\n+static int\n+hugepage_claim_privilege(void)\n+{\n+\tstatic const wchar_t privilege[] = L\"SeLockMemoryPrivilege\";\n+\n+\tHANDLE token;\n+\tLUID luid;\n+\tTOKEN_PRIVILEGES tp;\n+\tint ret = -1;\n+\n+\tif (!OpenProcessToken(GetCurrentProcess(),\n+\t\t\tTOKEN_ADJUST_PRIVILEGES, &token)) {\n+\t\tRTE_LOG_WIN32_ERR(\"OpenProcessToken()\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (!LookupPrivilegeValueW(NULL, privilege, &luid)) {\n+\t\tRTE_LOG_WIN32_ERR(\"LookupPrivilegeValue(\\\"%S\\\")\", privilege);\n+\t\tgoto exit;\n+\t}\n+\n+\ttp.PrivilegeCount = 1;\n+\ttp.Privileges[0].Luid = luid;\n+\ttp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;\n+\n+\tif (!AdjustTokenPrivileges(\n+\t\t\ttoken, FALSE, &tp, sizeof(tp), NULL, NULL)) {\n+\t\tRTE_LOG_WIN32_ERR(\"AdjustTokenPrivileges()\");\n+\t\tgoto exit;\n+\t}\n+\n+\tret = 0;\n+\n+exit:\n+\tCloseHandle(token);\n+\n+\treturn ret;\n+}\n+\n+static int\n+hugepage_info_init(void)\n+{\n+\tstruct hugepage_info *hpi;\n+\tunsigned int socket_id;\n+\tint ret = 0;\n+\n+\t/* Only one hugepage size available on Windows. */\n+\tinternal_config.num_hugepage_sizes = 1;\n+\thpi = &internal_config.hugepage_info[0];\n+\n+\thpi->hugepage_sz = GetLargePageMinimum();\n+\tif (hpi->hugepage_sz == 0)\n+\t\treturn -ENOTSUP;\n+\n+\t/* Assume all memory on each NUMA node available for hugepages,\n+\t * because Windows neither advertises additional limits,\n+\t * nor provides an API to query them.\n+\t */\n+\tfor (socket_id = 0; socket_id < rte_socket_count(); socket_id++) {\n+\t\tULONGLONG bytes;\n+\t\tunsigned int numa_node;\n+\n+\t\tnuma_node = eal_socket_numa_node(socket_id);\n+\t\tif (!GetNumaAvailableMemoryNodeEx(numa_node, &bytes)) {\n+\t\t\tRTE_LOG_WIN32_ERR(\"GetNumaAvailableMemoryNodeEx(%u)\",\n+\t\t\t\tnuma_node);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\thpi->num_pages[socket_id] = bytes / hpi->hugepage_sz;\n+\t\tRTE_LOG(DEBUG, EAL,\n+\t\t\t\"Found %u hugepages of %zu bytes on socket %u\\n\",\n+\t\t\thpi->num_pages[socket_id], hpi->hugepage_sz, socket_id);\n+\t}\n+\n+\t/* No hugepage filesystem on Windows. */\n+\thpi->lock_descriptor = -1;\n+\tmemset(hpi->hugedir, 0, sizeof(hpi->hugedir));\n+\n+\treturn ret;\n+}\n+\n+int\n+eal_hugepage_info_init(void)\n+{\n+\tif (hugepage_claim_privilege() < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot claim hugepage privilege\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tif (hugepage_info_init() < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"Cannot get hugepage information\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/lib/librte_eal/windows/meson.build b/lib/librte_eal/windows/meson.build\nindex adfc8b9b7..52978e9d7 100644\n--- a/lib/librte_eal/windows/meson.build\n+++ b/lib/librte_eal/windows/meson.build\n@@ -6,6 +6,7 @@ subdir('include')\n sources += files(\n \t'eal.c',\n \t'eal_debug.c',\n+\t'eal_hugepages.c',\n \t'eal_lcore.c',\n \t'eal_log.c',\n \t'eal_thread.c',\n",
    "prefixes": [
        "v8",
        "10/11"
    ]
}