Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/41479/?format=api
http://patches.dpdk.org/api/patches/41479/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/0ed69167149eca2965ad2e6fb222e74e0ea90a2a.1529940601.git.anatoly.burakov@intel.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": "<0ed69167149eca2965ad2e6fb222e74e0ea90a2a.1529940601.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/0ed69167149eca2965ad2e6fb222e74e0ea90a2a.1529940601.git.anatoly.burakov@intel.com", "date": "2018-06-25T15:59:39", "name": "[RFC,2/9] usertools/lib: add platform info library", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2c67b04b78f48d6be80e06f822450cb9b323caf5", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.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/0ed69167149eca2965ad2e6fb222e74e0ea90a2a.1529940601.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 225, "url": "http://patches.dpdk.org/api/series/225/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=225", "date": "2018-06-25T15:59:39", "name": "Modularize and enhance DPDK Python scripts", "version": 1, "mbox": "http://patches.dpdk.org/series/225/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/41479/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/41479/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 243A94CA1;\n\tMon, 25 Jun 2018 17:59:54 +0200 (CEST)", "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id 4BA721559\n\tfor <dev@dpdk.org>; Mon, 25 Jun 2018 17:59:50 +0200 (CEST)", "from orsmga006.jf.intel.com ([10.7.209.51])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t25 Jun 2018 08:59:49 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga006.jf.intel.com with ESMTP; 25 Jun 2018 08:59:47 -0700", "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw5PFxkmd032502; Mon, 25 Jun 2018 16:59:46 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w5PFxkdg026585;\n\tMon, 25 Jun 2018 16:59:46 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w5PFxkVD026581;\n\tMon, 25 Jun 2018 16:59:46 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.51,270,1526367600\"; d=\"scan'208\";a=\"52752843\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "john.mcnamara@intel.com, bruce.richardson@intel.com,\n\tpablo.de.lara.guarch@intel.com, david.hunt@intel.com,\n\tmohammad.abdul.awal@intel.com", "Date": "Mon, 25 Jun 2018 16:59:39 +0100", "Message-Id": "<0ed69167149eca2965ad2e6fb222e74e0ea90a2a.1529940601.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1529940601.git.anatoly.burakov@intel.com>", "<cover.1529940601.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1529940601.git.anatoly.burakov@intel.com>", "<cover.1529940601.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [RFC 2/9] usertools/lib: add platform info library", "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Add a library that will parse system information:\n\n* NUMA nodes\n* Cores and threads\n* Mapping from NUMA node and core to thread id's\n* Hyperthreading support status\n* RAM size\n* Default hugepage size as reported by kernel\n\nThis can be used by scripts.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n usertools/DPDKConfigLib/PlatformInfo.py | 130 ++++++++++++++++++++++++\n usertools/DPDKConfigLib/Util.py | 16 +++\n 2 files changed, 146 insertions(+)\n create mode 100755 usertools/DPDKConfigLib/PlatformInfo.py\n create mode 100755 usertools/DPDKConfigLib/Util.py", "diff": "diff --git a/usertools/DPDKConfigLib/PlatformInfo.py b/usertools/DPDKConfigLib/PlatformInfo.py\nnew file mode 100755\nindex 000000000..734d22026\n--- /dev/null\n+++ b/usertools/DPDKConfigLib/PlatformInfo.py\n@@ -0,0 +1,130 @@\n+#!/usr/bin/python\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2018 Intel Corporation\n+\n+\n+from .Util import *\n+import re\n+import glob\n+\n+__SYSFS_CPU_INFO_PATH = \"/sys/devices/system/cpu\"\n+__SYSFS_IOMMU_CLASS_PATH = \"/sys/class/iommu\"\n+__KERNEL_HPSZ_PATH = \"/sys/kernel/mm/hugepages/hugepages-*\"\n+\n+try:\n+ xrange # python 2\n+except NameError:\n+ xrange = range # python 3\n+\n+\n+__CPU_FLAGS_TO_HP_SIZE = {\n+ # x86 supports 2M and 1G pages\n+ \"pse\": 2048,\n+ \"pdpe1gb\": 1048576\n+}\n+__IOMMU_CPU_FLAGS = [\"vmx\", \"vms\"]\n+\n+__HT_CPU_FLAGS = [\"ht\"]\n+\n+\n+def _parse_cpuinfo(pinfo):\n+ core_info_list = []\n+ with open(\"/proc/cpuinfo\") as f:\n+ cur_core = {}\n+ for line in f:\n+ line = line.strip()\n+ # if we've reached end of current core info, store it and clear it\n+ if line == \"\":\n+ core_info_list.append(cur_core)\n+ cur_core = {}\n+ continue\n+ key, value = kv_split(line, \":\")\n+ cur_core[key] = value\n+ # parse flags - they're the same for all CPU's so only parse the first one\n+ flags = set(core_info_list[0][\"flags\"].split())\n+ for flag in flags:\n+ if flag in __CPU_FLAGS_TO_HP_SIZE:\n+ pinfo.hugepage_sizes_supported.append(__CPU_FLAGS_TO_HP_SIZE[flag])\n+ elif flag in __IOMMU_CPU_FLAGS:\n+ pinfo.iommu_supported = True\n+ elif flag in __HT_CPU_FLAGS:\n+ pinfo.hyperthreading_supported = True\n+\n+ # parse cores and sockets\n+ numa_nodes = set()\n+ core_map = {}\n+ for core_dict in core_info_list:\n+ thread_id = int(core_dict[\"processor\"])\n+ core_id = int(core_dict[\"core id\"])\n+ numa_node = int(core_dict[\"physical id\"])\n+\n+ core_map.setdefault((numa_node, core_id), []).append(thread_id)\n+ numa_nodes.add(numa_node)\n+\n+ # now, populate PlatformInfo with our, well, info - convert to lists\n+ pinfo.numa_nodes = list(numa_nodes)\n+ pinfo.core_map = core_map\n+\n+\n+def _parse_meminfo(pinfo):\n+ meminfo_data = {}\n+ with open(\"/proc/meminfo\") as f:\n+ for line in f:\n+ key, value = kv_split(line, \":\")\n+ meminfo_data[key] = value\n+\n+ # regex used to capture kilobytes\n+ r = re.compile(\"(\\d+) kB\")\n+\n+ # total ram size\n+ m = r.match(meminfo_data[\"MemTotal\"])\n+ if not m:\n+ raise RuntimeError(\"BUG: Bad regular expression\")\n+ pinfo.ram_size = int(m.group(1))\n+\n+ # hugepages may not be supported\n+ if \"Hugepagesize\" in meminfo_data:\n+ m = r.match(meminfo_data[\"Hugepagesize\"])\n+ if not m:\n+ raise RuntimeError(\"BUG: Bad regular expression\")\n+ pinfo.default_hugepage_size = int(m.group(1))\n+\n+\n+def _find_enabled_hugepage_sizes():\n+ paths = glob.glob(__KERNEL_HPSZ_PATH)\n+ r = re.compile(\"hugepages-(\\d+)kB\")\n+ sizes = []\n+ for p in paths:\n+ p = os.path.basename(p)\n+ m = r.search(p)\n+ if not m:\n+ raise RuntimeError(\"BUG: Bad regular expression\")\n+ sizes.append(int(m.group(1)))\n+ return sizes\n+\n+\n+def _iommu_is_enabled():\n+ pass\n+\n+\n+class PlatformInfo:\n+ def __init__(self):\n+ self.update()\n+\n+ def reset(self):\n+ self.numa_nodes = []\n+ self.hyperthreading_supported = False\n+ self.core_map = {} # numa_node, core_id: [thread_id]\n+ self.iommu_supported = False\n+ self.iommu_mode = \"\"\n+ self.bootloader_iommu_mode = \"\"\n+ self.hugepage_sizes_supported = []\n+ self.hugepage_sizes_enabled = []\n+ self.default_hugepage_size = 0\n+ self.ram_size = 0\n+\n+ def update(self):\n+ self.reset()\n+ _parse_cpuinfo(self)\n+ _parse_meminfo(self)\n+ self.hugepage_sizes_enabled = _find_enabled_hugepage_sizes()\ndiff --git a/usertools/DPDKConfigLib/Util.py b/usertools/DPDKConfigLib/Util.py\nnew file mode 100755\nindex 000000000..42434e728\n--- /dev/null\n+++ b/usertools/DPDKConfigLib/Util.py\n@@ -0,0 +1,16 @@\n+#!/usr/bin/python\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2018 Intel Corporation\n+\n+# split line into key-value pair, cleaning up the values in the process\n+def kv_split(line, separator):\n+ # just in case\n+ line = line.strip()\n+\n+ tokens = line.split(separator, 1)\n+ key, value = None, None\n+ if len(tokens) > 0:\n+ key = tokens[0].strip()\n+ if len(tokens) > 1:\n+ value = tokens[1].strip()\n+ return key, value\n", "prefixes": [ "RFC", "2/9" ] }{ "id": 41479, "url": "