get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 7648,
    "url": "https://patches.dpdk.org/api/patches/7648/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1444911367-23738-1-git-send-email-nissimn@radware.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": "<1444911367-23738-1-git-send-email-nissimn@radware.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1444911367-23738-1-git-send-email-nissimn@radware.com",
    "date": "2015-10-15T12:16:07",
    "name": "[dpdk-dev] eal:Map rte cfg and uio at the end of hugepage mem",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3babebc8e9e8ee5490ac7b04b0f8ef24217014da",
    "submitter": {
        "id": 209,
        "url": "https://patches.dpdk.org/api/people/209/?format=api",
        "name": "Nissim Nisimov",
        "email": "NissimN@Radware.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1444911367-23738-1-git-send-email-nissimn@radware.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/7648/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/7648/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 1DC4291B0;\n\tThu, 15 Oct 2015 14:16:28 +0200 (CEST)",
            "from mailout1.radware.com (mailout1.radware.com [192.115.180.130])\n\tby dpdk.org (Postfix) with ESMTP id 856FD91AD\n\tfor <dev@dpdk.org>; Thu, 15 Oct 2015 14:16:26 +0200 (CEST)",
            "from mailsrvdev.il.corp.radware.com (176.200.121.207) by\n\tILCAS2.corp.radware.com (176.200.120.122) with Microsoft SMTP Server\n\tid 14.3.210.2; Thu, 15 Oct 2015 15:16:24 +0300",
            "from RDE000c295c31fd-1.3 (unknown [10.172.2.30])\tby\n\tmailsrvdev.il.corp.radware.com (Postfix) with ESMTP id BB4987FA2E;\n\tThu, 15 Oct 2015 15:16:24 +0300 (IDT)",
            "by RDE000c295c31fd-1.3 (Postfix, from userid 1694)\tid AEAD9522D14; \n\tThu, 15 Oct 2015 15:16:24 +0300 (IDT)"
        ],
        "From": "Nissim Nisimov <nissimn@radware.com>",
        "To": "<dev@dpdk.org>",
        "Date": "Thu, 15 Oct 2015 15:16:07 +0300",
        "Message-ID": "<1444911367-23738-1-git-send-email-nissimn@radware.com>",
        "X-Mailer": "git-send-email 2.6.1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "Subject": "[dpdk-dev] [PATCH] eal:Map rte cfg and uio at the end of hugepage\n\tmem",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://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": "<http://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": "Problem:\nIn DPDK Primary/Secondary module we assume mapping same regions of virtual memory addresses for Primary process and Secondary.\nAn issue may occur when the Primary and secondary processes are not symmetric in such way that the code is not the same (for example, Primary process is a traffic distributer and secondary is a worker). The result may be that specific virtual address region in the first process won't be available in the second process.\n\nChanges done at eal init:\nmap all related rte configuration and uio sections close to the end of huge pages memory (that mean rte_eal_memory_init() should be called before rte_config_init() in primary process)\nAccording to our observations there will be more probability to success when allocating rte_config and uio memzones after huge pages sections (actually uio is already allocated after the huge pages area)\n\nSigned-off-by: Nissim Nisimov <nissimn@radware.com>\n---\n lib/librte_eal/linuxapp/eal/eal.c         | 28 ++++++++++++++++++++++------\n lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 10 +++++++---\n 2 files changed, 29 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 33e1067..3cb354b 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -87,6 +87,7 @@\n \n #define SOCKET_MEM_STRLEN (RTE_MAX_NUMA_NODES * 10)\n \n+void *pci_find_max_end_va(void);\n /* Allow the application to print its usage message too if set */\n static rte_usage_hook_t\trte_application_usage_hook = NULL;\n \n@@ -189,12 +190,15 @@ rte_eal_config_create(void)\n \t\treturn;\n \n \t/* map the config before hugepage address so that we don't waste a page */\n-\tif (internal_config.base_virtaddr != 0)\n+\tif (internal_config.base_virtaddr != 0){\n \t\trte_mem_cfg_addr = (void *)\n \t\t\tRTE_ALIGN_FLOOR(internal_config.base_virtaddr -\n \t\t\tsizeof(struct rte_mem_config), sysconf(_SC_PAGE_SIZE));\n-\telse\n-\t\trte_mem_cfg_addr = NULL;\n+        }\n+\telse{\n+\t\trte_mem_cfg_addr = pci_find_max_end_va();\n+                RTE_LOG(INFO, EAL, \"rte_mem_cfg_addr =  0x%llx PType=%s\\n\",(unsigned long long)rte_mem_cfg_addr,rte_config.process_type == RTE_PROC_PRIMARY ? \"PRIMARY\" : \"SECONDARY\");\n+        }\n \n \tif (mem_cfg_fd < 0){\n \t\tmem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0660);\n@@ -227,7 +231,7 @@ rte_eal_config_create(void)\n \t/* store address of the config in the config itself so that secondary\n \t * processes could later map the config into this exact location */\n \trte_config.mem_config->mem_cfg_addr = (uintptr_t) rte_mem_cfg_addr;\n-\n+        \n }\n \n /* attach to an existing shared memory config */\n@@ -784,6 +788,13 @@ rte_eal_init(int argc, char **argv)\n \n \trte_srand(rte_rdtsc());\n \n+        /* Primary process should allocate hugepages before configuration */\n+\tif(internal_config.process_type == RTE_PROC_PRIMARY){\n+\t\tRTE_LOG(INFO, EAL, \"Calling rte_eal_memory_init as =%s\\n\",(rte_config.process_type == RTE_PROC_PRIMARY) ? \"PRIMARY\" : \"SECONDARY\");\n+\t\tif (rte_eal_memory_init() < 0)\n+\t\t\trte_panic(\"Cannot init memory\\n\");\n+\t}\n+\n \trte_config_init();\n \n \tif (rte_eal_pci_init() < 0)\n@@ -793,8 +804,13 @@ rte_eal_init(int argc, char **argv)\n \tif (rte_eal_ivshmem_init() < 0)\n \t\trte_panic(\"Cannot init IVSHMEM\\n\");\n #endif\n-\n-\tif (rte_eal_memory_init() < 0)\n+        /* secondary process will call memory init only after calling to rte_config_init() */\n+\tif(internal_config.process_type == RTE_PROC_SECONDARY){\n+\t\tRTE_LOG(INFO, EAL, \"Calling rte_eal_memory_init as =%s\\n\",rte_config.process_type == RTE_PROC_PRIMARY ? \"PRIMARY\" : \"SECONDARY\");\n+\t\tif (rte_eal_memory_init() < 0)\n+\t\t\trte_panic(\"Cannot init memory\\n\");\n+\t}\n+        if (rte_eal_memory_init() < 0)\n \t\trte_panic(\"Cannot init memory\\n\");\n \n \t/* the directories are locked during eal_hugepage_info_init */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\nindex ac50e13..6812c37 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c\n@@ -338,9 +338,13 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n \t}\n \n \t/* try mapping somewhere close to the end of hugepages */\n-\tif (pci_map_addr == NULL)\n-\t\tpci_map_addr = pci_find_max_end_va();\n-\n+\tif (pci_map_addr == NULL){\n+\t\tif (internal_config.base_virtaddr != 0){\n+                \tpci_map_addr = pci_find_max_end_va();\n+                } else{\n+                \tpci_map_addr = (void*)RTE_PTR_ALIGN(((char*)rte_eal_get_configuration()->mem_config->mem_cfg_addr + sizeof(struct rte_mem_config)),sysconf(_SC_PAGE_SIZE));\n+                }\n+        }\n \tmapaddr = pci_map_resource(pci_map_addr, fd, 0,\n \t\t\t(size_t)dev->mem_resource[res_idx].len, 0);\n \tclose(fd);\n",
    "prefixes": [
        "dpdk-dev"
    ]
}