Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/37698/?format=api
https://patches.dpdk.org/api/patches/37698/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/03e3eadf32e76f924433665400e3f5617e8027f7.1523296700.git.anatoly.burakov@intel.com/", "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": "<03e3eadf32e76f924433665400e3f5617e8027f7.1523296700.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/03e3eadf32e76f924433665400e3f5617e8027f7.1523296700.git.anatoly.burakov@intel.com", "date": "2018-04-09T18:00:34", "name": "[dpdk-dev,v5,31/70] test: use memseg walk instead of iteration", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "0ab2cf59af700fac26a554cfcb159fbe98a7fa51", "submitter": { "id": 4, "url": "https://patches.dpdk.org/api/people/4/?format=api", "name": "Burakov, Anatoly", "email": "anatoly.burakov@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/03e3eadf32e76f924433665400e3f5617e8027f7.1523296700.git.anatoly.burakov@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/37698/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/37698/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 428FD1B991;\n\tMon, 9 Apr 2018 20:02:45 +0200 (CEST)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 8AA3C1B840\n\tfor <dev@dpdk.org>; Mon, 9 Apr 2018 20:01:35 +0200 (CEST)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t09 Apr 2018 11:01:34 -0700", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga004.fm.intel.com with ESMTP; 09 Apr 2018 11:01:31 -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\tw39I1Ucm031125; Mon, 9 Apr 2018 19:01:30 +0100", "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w39I1U0k027906;\n\tMon, 9 Apr 2018 19:01:30 +0100", "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w39I1UjJ027902;\n\tMon, 9 Apr 2018 19:01:30 +0100" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.48,427,1517904000\"; d=\"scan'208\";a=\"44756679\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "keith.wiles@intel.com, jianfeng.tan@intel.com, andras.kovacs@ericsson.com,\n\tlaszlo.vadkeri@ericsson.com, benjamin.walker@intel.com,\n\tbruce.richardson@intel.com, thomas@monjalon.net,\n\tkonstantin.ananyev@intel.com, kuralamudhan.ramakrishnan@intel.com,\n\tlouise.m.daly@intel.com, nelio.laranjeiro@6wind.com,\n\tyskoh@mellanox.com, pepperjo@japf.ch, jerin.jacob@caviumnetworks.com, \n\themant.agrawal@nxp.com, olivier.matz@6wind.com, shreyansh.jain@nxp.com,\n\tgowrishankar.m@linux.vnet.ibm.com", "Date": "Mon, 9 Apr 2018 19:00:34 +0100", "Message-Id": "<03e3eadf32e76f924433665400e3f5617e8027f7.1523296700.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<cover.1523296700.git.anatoly.burakov@intel.com>", "<cover.1523296700.git.anatoly.burakov@intel.com>" ], "References": [ "<cover.1523296700.git.anatoly.burakov@intel.com>", "<cover.1523218215.git.anatoly.burakov@intel.com>\n\t<cover.1523296700.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH v5 31/70] test: use memseg walk instead of\n\titeration", "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Reduce dependency on internal details of EAL memory subsystem, and\nsimplify code.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\nTested-by: Santosh Shukla <Santosh.Shukla@caviumnetworks.com>\nTested-by: Hemant Agrawal <hemant.agrawal@nxp.com>\n---\n test/test/test_malloc.c | 40 +++++++++++++++++++++++-------------\n test/test/test_memory.c | 23 +++++++++++----------\n test/test/test_memzone.c | 53 ++++++++++++++++++++++++++++++++----------------\n 3 files changed, 74 insertions(+), 42 deletions(-)", "diff": "diff --git a/test/test/test_malloc.c b/test/test/test_malloc.c\nindex ccc5fea..28c241f 100644\n--- a/test/test/test_malloc.c\n+++ b/test/test/test_malloc.c\n@@ -705,16 +705,34 @@ test_malloc_bad_params(void)\n \treturn -1;\n }\n \n+static int\n+check_socket_mem(const struct rte_memseg *ms, void *arg)\n+{\n+\tint32_t *socket = arg;\n+\n+\treturn *socket == ms->socket_id;\n+}\n+\n /* Check if memory is available on a specific socket */\n static int\n is_mem_on_socket(int32_t socket)\n {\n-\tconst struct rte_memseg *ms = rte_eal_get_physmem_layout();\n-\tunsigned i;\n+\treturn rte_memseg_walk(check_socket_mem, &socket);\n+}\n \n-\tfor (i = 0; i < RTE_MAX_MEMSEG; i++) {\n-\t\tif (socket == ms[i].socket_id)\n-\t\t\treturn 1;\n+struct walk_param {\n+\tvoid *addr;\n+\tint32_t socket;\n+};\n+static int\n+find_socket(const struct rte_memseg *ms, void *arg)\n+{\n+\tstruct walk_param *param = arg;\n+\n+\tif (param->addr >= ms->addr &&\n+\t\t\tparam->addr < RTE_PTR_ADD(ms->addr, ms->len)) {\n+\t\tparam->socket = ms->socket_id;\n+\t\treturn 1;\n \t}\n \treturn 0;\n }\n@@ -726,15 +744,9 @@ is_mem_on_socket(int32_t socket)\n static int32_t\n addr_to_socket(void * addr)\n {\n-\tconst struct rte_memseg *ms = rte_eal_get_physmem_layout();\n-\tunsigned i;\n-\n-\tfor (i = 0; i < RTE_MAX_MEMSEG; i++) {\n-\t\tif ((ms[i].addr <= addr) &&\n-\t\t\t\t((uintptr_t)addr <\n-\t\t\t\t((uintptr_t)ms[i].addr + (uintptr_t)ms[i].len)))\n-\t\t\treturn ms[i].socket_id;\n-\t}\n+\tstruct walk_param param = {.addr = addr, .socket = 0};\n+\tif (rte_memseg_walk(find_socket, ¶m) > 0)\n+\t\treturn param.socket;\n \treturn -1;\n }\n \ndiff --git a/test/test/test_memory.c b/test/test/test_memory.c\nindex 972321f..c9b287c 100644\n--- a/test/test/test_memory.c\n+++ b/test/test/test_memory.c\n@@ -23,12 +23,20 @@\n */\n \n static int\n+check_mem(const struct rte_memseg *ms, void *arg __rte_unused)\n+{\n+\tvolatile uint8_t *mem = (volatile uint8_t *) ms->addr;\n+\tsize_t i;\n+\n+\tfor (i = 0; i < ms->len; i++, mem++)\n+\t\t*mem;\n+\treturn 0;\n+}\n+\n+static int\n test_memory(void)\n {\n \tuint64_t s;\n-\tunsigned i;\n-\tsize_t j;\n-\tconst struct rte_memseg *mem;\n \n \t/*\n \t * dump the mapped memory: the python-expect script checks\n@@ -45,14 +53,7 @@ test_memory(void)\n \t}\n \n \t/* try to read memory (should not segfault) */\n-\tmem = rte_eal_get_physmem_layout();\n-\tfor (i = 0; i < RTE_MAX_MEMSEG && mem[i].addr != NULL ; i++) {\n-\n-\t\t/* check memory */\n-\t\tfor (j = 0; j<mem[i].len; j++) {\n-\t\t\t*((volatile uint8_t *) mem[i].addr + j);\n-\t\t}\n-\t}\n+\trte_memseg_walk(check_mem, NULL);\n \n \treturn 0;\n }\ndiff --git a/test/test/test_memzone.c b/test/test/test_memzone.c\nindex 8ece1ac..cbf0cfa 100644\n--- a/test/test/test_memzone.c\n+++ b/test/test/test_memzone.c\n@@ -104,28 +104,47 @@ test_memzone_reserving_zone_size_bigger_than_the_maximum(void)\n \treturn 0;\n }\n \n+struct walk_arg {\n+\tint hugepage_2MB_avail;\n+\tint hugepage_1GB_avail;\n+\tint hugepage_16MB_avail;\n+\tint hugepage_16GB_avail;\n+};\n+static int\n+find_available_pagesz(const struct rte_memseg *ms, void *arg)\n+{\n+\tstruct walk_arg *wa = arg;\n+\n+\tif (ms->hugepage_sz == RTE_PGSIZE_2M)\n+\t\twa->hugepage_2MB_avail = 1;\n+\tif (ms->hugepage_sz == RTE_PGSIZE_1G)\n+\t\twa->hugepage_1GB_avail = 1;\n+\tif (ms->hugepage_sz == RTE_PGSIZE_16M)\n+\t\twa->hugepage_16MB_avail = 1;\n+\tif (ms->hugepage_sz == RTE_PGSIZE_16G)\n+\t\twa->hugepage_16GB_avail = 1;\n+\n+\treturn 0;\n+}\n+\n static int\n test_memzone_reserve_flags(void)\n {\n \tconst struct rte_memzone *mz;\n-\tconst struct rte_memseg *ms;\n-\tint hugepage_2MB_avail = 0;\n-\tint hugepage_1GB_avail = 0;\n-\tint hugepage_16MB_avail = 0;\n-\tint hugepage_16GB_avail = 0;\n+\tstruct walk_arg wa;\n+\tint hugepage_2MB_avail, hugepage_1GB_avail;\n+\tint hugepage_16MB_avail, hugepage_16GB_avail;\n \tconst size_t size = 100;\n-\tint i = 0;\n-\tms = rte_eal_get_physmem_layout();\n-\tfor (i = 0; i < RTE_MAX_MEMSEG; i++) {\n-\t\tif (ms[i].hugepage_sz == RTE_PGSIZE_2M)\n-\t\t\thugepage_2MB_avail = 1;\n-\t\tif (ms[i].hugepage_sz == RTE_PGSIZE_1G)\n-\t\t\thugepage_1GB_avail = 1;\n-\t\tif (ms[i].hugepage_sz == RTE_PGSIZE_16M)\n-\t\t\thugepage_16MB_avail = 1;\n-\t\tif (ms[i].hugepage_sz == RTE_PGSIZE_16G)\n-\t\t\thugepage_16GB_avail = 1;\n-\t}\n+\n+\tmemset(&wa, 0, sizeof(wa));\n+\n+\trte_memseg_walk(find_available_pagesz, &wa);\n+\n+\thugepage_2MB_avail = wa.hugepage_2MB_avail;\n+\thugepage_1GB_avail = wa.hugepage_1GB_avail;\n+\thugepage_16MB_avail = wa.hugepage_16MB_avail;\n+\thugepage_16GB_avail = wa.hugepage_16GB_avail;\n+\n \t/* Display the availability of 2MB ,1GB, 16MB, 16GB pages */\n \tif (hugepage_2MB_avail)\n \t\tprintf(\"2MB Huge pages available\\n\");\n", "prefixes": [ "dpdk-dev", "v5", "31/70" ] }{ "id": 37698, "url": "