get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 67641,
    "url": "http://patches.dpdk.org/api/patches/67641/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/793d4b3c1828fc5a6f4f0f2bfc5f93b7fd95556f.1585818128.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": "<793d4b3c1828fc5a6f4f0f2bfc5f93b7fd95556f.1585818128.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/793d4b3c1828fc5a6f4f0f2bfc5f93b7fd95556f.1585818128.git.anatoly.burakov@intel.com",
    "date": "2020-04-02T09:02:14",
    "name": "[v2,1/2] test/malloc: run realloc tests on external heap",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ad3670336b83807540effb60bdbecdf8b58a5855",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/793d4b3c1828fc5a6f4f0f2bfc5f93b7fd95556f.1585818128.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 9161,
            "url": "http://patches.dpdk.org/api/series/9161/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=9161",
            "date": "2020-04-02T09:02:14",
            "name": "[v2,1/2] test/malloc: run realloc tests on external heap",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/9161/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/67641/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/67641/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 6558DA057B;\n\tThu,  2 Apr 2020 11:07:22 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E78162C15;\n\tThu,  2 Apr 2020 11:07:21 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id 05F912BCE\n for <dev@dpdk.org>; Thu,  2 Apr 2020 11:07:19 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 02 Apr 2020 02:07:18 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n silpixa00399498.ger.corp.intel.com) ([10.237.222.52])\n by FMSMGA003.fm.intel.com with ESMTP; 02 Apr 2020 02:07:17 -0700"
        ],
        "IronPort-SDR": [
            "\n bzVlQuCrcJWAbrbydhPg0EorlAkQ/a9pM5ZSOJYQzKhCx04a+pSLYMrkOsGwEUtGVQcMbB/WkY\n W8aI3C5awzNQ==",
            "\n r+nDXyA729GMRehI2XSDF5tK2lHzfvc6r9vH0Rcj5BxeH/oTQrkRatCcFC2snYOQ3mhaJwP5HS\n R+LbRGyO6jZg=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.72,335,1580803200\"; d=\"scan'208\";a=\"295592497\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "drc@linux.vnet.ibm.com",
        "Date": "Thu,  2 Apr 2020 10:02:14 +0100",
        "Message-Id": "\n <793d4b3c1828fc5a6f4f0f2bfc5f93b7fd95556f.1585818128.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "\n <156a0627fb472087aad43d9279ab0f684a2367ce.1585746650.git.anatoly.burakov@intel.com>",
        "References": "\n <156a0627fb472087aad43d9279ab0f684a2367ce.1585746650.git.anatoly.burakov@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 1/2] test/malloc: run realloc tests on\n\texternal heap",
        "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": "Due to the fact that the rte_realloc() test depends on the layout of\nunderlying memory, it can sometimes fail due to fragmentation of the\nmemory. To address this, make it so that the realloc autotests are run\nusing a newly created external memory heap instead of main memory.\n\nBugzilla ID: 424\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v2:\n    - Fixed 4K page assumption\n\n app/test/test_malloc.c | 118 ++++++++++++++++++++++++++++++++++++-----\n 1 file changed, 104 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c\nindex 67a48ba38a..eed0b20d5a 100644\n--- a/app/test/test_malloc.c\n+++ b/app/test/test_malloc.c\n@@ -8,7 +8,9 @@\n #include <stdarg.h>\n #include <errno.h>\n #include <stdlib.h>\n+#include <sys/mman.h>\n #include <sys/queue.h>\n+#include <unistd.h>\n \n #include <rte_common.h>\n #include <rte_memory.h>\n@@ -372,7 +374,7 @@ test_multi_alloc_statistics(void)\n }\n \n static int\n-test_realloc(void)\n+test_realloc_socket(int socket)\n {\n \tconst char hello_str[] = \"Hello, world!\";\n \tconst unsigned size1 = 1024;\n@@ -381,13 +383,15 @@ test_realloc(void)\n \tconst unsigned size4 = size3 + 1024;\n \n \t/* test data is the same even if element is moved*/\n-\tchar *ptr1 = rte_zmalloc(NULL, size1, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr1 = rte_zmalloc_socket(\n+\t\t\tNULL, size1, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr1){\n \t\tprintf(\"NULL pointer returned from rte_zmalloc\\n\");\n \t\treturn -1;\n \t}\n \tstrlcpy(ptr1, hello_str, size1);\n-\tchar *ptr2 = rte_realloc(ptr1, size2, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr2 = rte_realloc_socket(\n+\t\t\tptr1, size2, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr2){\n \t\trte_free(ptr1);\n \t\tprintf(\"NULL pointer returned from rte_realloc\\n\");\n@@ -411,7 +415,8 @@ test_realloc(void)\n \t/* now allocate third element, free the second\n \t * and resize third. It should not move. (ptr1 is now invalid)\n \t */\n-\tchar *ptr3 = rte_zmalloc(NULL, size3, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr3 = rte_zmalloc_socket(\n+\t\t\tNULL, size3, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr3){\n \t\tprintf(\"NULL pointer returned from rte_zmalloc\\n\");\n \t\trte_free(ptr2);\n@@ -426,7 +431,8 @@ test_realloc(void)\n \t\t}\n \trte_free(ptr2);\n \t/* first resize to half the size of the freed block */\n-\tchar *ptr4 = rte_realloc(ptr3, size4, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr4 = rte_realloc_socket(\n+\t\t\tptr3, size4, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr4){\n \t\tprintf(\"NULL pointer returned from rte_realloc\\n\");\n \t\trte_free(ptr3);\n@@ -438,7 +444,8 @@ test_realloc(void)\n \t\treturn -1;\n \t}\n \t/* now resize again to the full size of the freed block */\n-\tptr4 = rte_realloc(ptr3, size3 + size2 + size1, RTE_CACHE_LINE_SIZE);\n+\tptr4 = rte_realloc_socket(ptr3, size3 + size2 + size1,\n+\t\t\tRTE_CACHE_LINE_SIZE, socket);\n \tif (ptr3 != ptr4){\n \t\tprintf(\"Unexpected - ptr4 != ptr3 on second resize\\n\");\n \t\trte_free(ptr4);\n@@ -449,12 +456,14 @@ test_realloc(void)\n \t/* now try a resize to a smaller size, see if it works */\n \tconst unsigned size5 = 1024;\n \tconst unsigned size6 = size5 / 2;\n-\tchar *ptr5 = rte_malloc(NULL, size5, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr5 = rte_malloc_socket(\n+\t\t\tNULL, size5, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr5){\n \t\tprintf(\"NULL pointer returned from rte_malloc\\n\");\n \t\treturn -1;\n \t}\n-\tchar *ptr6 = rte_realloc(ptr5, size6, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr6 = rte_realloc_socket(\n+\t\t\tptr5, size6, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr6){\n \t\tprintf(\"NULL pointer returned from rte_realloc\\n\");\n \t\trte_free(ptr5);\n@@ -471,7 +480,7 @@ test_realloc(void)\n \tconst unsigned size7 = 1024;\n \tconst unsigned orig_align = RTE_CACHE_LINE_SIZE;\n \tunsigned new_align = RTE_CACHE_LINE_SIZE * 2;\n-\tchar *ptr7 = rte_malloc(NULL, size7, orig_align);\n+\tchar *ptr7 = rte_malloc_socket(NULL, size7, orig_align, socket);\n \tif (!ptr7){\n \t\tprintf(\"NULL pointer returned from rte_malloc\\n\");\n \t\treturn -1;\n@@ -479,7 +488,7 @@ test_realloc(void)\n \t/* calc an alignment we don't already have */\n \twhile(RTE_PTR_ALIGN(ptr7, new_align) == ptr7)\n \t\tnew_align *= 2;\n-\tchar *ptr8 = rte_realloc(ptr7, size7, new_align);\n+\tchar *ptr8 = rte_realloc_socket(ptr7, size7, new_align, socket);\n \tif (!ptr8){\n \t\tprintf(\"NULL pointer returned from rte_realloc\\n\");\n \t\trte_free(ptr7);\n@@ -497,18 +506,21 @@ test_realloc(void)\n \t */\n \tunsigned size9 = 1024, size10 = 1024;\n \tunsigned size11 = size9 + size10 + 256;\n-\tchar *ptr9 = rte_malloc(NULL, size9, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr9 = rte_malloc_socket(\n+\t\t\tNULL, size9, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr9){\n \t\tprintf(\"NULL pointer returned from rte_malloc\\n\");\n \t\treturn -1;\n \t}\n-\tchar *ptr10 = rte_malloc(NULL, size10, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr10 = rte_malloc_socket(\n+\t\t\tNULL, size10, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr10){\n \t\tprintf(\"NULL pointer returned from rte_malloc\\n\");\n \t\treturn -1;\n \t}\n \trte_free(ptr9);\n-\tchar *ptr11 = rte_realloc(ptr10, size11, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr11 = rte_realloc_socket(\n+\t\t\tptr10, size11, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr11){\n \t\tprintf(\"NULL pointer returned from rte_realloc\\n\");\n \t\trte_free(ptr10);\n@@ -525,7 +537,8 @@ test_realloc(void)\n \t * We should get a malloc of the size requested*/\n \tconst size_t size12 = 1024;\n \tsize_t size12_check;\n-\tchar *ptr12 = rte_realloc(NULL, size12, RTE_CACHE_LINE_SIZE);\n+\tchar *ptr12 = rte_realloc_socket(\n+\t\t\tNULL, size12, RTE_CACHE_LINE_SIZE, socket);\n \tif (!ptr12){\n \t\tprintf(\"NULL pointer returned from rte_realloc\\n\");\n \t\treturn -1;\n@@ -537,8 +550,28 @@ test_realloc(void)\n \t}\n \trte_free(ptr12);\n \n+\t/* do the same, but for regular memory */\n+\tptr12 = rte_realloc(NULL, size12, RTE_CACHE_LINE_SIZE);\n+\tif (!ptr12) {\n+\t\tprintf(\"NULL pointer returned from rte_realloc\\n\");\n+\t\treturn -1;\n+\t}\n+\tif (rte_malloc_validate(ptr12, &size12_check) < 0 ||\n+\t\t\tsize12_check != size12) {\n+\t\trte_free(ptr12);\n+\t\treturn -1;\n+\t}\n+\trte_free(ptr12);\n+\n+\treturn 0;\n+}\n+\n+static int\n+test_realloc_numa(void)\n+{\n \t/* check realloc_socket part */\n \tint32_t socket_count = 0, socket_allocated, socket;\n+\tvoid *ptr1, *ptr2;\n \tint ret = -1;\n \tsize_t size = 1024;\n \n@@ -577,7 +610,64 @@ test_realloc(void)\n \tret = 0;\n end:\n \trte_free(ptr1);\n+\treturn ret;\n+}\n \n+static int\n+test_realloc(void)\n+{\n+\tconst char *heap_name = \"realloc_heap\";\n+\tint realloc_heap_socket;\n+\tunsigned int mem_sz = 1U << 13; /* 8K */\n+\tunsigned int page_sz = sysconf(_SC_PAGESIZE);\n+\tvoid *mem;\n+\tint ret;\n+\n+\t/* page size may be bigger than total mem size, so adjust */\n+\tmem_sz = RTE_MAX(mem_sz, page_sz);\n+\n+\t/*\n+\t * the realloc tests depend on specific layout of underlying memory, so\n+\t * to prevent accidental failures to do fragmented main heap, we will\n+\t * do all of our tests on an artificially created memory.\n+\t */\n+\tif (rte_malloc_heap_create(heap_name) != 0) {\n+\t\tprintf(\"Failed to create external heap\\n\");\n+\t\tret = -1;\n+\t\tgoto end;\n+\t}\n+\trealloc_heap_socket = rte_malloc_heap_get_socket(heap_name);\n+\n+\tmem = mmap(NULL, mem_sz, PROT_READ | PROT_WRITE,\n+\t\t\tMAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n+\tif (mem == MAP_FAILED) {\n+\t\tprintf(\"Failed to allocate memory for external heap\\n\");\n+\t\tret = -1;\n+\t\tgoto heap_destroy;\n+\t}\n+\n+\tif (rte_malloc_heap_memory_add(\n+\t\t\theap_name, mem, mem_sz, NULL, 0, page_sz) != 0) {\n+\t\tprintf(\"Failed to add memory to external heap\\n\");\n+\t\tret = -1;\n+\t\tgoto mem_free;\n+\t}\n+\n+\t/* run the socket-bound tests */\n+\tret = test_realloc_socket(realloc_heap_socket);\n+\tif (ret != 0)\n+\t\tgoto mem_remove;\n+\n+\t/* now, run the NUMA node tests */\n+\tret = test_realloc_numa();\n+\n+mem_remove:\n+\trte_malloc_heap_memory_remove(heap_name, mem, mem_sz);\n+mem_free:\n+\tmunmap(mem, mem_sz);\n+heap_destroy:\n+\trte_malloc_heap_destroy(heap_name);\n+end:\n \treturn ret;\n }\n \n",
    "prefixes": [
        "v2",
        "1/2"
    ]
}