get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 84110,
    "url": "https://patches.dpdk.org/api/patches/84110/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1605265789-12932-11-git-send-email-juraj.linkes@pantheon.tech/",
    "project": {
        "id": 1,
        "url": "https://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": "<1605265789-12932-11-git-send-email-juraj.linkes@pantheon.tech>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1605265789-12932-11-git-send-email-juraj.linkes@pantheon.tech",
    "date": "2020-11-13T11:09:44",
    "name": "[v10,10/15] build: optional NUMA and cpu counts detection",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "fa73c6aee972757971be71892901fa162e71e5c7",
    "submitter": {
        "id": 1626,
        "url": "https://patches.dpdk.org/api/people/1626/?format=api",
        "name": "Juraj Linkeš",
        "email": "juraj.linkes@pantheon.tech"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1605265789-12932-11-git-send-email-juraj.linkes@pantheon.tech/mbox/",
    "series": [
        {
            "id": 13869,
            "url": "https://patches.dpdk.org/api/series/13869/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=13869",
            "date": "2020-11-13T11:09:35",
            "name": "Arm build options rework",
            "version": 10,
            "mbox": "https://patches.dpdk.org/series/13869/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/84110/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/84110/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 3DAE7A09DE;\n\tFri, 13 Nov 2020 12:13:17 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 2EE46C928;\n\tFri, 13 Nov 2020 12:10:25 +0100 (CET)",
            "from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20])\n by dpdk.org (Postfix) with ESMTP id 1F13EC8D6\n for <dev@dpdk.org>; Fri, 13 Nov 2020 12:10:11 +0100 (CET)",
            "from localhost (localhost [127.0.0.1])\n by lb.pantheon.sk (Postfix) with ESMTP id 5DFC8B9978;\n Fri, 13 Nov 2020 12:10:09 +0100 (CET)",
            "from lb.pantheon.sk ([127.0.0.1])\n by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id UW20hJbu_eEi; Fri, 13 Nov 2020 12:10:08 +0100 (CET)",
            "from service-node1.lab.pantheon.local (unknown [46.229.239.141])\n by lb.pantheon.sk (Postfix) with ESMTP id 0217BB92ED;\n Fri, 13 Nov 2020 12:09:59 +0100 (CET)"
        ],
        "X-Virus-Scanned": "amavisd-new at siecit.sk",
        "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "To": "bruce.richardson@intel.com, Ruifeng.Wang@arm.com,\n Honnappa.Nagarahalli@arm.com, Phil.Yang@arm.com, vcchunga@amazon.com,\n Dharmik.Thakkar@arm.com, jerinjacobk@gmail.com, hemant.agrawal@nxp.com,\n ajit.khaparde@broadcom.com, ferruh.yigit@intel.com",
        "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "Date": "Fri, 13 Nov 2020 12:09:44 +0100",
        "Message-Id": "<1605265789-12932-11-git-send-email-juraj.linkes@pantheon.tech>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1605265789-12932-1-git-send-email-juraj.linkes@pantheon.tech>",
        "References": "<1605100718-7991-1-git-send-email-juraj.linkes@pantheon.tech>\n <1605265789-12932-1-git-send-email-juraj.linkes@pantheon.tech>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v10 10/15] build: optional NUMA and cpu counts\n\tdetection",
        "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 an option to automatically discover the host's numa and cpu counts\nand use those values for a non cross-build.\nGive users the option to override the per-arch default values or values\nfrom cross files by specifying them on the command line with -Dmax_lcores\nand -Dmax_numa_nodes.\n\nSigned-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>\nReviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\n---\n buildtools/get_cpu_count.py  |  7 ++++++\n buildtools/get_numa_count.py | 22 +++++++++++++++++\n buildtools/meson.build       |  2 ++\n config/meson.build           | 47 ++++++++++++++++++++++++++++++++++--\n config/x86/meson.build       |  2 ++\n meson_options.txt            |  8 +++---\n 6 files changed, 82 insertions(+), 6 deletions(-)\n create mode 100644 buildtools/get_cpu_count.py\n create mode 100644 buildtools/get_numa_count.py",
    "diff": "diff --git a/buildtools/get_cpu_count.py b/buildtools/get_cpu_count.py\nnew file mode 100644\nindex 000000000..b269d557b\n--- /dev/null\n+++ b/buildtools/get_cpu_count.py\n@@ -0,0 +1,7 @@\n+#!/usr/bin/env python3\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright (c) 2020 PANTHEON.tech s.r.o.\n+\n+import os\n+\n+print(os.cpu_count())\ndiff --git a/buildtools/get_numa_count.py b/buildtools/get_numa_count.py\nnew file mode 100644\nindex 000000000..be73c5c3f\n--- /dev/null\n+++ b/buildtools/get_numa_count.py\n@@ -0,0 +1,22 @@\n+#!/usr/bin/env python3\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright (c) 2020 PANTHEON.tech s.r.o.\n+\n+import ctypes\n+import glob\n+import os\n+import subprocess\n+\n+if os.name == 'posix':\n+    if os.path.isdir('/sys/devices/system/node'):\n+        print(len(glob.glob('/sys/devices/system/node/node*')))\n+    else:\n+        subprocess.run(['sysctl', '-n', 'vm.ndomains'])\n+\n+elif os.name == 'nt':\n+    libkernel32 = ctypes.windll.kernel32\n+\n+    count = ctypes.c_ulong()\n+\n+    libkernel32.GetNumaHighestNodeNumber(ctypes.pointer(count))\n+    print(count.value + 1)\ndiff --git a/buildtools/meson.build b/buildtools/meson.build\nindex 04808dabc..925e733b1 100644\n--- a/buildtools/meson.build\n+++ b/buildtools/meson.build\n@@ -17,3 +17,5 @@ else\n endif\n map_to_win_cmd = py3 + files('map_to_win.py')\n sphinx_wrapper = py3 + files('call-sphinx-build.py')\n+get_cpu_count_cmd = py3 + files('get_cpu_count.py')\n+get_numa_count_cmd = py3 + files('get_numa_count.py')\ndiff --git a/config/meson.build b/config/meson.build\nindex c7f7aa6e2..ce0abe49b 100644\n--- a/config/meson.build\n+++ b/config/meson.build\n@@ -231,8 +231,6 @@ foreach arg: warning_flags\n endforeach\n \n # set other values pulled from the build options\n-dpdk_conf.set('RTE_MAX_LCORE', get_option('max_lcores'))\n-dpdk_conf.set('RTE_MAX_NUMA_NODES', get_option('max_numa_nodes'))\n dpdk_conf.set('RTE_MAX_ETHPORTS', get_option('max_ethports'))\n dpdk_conf.set('RTE_LIBEAL_USE_HPET', get_option('use_hpet'))\n dpdk_conf.set('RTE_ENABLE_TRACE_FP', get_option('enable_trace_fp'))\n@@ -251,6 +249,51 @@ compile_time_cpuflags = []\n subdir(arch_subdir)\n dpdk_conf.set('RTE_COMPILE_TIME_CPUFLAGS', ','.join(compile_time_cpuflags))\n \n+max_lcores = get_option('max_lcores')\n+if max_lcores > 0\n+\t# Overwrite the default value from arch_subdir with user input\n+\tdpdk_conf.set('RTE_MAX_LCORE', max_lcores)\n+elif max_lcores == -1\n+\t# Overwrite the default value with discovered values\n+\tif meson.is_cross_build()\n+\t\terror('Discovery of max_lcores is not supported for cross-compilation.')\n+\tendif\n+\t# Discovery makes sense only for non-cross builds\n+\tmax_lcores = run_command(get_cpu_count_cmd).stdout().to_int()\n+\tmin_lcores = 2\n+\t# DPDK must be build for at least 2 cores\n+\tif max_lcores < min_lcores\n+\t\tmessage('Found less than @0@ cores, building for @0@ cores'.format(min_lcores))\n+\t\tmax_lcores = min_lcores\n+\telse\n+\t\tmessage('Found @0@ cores'.format(max_lcores))\n+\tendif\n+\tdpdk_conf.set('RTE_MAX_LCORE', max_lcores)\n+endif\n+\n+max_numa_nodes = get_option('max_numa_nodes')\n+if max_numa_nodes > 0\n+\t# Overwrite the default value from arch_subdir with user input\n+\tdpdk_conf.set('RTE_MAX_NUMA_NODES', max_numa_nodes)\n+elif max_numa_nodes == -1\n+\t# Overwrite the default value with discovered values\n+\tif meson.is_cross_build()\n+\t\terror('Discovery of max_numa_nodes not supported for cross-compilation.')\n+\tendif\n+\t# Discovery makes sense only for non-cross builds\n+\tmax_numa_nodes = run_command(get_numa_count_cmd).stdout().to_int()\n+\tmessage('Found @0@ numa nodes'.format(max_numa_nodes))\n+\tdpdk_conf.set('RTE_MAX_NUMA_NODES', max_numa_nodes)\n+endif\n+\n+# check that cpu and numa count is set and error out if it's not set\n+if not dpdk_conf.has('RTE_MAX_LCORE')\n+\terror('Number of cores not specified.')\n+endif\n+if not dpdk_conf.has('RTE_MAX_NUMA_NODES')\n+\terror('Number of numa nodes not specified.')\n+endif\n+\n # set the install path for the drivers\n dpdk_conf.set_quoted('RTE_EAL_PMD_PATH', eal_pmd_path)\n \ndiff --git a/config/x86/meson.build b/config/x86/meson.build\nindex 31bfa63b1..4989d47f3 100644\n--- a/config/x86/meson.build\n+++ b/config/x86/meson.build\n@@ -57,3 +57,5 @@ else\n endif\n \n dpdk_conf.set('RTE_CACHE_LINE_SIZE', 64)\n+dpdk_conf.set('RTE_MAX_LCORE', 128)\n+dpdk_conf.set('RTE_MAX_NUMA_NODES', 4)\ndiff --git a/meson_options.txt b/meson_options.txt\nindex bc649f245..0c9adb1bb 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -26,10 +26,10 @@ option('machine', type: 'string', value: 'native',\n \tdescription: 'set the target machine type. Set to generic for a build usable on all machines of the build machine architecture, set to native to let the compiler pick the architecture of the build machine.')\n option('max_ethports', type: 'integer', value: 32,\n \tdescription: 'maximum number of Ethernet devices')\n-option('max_lcores', type: 'integer', value: 128,\n-\tdescription: 'maximum number of cores/threads supported by EAL')\n-option('max_numa_nodes', type: 'integer', value: 4,\n-\tdescription: 'maximum number of NUMA nodes supported by EAL')\n+option('max_lcores', type: 'integer', value: 0,\n+\tdescription: 'maximum number of cores/threads supported by EAL. Set to positive integer to overwrite per-arch or cross-compilation defaults. Set to -1 to detect the number of cores on the build machine.')\n+option('max_numa_nodes', type: 'integer', value: 0,\n+\tdescription: 'maximum number of NUMA nodes supported by EAL. Set to positive integer to overwrite per-arch or cross-compilation defaults. Set to -1 to detect the number of numa nodes on the build machine.')\n option('enable_trace_fp', type: 'boolean', value: false,\n \tdescription: 'enable fast path trace points.')\n option('tests', type: 'boolean', value: true,\n",
    "prefixes": [
        "v10",
        "10/15"
    ]
}