get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 34666,
    "url": "https://patches.dpdk.org/api/patches/34666/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1517243852-34142-2-git-send-email-harry.van.haaren@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": "<1517243852-34142-2-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1517243852-34142-2-git-send-email-harry.van.haaren@intel.com",
    "date": "2018-01-29T16:37:30",
    "name": "[dpdk-dev,v5,2/4] eal: add function to release internal resources",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "da1da3a5bfa53fa7e624b78f675f7d5e1d23e297",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1517243852-34142-2-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/34666/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/34666/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 95D621B985;\n\tMon, 29 Jan 2018 17:37:43 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 2A9361B6A0\n\tfor <dev@dpdk.org>; Mon, 29 Jan 2018 17:37:37 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t29 Jan 2018 08:37:37 -0800",
            "from silpixa00398672.ir.intel.com ([10.237.223.111])\n\tby fmsmga002.fm.intel.com with ESMTP; 29 Jan 2018 08:37:36 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.46,431,1511856000\"; d=\"scan'208\";a=\"15245388\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Harry van Haaren <harry.van.haaren@intel.com>, thomas@monjalon.net,\n\tvipin.varghese@intel.com",
        "Date": "Mon, 29 Jan 2018 16:37:30 +0000",
        "Message-Id": "<1517243852-34142-2-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1517243852-34142-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1517241642-161397-1-git-send-email-harry.van.haaren@intel.com>\n\t<1517243852-34142-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 2/4] eal: add function to release internal\n\tresources",
        "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": "This commit adds a new function rte_eal_cleanup().\nThe function serves as a hook to allow DPDK to release\ninternal resources (e.g.: hugepage allocations).\n\nThis function allows DPDK to become more like an ordinary\nlibrary, where the library context itself can be initialized\nand cleaned up by the application.\n\nThe rte_exit() and rte_panic() functions must be considered,\nparticularly if they should call rte_eal_cleanup() to release any\nresources or not. This patch adds the cleanup to rte_exit(),\nbut does not clean up on rte_panic(). The reason to not clean\nup on panicing is that the developer may wish to inspect the\nexact internal state of EAL and hugepages.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\nAcked-by: Vipin Varghese <vipin.varghese@intel.com>\n\n---\n\nv5:\n- Split cleanup() implementation to linux/bsd (Bruce)\n  This removes the new file - which is nice :)\n\nv4:\n- Include Ack\n- Fix map file order introduced in v3 rename\n\nv3:\n- Rename function to cleanup (Thomas)\n\nv2:\n- Add eal_common.c file commit (Vipin)\n\nCc: thomas@monjalon.net\nCc: vipin.varghese@intel.com\n---\n doc/guides/prog_guide/env_abstraction_layer.rst |  8 ++++++++\n doc/guides/rel_notes/release_18_02.rst          |  9 +++++++++\n lib/librte_eal/bsdapp/eal/eal.c                 |  6 ++++++\n lib/librte_eal/bsdapp/eal/eal_debug.c           |  5 +++++\n lib/librte_eal/common/include/rte_eal.h         | 16 ++++++++++++++++\n lib/librte_eal/linuxapp/eal/eal.c               |  6 ++++++\n lib/librte_eal/linuxapp/eal/eal_debug.c         |  5 +++++\n lib/librte_eal/rte_eal_version.map              |  1 +\n 8 files changed, 56 insertions(+)",
    "diff": "diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst\nindex 34d871c..04bd776 100644\n--- a/doc/guides/prog_guide/env_abstraction_layer.rst\n+++ b/doc/guides/prog_guide/env_abstraction_layer.rst\n@@ -99,6 +99,14 @@ It consist of calls to the pthread library (more specifically, pthread_self(), p\n     The creation and initialization functions for these objects are not multi-thread safe.\n     However, once initialized, the objects themselves can safely be used in multiple threads simultaneously.\n \n+Shutdown and Cleanup\n+~~~~~~~~~~~~~~~~~~~~\n+\n+During the initialization of EAL resources such as hugepage backed memory can be\n+allocated by core components.  The memory allocated during ``rte_eal_init()``\n+can be released by calling the ``rte_eal_cleanup()`` function. Refer to the\n+API documentation for details.\n+\n Multi-process Support\n ~~~~~~~~~~~~~~~~~~~~~\n \ndiff --git a/doc/guides/rel_notes/release_18_02.rst b/doc/guides/rel_notes/release_18_02.rst\nindex 00b3224..8c3968e 100644\n--- a/doc/guides/rel_notes/release_18_02.rst\n+++ b/doc/guides/rel_notes/release_18_02.rst\n@@ -41,6 +41,15 @@ New Features\n      Also, make sure to start the actual text at the margin.\n      =========================================================\n \n+* **Add function to allow releasing internal EAL resources on exit**\n+\n+  During ``rte_eal_init()`` EAL allocates memory from hugepages to enable its\n+  core libraries to perform their tasks. The ``rte_eal_cleanup()`` function\n+  releases these resources, ensuring that no hugepage memory is leaked. It is\n+  expected that all DPDK applications call ``rte_eal_cleanup()`` before\n+  exiting. Not calling this function could result in leaking hugepages, leading\n+  to failure during initialization of secondary processes.\n+\n * **Added the ixgbe ethernet driver to support RSS with flow API.**\n \n   Rte_flow actually defined to include RSS, but till now, RSS is out of\ndiff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c\nindex 04cbd81..d02233a 100644\n--- a/lib/librte_eal/bsdapp/eal/eal.c\n+++ b/lib/librte_eal/bsdapp/eal/eal.c\n@@ -709,6 +709,12 @@ rte_eal_init(int argc, char **argv)\n \treturn fctret;\n }\n \n+int rte_eal_cleanup(void)\n+{\n+\trte_service_finalize();\n+\treturn 0;\n+}\n+\n /* get core role */\n enum rte_lcore_role_t\n rte_eal_lcore_role(unsigned lcore_id)\ndiff --git a/lib/librte_eal/bsdapp/eal/eal_debug.c b/lib/librte_eal/bsdapp/eal/eal_debug.c\nindex b0ae2b7..f66e504 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_debug.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_debug.c\n@@ -14,6 +14,7 @@\n #include <rte_log.h>\n #include <rte_debug.h>\n #include <rte_common.h>\n+#include <rte_eal.h>\n \n #define BACKTRACE_SIZE 256\n \n@@ -79,6 +80,10 @@ rte_exit(int exit_code, const char *format, ...)\n \tva_end(ap);\n \n #ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR\n+\tint ret = rte_eal_cleanup();\n+\tif (ret)\n+\t\tRTE_LOG(CRIT, EAL,\n+\t\t\t\"EAL could not release all resources, code %d\\n\", ret);\n \texit(exit_code);\n #else\n \trte_dump_stack();\ndiff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h\nindex 2aba2c8..8b36fea 100644\n--- a/lib/librte_eal/common/include/rte_eal.h\n+++ b/lib/librte_eal/common/include/rte_eal.h\n@@ -170,6 +170,22 @@ int rte_eal_iopl_init(void);\n int rte_eal_init(int argc, char **argv);\n \n /**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Clean up the Environment Abstraction Layer (EAL)\n+ *\n+ * This function must be called to release any internal resources that EAL has\n+ * allocated during rte_eal_init(). After this call, no DPDK function calls may\n+ * be made. It is expected that common usage of this function is to call it\n+ * just before terminating the process.\n+ *\n+ * @return 0 Successfully released all internal EAL resources\n+ * @return -EFAULT There was an error in releasing all resources.\n+ */\n+int rte_eal_cleanup(void);\n+\n+/**\n  * Check if a primary process is currently alive\n  *\n  * This function returns true when a primary process is currently\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 229eec9..4d5e96d 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\n@@ -974,6 +974,12 @@ rte_eal_init(int argc, char **argv)\n \treturn fctret;\n }\n \n+int rte_eal_cleanup(void)\n+{\n+\trte_service_finalize();\n+\treturn 0;\n+}\n+\n /* get core role */\n enum rte_lcore_role_t\n rte_eal_lcore_role(unsigned lcore_id)\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_debug.c b/lib/librte_eal/linuxapp/eal/eal_debug.c\nindex b0ae2b7..f66e504 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_debug.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_debug.c\n@@ -14,6 +14,7 @@\n #include <rte_log.h>\n #include <rte_debug.h>\n #include <rte_common.h>\n+#include <rte_eal.h>\n \n #define BACKTRACE_SIZE 256\n \n@@ -79,6 +80,10 @@ rte_exit(int exit_code, const char *format, ...)\n \tva_end(ap);\n \n #ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR\n+\tint ret = rte_eal_cleanup();\n+\tif (ret)\n+\t\tRTE_LOG(CRIT, EAL,\n+\t\t\t\"EAL could not release all resources, code %d\\n\", ret);\n \texit(exit_code);\n #else\n \trte_dump_stack();\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex ce299d3..93f6c13 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -214,6 +214,7 @@ DPDK_18.02 {\n EXPERIMENTAL {\n \tglobal:\n \n+\trte_eal_cleanup;\n \trte_eal_devargs_insert;\n \trte_eal_devargs_parse;\n \trte_eal_devargs_remove;\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "2/4"
    ]
}