get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 110175,
    "url": "http://patches.dpdk.org/api/patches/110175/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220422162717.3249369-1-kevin.laatz@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": "<20220422162717.3249369-1-kevin.laatz@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220422162717.3249369-1-kevin.laatz@intel.com",
    "date": "2022-04-22T16:27:17",
    "name": "[RFC,v2] eal: add bus cleanup to eal cleanup",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "453f8d0752a3922329e062c6b8c988f71d740d1a",
    "submitter": {
        "id": 921,
        "url": "http://patches.dpdk.org/api/people/921/?format=api",
        "name": "Kevin Laatz",
        "email": "kevin.laatz@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220422162717.3249369-1-kevin.laatz@intel.com/mbox/",
    "series": [
        {
            "id": 22636,
            "url": "http://patches.dpdk.org/api/series/22636/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=22636",
            "date": "2022-04-22T16:27:17",
            "name": "[RFC,v2] eal: add bus cleanup to eal cleanup",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/22636/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/110175/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/110175/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2C1ABA0093;\n\tFri, 22 Apr 2022 18:27:32 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id CD0E3410D5;\n\tFri, 22 Apr 2022 18:27:31 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id 27A2F40042\n for <dev@dpdk.org>; Fri, 22 Apr 2022 18:27:29 +0200 (CEST)",
            "from orsmga003.jf.intel.com ([10.7.209.27])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Apr 2022 09:27:28 -0700",
            "from silpixa00401122.ir.intel.com ([10.55.128.10])\n by orsmga003.jf.intel.com with ESMTP; 22 Apr 2022 09:27:27 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1650644850; x=1682180850;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=asMzRMSmN+/BuRqm1TW7E9OM6eHN4dxisOXgjMn8dcc=;\n b=ddFe46Zo3oFqyl/yt5Lvu7cXdNhtZkyluD3LIhijYLNffJzd818UcCl6\n oI34AlBjV2AgCqMcO4zgWdVE1jJGXfFL918FWTkugDlGtj4jCKNQ1ybA+\n E8AHi/nuZD3d4s8I/z+1rmCJsnxQp7lGznx3LKdAHX1CbS1ISDwYbl3NP\n nK1BpOlnJ3ZqHp5OnEzjTC9k3CGV0mT+YbriGv/G7RDKm7JZdu4us5QdE\n /8mB3zvfZQuwKLUg2ZHmnJ1tYqd/CKDpZFw7F1O+pg5TBxtSUpOIlCd2m\n Slyi19+H2bnNyGJvflfQpZh/Sw9PDeIEERWg05CVj4aJWyQZI6/V4UJwv A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10324\"; a=\"252051316\"",
            "E=Sophos;i=\"5.90,282,1643702400\"; d=\"scan'208\";a=\"252051316\"",
            "E=Sophos;i=\"5.90,282,1643702400\"; d=\"scan'208\";a=\"511648313\""
        ],
        "X-ExtLoop1": "1",
        "From": "Kevin Laatz <kevin.laatz@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Kevin Laatz <kevin.laatz@intel.com>,\n =?utf-8?q?Morten_Br=C3=B8rup?= <mb@smartsharesystems.com>",
        "Subject": "[RFC v2] eal: add bus cleanup to eal cleanup",
        "Date": "Fri, 22 Apr 2022 17:27:17 +0100",
        "Message-Id": "<20220422162717.3249369-1-kevin.laatz@intel.com>",
        "X-Mailer": "git-send-email 2.31.1",
        "In-Reply-To": "<20220419161438.1837860-1-kevin.laatz@intel.com>",
        "References": "<20220419161438.1837860-1-kevin.laatz@intel.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "During EAL init, all buses are probed and the devices found are\ninitialized. On eal_cleanup(), the inverse does not happen, meaning any\nallocated memory and other configuration will not be cleaned up\nappropriately on exit.\n\nCurrently, in order for device cleanup to take place, applications must\ncall the driver-relevant functions to ensure proper cleanup is done before\nthe application exits. Since initialization occurs for all devices on the\nbus, not just the devices used by an application, it requires a)\napplication awareness of all bus devices that could have been probed on the\nsystem, and b) code duplication across applications to ensure cleanup is\nperformed. An example of this is rte_eth_dev_close() which is commonly used\nacross the example applications.\n\nThis RFC proposes adding bus cleanup to the eal_cleanup() to make EAL's\ninit/exit more symmetrical, ensuring all bus devices are cleaned up\nappropriately without the application needing to be aware of all bus types\nthat may have been probed during initialization.\n\nContained in this RFC are the changes required to perform cleanup for\ndevices on the PCI bus during eal_cleanup(). This can be expanded in\nsubsequent versions if these changes are desired. There would be an ask for\nbus maintainers to add the relevant cleanup for their buses since they have\nthe domain expertise.\n\nSigned-off-by: Kevin Laatz <kevin.laatz@intel.com>\nAcked-by: Morten Brørup <mb@smartsharesystems.com>\n\n---\nv2:\n* change log level from INFO to DEBUG for PCI cleanup\n* add abignore entries for rte_bus related false positives\n---\n devtools/libabigail.abignore    |  9 +++++++++\n drivers/bus/pci/pci_common.c    | 29 +++++++++++++++++++++++++++++\n lib/eal/common/eal_common_bus.c | 18 ++++++++++++++++++\n lib/eal/include/rte_bus.h       | 23 +++++++++++++++++++++++\n lib/eal/linux/eal.c             |  1 +\n 5 files changed, 80 insertions(+)",
    "diff": "diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore\nindex c618f20032..3ff5d4db7c 100644\n--- a/devtools/libabigail.abignore\n+++ b/devtools/libabigail.abignore\n@@ -40,3 +40,12 @@\n ; Ignore visibility fix of local functions in experimental gpudev library\n [suppress_file]\n         soname_regexp = ^librte_gpudev\\.\n+\n+; Ignore field inserted to rte_bus, adding cleanup function\n+[suppress_type]\n+        name = rte_bus\n+        has_data_member_inserted_at = end\n+\n+; Ignore changes to internally used structs containing rte_bus\n+[suppress_type]\n+        name = rte_pci_bus, rte_vmbus_bus\ndiff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex 37ab879779..1bee8e8201 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -394,6 +394,34 @@ pci_probe(void)\n \treturn (probed && probed == failed) ? -1 : 0;\n }\n \n+static int\n+pci_cleanup(void)\n+{\n+\tstruct rte_pci_device *dev = NULL;\n+\tint ret = 0;\n+\n+\tFOREACH_DEVICE_ON_PCIBUS(dev) {\n+\t\tstruct rte_pci_addr *loc = &dev->addr;\n+\t\tstruct rte_pci_driver *drv = dev->driver;\n+\n+\t\tRTE_LOG(DEBUG, EAL,\n+\t\t\t\t\"Clean up PCI driver: %s (%x:%x) device: \"PCI_PRI_FMT\" (socket %i)\\n\",\n+\t\t\t\tdrv->driver.name, dev->id.vendor_id, dev->id.device_id,\n+\t\t\t\tloc->domain, loc->bus, loc->devid, loc->function,\n+\t\t\t\tdev->device.numa_node);\n+\n+\t\tret = drv->remove(dev);\n+\t\tif (ret < 0) {\n+\t\t\tRTE_LOG(ERR, EAL, \"Cleanup for device \"PCI_PRI_FMT\" failed\\n\",\n+\t\t\t\t\tdev->addr.domain, dev->addr.bus, dev->addr.devid,\n+\t\t\t\t\tdev->addr.function);\n+\t\t\trte_errno = errno;\n+\t\t}\n+\t}\n+\n+\treturn ret;\n+}\n+\n /* dump one device */\n static int\n pci_dump_one_device(FILE *f, struct rte_pci_device *dev)\n@@ -813,6 +841,7 @@ struct rte_pci_bus rte_pci_bus = {\n \t.bus = {\n \t\t.scan = rte_pci_scan,\n \t\t.probe = pci_probe,\n+\t\t.cleanup = pci_cleanup,\n \t\t.find_device = pci_find_device,\n \t\t.plug = pci_plug,\n \t\t.unplug = pci_unplug,\ndiff --git a/lib/eal/common/eal_common_bus.c b/lib/eal/common/eal_common_bus.c\nindex baa5b532af..046a06a2bf 100644\n--- a/lib/eal/common/eal_common_bus.c\n+++ b/lib/eal/common/eal_common_bus.c\n@@ -85,6 +85,24 @@ rte_bus_probe(void)\n \treturn 0;\n }\n \n+/* Clean up all devices of all buses */\n+int\n+rte_bus_cleanup(void)\n+{\n+\tint ret;\n+\tstruct rte_bus *bus;\n+\n+\tTAILQ_FOREACH(bus, &rte_bus_list, next) {\n+\t\tif (bus->cleanup == NULL)\n+\t\t\tcontinue;\n+\t\tret = bus->cleanup();\n+\t\tif (ret)\n+\t\t\tRTE_LOG(ERR, EAL, \"Bus (%s) cleanup failed.\\n\", bus->name);\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* Dump information of a single bus */\n static int\n bus_dump_one(FILE *f, struct rte_bus *bus)\ndiff --git a/lib/eal/include/rte_bus.h b/lib/eal/include/rte_bus.h\nindex bbbb6efd28..42da38730f 100644\n--- a/lib/eal/include/rte_bus.h\n+++ b/lib/eal/include/rte_bus.h\n@@ -66,6 +66,18 @@ typedef int (*rte_bus_scan_t)(void);\n  */\n typedef int (*rte_bus_probe_t)(void);\n \n+/**\n+ * Implementation specific cleanup function which is responsible for cleaning up\n+ * devices on that bus with applicable drivers.\n+ *\n+ * This is called while iterating over each registered bus.\n+ *\n+ * @return\n+ * 0 for successful cleanup\n+ * !0 for any error during cleanup\n+ */\n+typedef int (*rte_bus_cleanup_t)(void);\n+\n /**\n  * Device iterator to find a device on a bus.\n  *\n@@ -277,6 +289,7 @@ struct rte_bus {\n \t\t\t\t/**< handle hot-unplug failure on the bus */\n \trte_bus_sigbus_handler_t sigbus_handler;\n \t\t\t\t\t/**< handle sigbus error on the bus */\n+\trte_bus_cleanup_t cleanup;   /**< Cleanup devices on bus */\n \n };\n \n@@ -317,6 +330,16 @@ int rte_bus_scan(void);\n  */\n int rte_bus_probe(void);\n \n+/**\n+ * For each device on the buses, perform a driver 'match' and call the\n+ * driver-specific function for device cleanup.\n+ *\n+ * @return\n+ * 0 for successful match/cleanup\n+ * !0 otherwise\n+ */\n+int rte_bus_cleanup(void);\n+\n /**\n  * Dump information of all the buses registered with EAL.\n  *\ndiff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c\nindex 025e5cc10d..37983b98c0 100644\n--- a/lib/eal/linux/eal.c\n+++ b/lib/eal/linux/eal.c\n@@ -1268,6 +1268,7 @@ rte_eal_cleanup(void)\n \tvfio_mp_sync_cleanup();\n #endif\n \trte_mp_channel_cleanup();\n+\trte_bus_cleanup();\n \t/* after this point, any DPDK pointers will become dangling */\n \trte_eal_memory_detach();\n \teal_mp_dev_hotplug_cleanup();\n",
    "prefixes": [
        "RFC",
        "v2"
    ]
}