Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/49230/?format=api
http://patches.dpdk.org/api/patches/49230/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/740fcadac150c128f62cc2761dfe00fd10c90990.1545390524.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": "<740fcadac150c128f62cc2761dfe00fd10c90990.1545390524.git.anatoly.burakov@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/740fcadac150c128f62cc2761dfe00fd10c90990.1545390524.git.anatoly.burakov@intel.com", "date": "2018-12-21T11:09:15", "name": "[4/4] test/extmem: extend test to cover non-heap API", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "2665e7267a113dfe9d6ea8b05a2bdaa9c731b26f", "submitter": { "id": 4, "url": "http://patches.dpdk.org/api/people/4/?format=api", "name": "Anatoly Burakov", "email": "anatoly.burakov@intel.com" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/740fcadac150c128f62cc2761dfe00fd10c90990.1545390524.git.anatoly.burakov@intel.com/mbox/", "series": [ { "id": 2918, "url": "http://patches.dpdk.org/api/series/2918/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2918", "date": "2018-12-21T11:09:12", "name": "[1/4] test/extmem: refactor and rename test functions", "version": 1, "mbox": "http://patches.dpdk.org/series/2918/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/49230/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/49230/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 3845E1BDB5;\n\tFri, 21 Dec 2018 12:09:30 +0100 (CET)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id ECCA01BD41\n\tfor <dev@dpdk.org>; Fri, 21 Dec 2018 12:09:22 +0100 (CET)", "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t21 Dec 2018 03:09:22 -0800", "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby orsmga007.jf.intel.com with ESMTP; 21 Dec 2018 03:09:21 -0800", "from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com\n\t[10.243.17.64])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\twBLB9Kmu019017; Fri, 21 Dec 2018 11:09:20 GMT", "from sivswdev05.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev05.ir.intel.com with ESMTP id wBLB9K4w028354;\n\tFri, 21 Dec 2018 11:09:20 GMT", "(from aburakov@localhost)\n\tby sivswdev05.ir.intel.com with LOCAL id wBLB9K8N028350;\n\tFri, 21 Dec 2018 11:09:20 GMT" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.56,381,1539673200\"; d=\"scan'208\";a=\"100475690\"", "From": "Anatoly Burakov <anatoly.burakov@intel.com>", "To": "dev@dpdk.org", "Cc": "thomas@monjalon.net, stephen@networkplumber.org", "Date": "Fri, 21 Dec 2018 11:09:15 +0000", "Message-Id": "<740fcadac150c128f62cc2761dfe00fd10c90990.1545390524.git.anatoly.burakov@intel.com>", "X-Mailer": "git-send-email 1.7.0.7", "In-Reply-To": [ "<c822e5e21620d0fa4b2930d9e89bce44e80eac73.1545390524.git.anatoly.burakov@intel.com>", "<c822e5e21620d0fa4b2930d9e89bce44e80eac73.1545390524.git.anatoly.burakov@intel.com>" ], "References": [ "<c822e5e21620d0fa4b2930d9e89bce44e80eac73.1545390524.git.anatoly.burakov@intel.com>", "<c822e5e21620d0fa4b2930d9e89bce44e80eac73.1545390524.git.anatoly.burakov@intel.com>" ], "Subject": "[dpdk-dev] [PATCH 4/4] test/extmem: extend test to cover non-heap\n\tAPI", "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": "Currently, extmem autotest only covers the external malloc heap\nAPI. Extend it to also cover the non-heap, register/unregister\nexternal memory API.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n test/test/test_external_mem.c | 146 ++++++++++++++++++++++++++++++++++\n 1 file changed, 146 insertions(+)", "diff": "diff --git a/test/test/test_external_mem.c b/test/test/test_external_mem.c\nindex 5557f6e3f..e1abce104 100644\n--- a/test/test/test_external_mem.c\n+++ b/test/test/test_external_mem.c\n@@ -393,6 +393,144 @@ test_malloc_basic(void *addr, size_t len, size_t pgsz, rte_iova_t *iova,\n \treturn -1;\n }\n \n+static int\n+test_extmem_invalid_param(void *addr, size_t len, size_t pgsz, rte_iova_t *iova,\n+\t\tint n_pages)\n+{\n+\t/* these calls may fail for other reasons, so check errno */\n+\tif (rte_extmem_unregister(addr, len) >= 0 ||\n+\t\t\trte_errno != ENOENT) {\n+\t\tprintf(\"%s():%i: Unregistered non-existent memory\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_extmem_attach(addr, len) >= 0 ||\n+\t\t\trte_errno != ENOENT) {\n+\t\tprintf(\"%s():%i: Attached to non-existent memory\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\tif (rte_extmem_attach(addr, len) >= 0 ||\n+\t\t\trte_errno != ENOENT) {\n+\t\tprintf(\"%s():%i: Detached from non-existent memory\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\t/* zero length */\n+\tif (rte_extmem_register(addr, 0, NULL, 0, pgsz) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Registered memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_extmem_unregister(addr, 0) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Unregistered memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_extmem_attach(addr, 0) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Attached memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\tif (rte_extmem_attach(addr, 0) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Detached memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\t/* zero address */\n+\tif (rte_extmem_register(NULL, len, NULL, 0, pgsz) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Registered memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_extmem_unregister(NULL, len) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Unregistered memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\tif (rte_extmem_attach(NULL, len) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Attached memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\tif (rte_extmem_attach(NULL, len) >= 0 ||\n+\t\t\trte_errno != EINVAL) {\n+\t\tprintf(\"%s():%i: Detached memory with invalid parameters\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\treturn -1;\n+\t}\n+\n+\t/* the following tests are only valid if IOVA table is not NULL */\n+\tif (iova != NULL) {\n+\t\t/* wrong page count */\n+\t\tif (rte_extmem_register(addr, len,\n+\t\t\t\tiova, 0, pgsz) >= 0 || rte_errno != EINVAL) {\n+\t\t\tprintf(\"%s():%i: Registered memory with invalid parameters\\n\",\n+\t\t\t\t__func__, __LINE__);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (rte_extmem_register(addr, len,\n+\t\t\t\tiova, n_pages - 1, pgsz) >= 0 ||\n+\t\t\t\trte_errno != EINVAL) {\n+\t\t\tprintf(\"%s():%i: Registered memory with invalid parameters\\n\",\n+\t\t\t\t__func__, __LINE__);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (rte_extmem_register(addr, len,\n+\t\t\t\tiova, n_pages + 1, pgsz) >= 0 ||\n+\t\t\t\trte_errno != EINVAL) {\n+\t\t\tprintf(\"%s():%i: Registered memory with invalid parameters\\n\",\n+\t\t\t\t__func__, __LINE__);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_extmem_basic(void *addr, size_t len, size_t pgsz, rte_iova_t *iova,\n+\t\tint n_pages)\n+{\n+\t/* register memory */\n+\tif (rte_extmem_register(addr, len, iova, n_pages, pgsz) != 0) {\n+\t\tprintf(\"%s():%i: Failed to register memory\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\tgoto fail;\n+\t}\n+\n+\t/* check if memory is accessible from EAL */\n+\tif (check_mem(addr, iova, pgsz, n_pages) < 0)\n+\t\tgoto fail;\n+\n+\tif (rte_extmem_unregister(addr, len) != 0) {\n+\t\tprintf(\"%s():%i: Removing memory from heap failed\\n\",\n+\t\t\t__func__, __LINE__);\n+\t\tgoto fail;\n+\t}\n+\n+\treturn 0;\n+fail:\n+\t/* even if something failed, attempt to clean up */\n+\trte_extmem_unregister(addr, len);\n+\n+\treturn -1;\n+}\n+\n /* we need to test attach/detach in secondary processes. */\n static int\n test_external_mem(void)\n@@ -419,12 +557,20 @@ test_external_mem(void)\n \t\tiova[i] = tmp;\n \t}\n \n+\t/* test external heap memory */\n \tret = test_malloc_invalid_param(addr, len, pgsz, iova, n_pages);\n \tret |= test_malloc_basic(addr, len, pgsz, iova, n_pages);\n \t/* when iova table is NULL, everything should still work */\n \tret |= test_malloc_invalid_param(addr, len, pgsz, NULL, n_pages);\n \tret |= test_malloc_basic(addr, len, pgsz, NULL, n_pages);\n \n+\t/* test non-heap memory */\n+\tret |= test_extmem_invalid_param(addr, len, pgsz, iova, n_pages);\n+\tret |= test_extmem_basic(addr, len, pgsz, iova, n_pages);\n+\t/* when iova table is NULL, everything should still work */\n+\tret |= test_extmem_invalid_param(addr, len, pgsz, NULL, n_pages);\n+\tret |= test_extmem_basic(addr, len, pgsz, NULL, n_pages);\n+\n \tmunmap(addr, len);\n \n \treturn ret;\n", "prefixes": [ "4/4" ] }{ "id": 49230, "url": "