Show a cover letter.

GET /api/covers/42516/?format=api
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 42516,
    "url": "http://patches.dpdk.org/api/covers/42516/?format=api",
    "web_url": "http://patches.dpdk.org/cover/42516/",
    "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"
    },
    "msgid": "<20180706141826.204044-1-qi.z.zhang@intel.com>",
    "date": "2018-07-06T14:18:07",
    "name": "[v9,00/19] enable hotplug on multi-process",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Zhang, Qi Z",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/cover/42516/mbox/",
    "series": [
        {
            "id": 457,
            "url": "http://patches.dpdk.org/api/series/457/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=457",
            "date": "2018-07-06T14:18:07",
            "name": "enable hotplug on multi-process",
            "version": 9,
            "mbox": "http://patches.dpdk.org/series/457/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/covers/42516/comments/",
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>",
        "X-Mailman-Version": "2.1.15",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,316,1526367600\"; d=\"scan'208\";a=\"243511280\"",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-ExtLoop1": "1",
        "X-BeenThere": "dev@dpdk.org",
        "Message-Id": "<20180706141826.204044-1-qi.z.zhang@intel.com>",
        "X-Original-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B337E1BE90;\n\tFri,  6 Jul 2018 16:18:20 +0200 (CEST)",
            "from mga07.intel.com (mga07.intel.com [134.134.136.100])\n\tby dpdk.org (Postfix) with ESMTP id BB69C1BE8B\n\tfor <dev@dpdk.org>; Fri,  6 Jul 2018 16:18:17 +0200 (CEST)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t06 Jul 2018 07:18:15 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby fmsmga006.fm.intel.com with ESMTP; 06 Jul 2018 07:17:49 -0700"
        ],
        "X-Mailer": "git-send-email 2.13.6",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v9 00/19] enable hotplug on multi-process",
        "Precedence": "list",
        "Date": "Fri,  6 Jul 2018 22:18:07 +0800",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Amp-File-Uploaded": "False",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Cc": "konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, \n\tferruh.yigit@intel.com, benjamin.h.shelton@intel.com,\n\tnarender.vangati@intel.com, Qi Zhang <qi.z.zhang@intel.com>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Delivered-To": "patchwork@dpdk.org",
        "In-Reply-To": "<20180607123849.14439-1-qi.z.zhang@intel.com>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "v9:\n- Move hotplug IPC from rte_eth_dev_attach/rte_eth_dev_detach to\n  eal_dev_hotplug_add and eal_dev_hotplug_remove, now all kinds of\n  devices will be synced in multi-process.\n- Fix couple issue when a device is bound to vfio.\n  1) The device can't be detached clearly in a secondary process, which\n     also cause it can't be attached again, due to the error that\n     /dev/vfio/<group_fd> is still busy.(see Patch 3/19 and 4/19)\n  2) repeat detach/attach device will cause \"cannot find TAILQ entry\n     for PCI device\" due to incorrect PCI address compare.\n     (see patch 2/19).\n- Removed device lock.\n- Removed private device support.\n- Fix commit log grammar issue\n\nv8:\n- update rte_eal_version.map due to new API added.\n- minor reword on release note.\n- minor fix on commit log and code style.\n\nNOTE:\n  Some issues which is not related with this patchset is expected when\n  play with hotplug_mp sample as belows.\n\n- Attach a PCI device twice may cause device can't be detached\n  below fix is required:\n  https://patches.dpdk.org/patch/42030/\n\n- ixgbe device can't detached, below fix is required\n  https://patches.dpdk.org/patch/42031/\n\nv7:\n- update rte_ethdev_version.map for new APIs.\n- improve code readability in __handle_secondary_request by use goto.\n- add comments to explain why need to call rte_eal_alarm_set.\n- add error log when process_mp_init_callbacks failed.\n- reword release notes base on Anatoly's suggestion.\n- add back previous \"Acked-by\" and \"Reviewed-by\" in commit log.\n\n  NOTE: current patchset depends on below IPC fix, or it may not be able\n  to attach a shared vdev.\n  https://patches.dpdk.org/patch/41647/\n\nv6:\n- remove bus->scan_one, since ABI break is not necessary.\n- remove patch for failsafe PMD since it will not support secondary.\n- fix wrong implemenation on ixgbe.\n- add rte_eth_dev_release_port_private into rte_eth_dev_pci_generic_remove for\n  secondary process, so we don't need to patch on PMD if PMD use the\n  default remove function.\n- add release notes update.\n- agreed to use strdup(peer) as workaround for repling a sync request in seperate\n  thread.\n\nv5:\n- since we will keep mp thread separate from interrupt thread,\n  it is not necessary to use temporary thread, we use rte_eal_alarm_set.\n- remove the change in rte_eth_dev_release_port, since there is a better\n  way to prevent rte_eth_dev_release_port be called after\n  rte_eth_dev_release_port_private.\n- fix the issue that lock does not take effect on secondary due to\n  previous re-work\n- fix the issue when the first attached device is a private device from\n  secondary. (patch 8/24)\n- work around for reply a sync request in separate thread, this is still\n  an open and in discussion as below.\n  https://mails.dpdk.org/archives/dev/2018-June/105359.html\n\nv4:\n- since mp thread will be merged to interrupt thread, the fix on v3\n  for sync IPC deadlock will not work. the new version enable the\n  machanism to invoke a mp action callback in a temporary thread to\n  avoid the IPC deadlock, with this, secondary to primary request\n  impelemtation also be simplified, since we can use sync request\n  directly in a separate thread.\n\nv3:\n- enable mp init callback register to help non-eal module to initialize\n  mp channel during rte_eal_init\n- fix when attach share device from secondary.\n  1) dead lock due to sync IPC be invoked in rte_malloc in primary\n     process when handle secondary request to attach device, the\n     solution is primary process to issue share device attach/detach\n     in interrupt thread.\n  2) return port_id not correct.\n- check nb_sent and nb_received in sync IPC.\n- fix memory leak duirng error handling at attach_on_secondary.\n- improve clean_lock_callback to only lock/unlock spinlock once\n- improve error code return in check-reply during async IPC.\n- remove rte_ prefix of internal function in ethdev_mp.c\n- sample code improvement.\n  1) rename sample to \"hotplug_mp\", and move to example/multi-process.\n  2) cleanup header include.\n  3) call rte_eal_cleanup before exit.\n\nv2:\n- rename rte_ethdev_mp.* to ethdev_mp.*\n- rename rte_ethdev_lock.* to ethdev_lock.*\n- move internal funciton to ethdev_private.h\n- separate rte_eth_dev_[un]lock into rte_eth_dev_[un]lock and\n  rte_eth_dev_[un]lock_with_callback\n- lock callbacks will be removed automatically after device is detached.\n- add experimental tag for all new APIs.\n- fix coding style issue.\n- fix wrong lisence header in sample code.\n- fix spelling \n- fix meson.build.\n- improve comments. \n\nBackground:\n===========\n\nCurrently secondary process will only sync ethdev from primary\nprocess at init stage, but it will not be aware if device\nis attached/detached on primary process at runtime.\n\nWhile there is the requirement from application that take\nprimary-secondary process model. The primary process work as a\nresource management process, it will create/destroy virtual device\nat runtime, while the secondary process deal with the network stuff\nwith these devices.\n\nSolution:\n=========\n\nSo the orignial intention is to fix this gap, but beyond that\nthe patch set provide a more comprehesive solution to handle\ndifferent hotplug cases in multi-process situation, it cover below\nscenario:\n\n1. Attach a device from the primary\n2. Detach a device from the primary\n3. Attach a device from a secondary\n4. Detach a device from a secondary\n\nIn primary-secondary process model, we assume ethernet devices are\nshared by default. that means attach or detach a device on any process\nwill broadcast to all other processes through mp channel then device\ninformation will be synchronized on all processes.\n\nAny failure during attaching or detaching process will cause inconsistent\nstatus between processes, so proper rollback action should be considered.\n\nScenario for Case 1, 2:\n\nattach device from primary\na) primary attach the new device if failed goto h).\nb) primary send attach sync request to all secondary.\nc) secondary receive request and attach device and send reply.\nd) primary check the reply if all success go to i).\ne) primary send attach rollback sync request to all secondary.\nf) secondary receive the request and detach device and send reply.\ng) primary receive the reply and detach device as rollback action.\nh) attach fail\ni) attach success\n\ndetach device from primary\na) primary perform pre-detach check, if device is locked, goto i).\nb) primary send pre-detach sync request to all secondary.\nc) secondary perform pre-detach check and send reply.\nd) primary check the reply if any fail goto i).\ne) primary send detach sync request to all secondary\nf) secondary detach the device and send reply (assume no fail)\ng) primary detach the device.\nh) detach success\ni) detach failed\n\nScenario for case 3, 4:\n\nattach device from secondary:\na) seconary send asycn request to primary and wait on a condition\n   which will be released by matched response from primary.\nb) primary receive the request and attach the new device if failed\n   goto i).\nc) primary forward attach request to all secondary as async request\n   (because this in mp thread context, use sync request will deadlock,\n    same reason for all following async request.)\nd) secondary receive request and attach device and send reply.\ne) primary check the reply if all success go to j).\nf) primary send attach rollback async request to all secondary.\ng) secondary receive the request and detach device and send reply.\nh) primary receive the reply and detach device as rollback action.\ni) send fail response to secondary, goto k).\nj) send success response to secondary.\nk) secondary process receive response and return.\n \ndetach device from secondary:\na) secondary send async request to primary and wait on a condition\n   which will be released by matched response from primary.\nb) primary receive the request and  perform pre-detach check, if device\n   is locked, goto j).\nc) primary send pre-detach async request to all secondary.\nd) secondary perform pre-detach check and send reply.\ne) primary check the reply if any fail goto j).\nf) primary send detach async request to all secondary\ng) secondary detach the device and send reply\nh) primary detach the device.\ni) send success response to secondary, goto k).\nj) send fail response to secondary.\nk) secondary process receive response and return.\n\nAPIs chenages:\n==============\n\nscope of rte_eal_hotplug_add and rte_eal_hotplug_remove is extended.\nIn primary-secondary process model, rte_eal_hotplug_add will guarantee\nthat device be attached on all processes, while rte_eal_hotplug_remove will\nguarantee device be detached on all processes.\n\n\nPMD Impact:\n===========\n\nCurrently device removing is not handled well in secondary process on\nmost pmd drivers, rte_eth_dev_relase_port will be invoked and will mess up\nprimary process since it reset all shared data. So we introduced new API\nrte_eth_dev_release_port_local which only reset ethdev's state to unsued\nbut not touch shared data so other process will not be impacted.\nSince not all device driver is target to support primary-secondary\nprocess model, so the patch set only fix this on all Intel devices and\nvdev, it can be refereneced by other driver when equevalent fix is\nrequired\n\nExample:\n========\n\nThe patchset also contains a example to demonstrate device hotplug\nin multi-process model, below are detail instructions.\n\n/* start sample code as primary then secondary */\n./hotplug_mp --proc-type=auto\n\nCommand Line Example:\n\n>help\n>list\n\n/* attach a af_packet vdev */\n>attach net_af_packet,iface=eth0\n\n/* detach port 0 */\n>detach 0\n\nQi Zhang (19):\n  ethdev: add function to release port in local process\n  bus/pci: fix PCI address compare\n  bus/pci: enable vfio unmap resource for secondary\n  vfio: remove uneccessary IPC for group fd clear\n  eal: enable hotplug on multi-process\n  eal: support attach or detach share device from  secondary\n  net/i40e: enable port detach on secondary process\n  net/ixgbe: enable port detach on secondary process\n  net/af_packet: enable port detach on secondary process\n  net/bonding: enable port detach on secondary process\n  net/kni: enable port detach on secondary process\n  net/null: enable port detach on secondary process\n  net/octeontx: enable port detach on secondary process\n  net/pcap: enable port detach on secondary process\n  net/softnic: enable port detach on secondary process\n  net/tap: enable port detach on secondary process\n  net/vhost: enable port detach on secondary process\n  examples/multi_process: add hotplug sample\n  doc: update release notes for multi process hotplug\n\n doc/guides/rel_notes/release_18_08.rst         |  11 +\n drivers/bus/pci/linux/pci_vfio.c               |  88 ++++++-\n drivers/net/af_packet/rte_eth_af_packet.c      |  11 +\n drivers/net/bonding/rte_eth_bond_pmd.c         |  11 +\n drivers/net/i40e/i40e_ethdev.c                 |   2 +\n drivers/net/ixgbe/ixgbe_ethdev.c               |   3 +\n drivers/net/kni/rte_eth_kni.c                  |  11 +\n drivers/net/null/rte_eth_null.c                |  16 +-\n drivers/net/octeontx/octeontx_ethdev.c         |  16 ++\n drivers/net/pcap/rte_eth_pcap.c                |  15 +-\n drivers/net/softnic/rte_eth_softnic.c          |  19 +-\n drivers/net/tap/rte_eth_tap.c                  |  17 +-\n drivers/net/vhost/rte_eth_vhost.c              |  11 +\n examples/multi_process/Makefile                |   1 +\n examples/multi_process/hotplug_mp/Makefile     |  23 ++\n examples/multi_process/hotplug_mp/commands.c   | 197 ++++++++++++++\n examples/multi_process/hotplug_mp/commands.h   |  10 +\n examples/multi_process/hotplug_mp/main.c       |  41 +++\n lib/librte_eal/bsdapp/eal/Makefile             |   1 +\n lib/librte_eal/common/eal_common_dev.c         | 168 +++++++++++-\n lib/librte_eal/common/eal_private.h            |  37 +++\n lib/librte_eal/common/hotplug_mp.c             | 346 +++++++++++++++++++++++++\n lib/librte_eal/common/hotplug_mp.h             |  44 ++++\n lib/librte_eal/common/include/rte_bus.h        |   3 +\n lib/librte_eal/common/include/rte_dev.h        |   9 +\n lib/librte_eal/common/meson.build              |   1 +\n lib/librte_eal/linuxapp/eal/Makefile           |   1 +\n lib/librte_eal/linuxapp/eal/eal.c              |   6 +\n lib/librte_eal/linuxapp/eal/eal_vfio.c         |  45 +---\n lib/librte_eal/linuxapp/eal/eal_vfio.h         |   1 -\n lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |   8 -\n lib/librte_ethdev/rte_ethdev.c                 |  12 +\n lib/librte_ethdev/rte_ethdev_driver.h          |  16 +-\n lib/librte_ethdev/rte_ethdev_pci.h             |   8 +\n 34 files changed, 1147 insertions(+), 62 deletions(-)\n create mode 100644 examples/multi_process/hotplug_mp/Makefile\n create mode 100644 examples/multi_process/hotplug_mp/commands.c\n create mode 100644 examples/multi_process/hotplug_mp/commands.h\n create mode 100644 examples/multi_process/hotplug_mp/main.c\n create mode 100644 lib/librte_eal/common/hotplug_mp.c\n create mode 100644 lib/librte_eal/common/hotplug_mp.h"
}