Show a cover letter.

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

{
    "id": 42857,
    "url": "http://patches.dpdk.org/api/covers/42857/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/cover/20180711134808.254054-1-qi.z.zhang@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": "<20180711134808.254054-1-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180711134808.254054-1-qi.z.zhang@intel.com",
    "date": "2018-07-11T13:47:49",
    "name": "[v12,00/19] enable hotplug on multi-process",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/cover/20180711134808.254054-1-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 524,
            "url": "http://patches.dpdk.org/api/series/524/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=524",
            "date": "2018-07-11T13:47:49",
            "name": "enable hotplug on multi-process",
            "version": 12,
            "mbox": "http://patches.dpdk.org/series/524/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/covers/42857/comments/",
    "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 007A21B57C;\n\tWed, 11 Jul 2018 15:47:35 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 01F8C1B581\n\tfor <dev@dpdk.org>; Wed, 11 Jul 2018 15:47:32 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Jul 2018 06:47:31 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby FMSMGA003.fm.intel.com with ESMTP; 11 Jul 2018 06:47:29 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,338,1526367600\"; d=\"scan'208\";a=\"63905200\"",
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com",
        "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>",
        "Date": "Wed, 11 Jul 2018 21:47:49 +0800",
        "Message-Id": "<20180711134808.254054-1-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "In-Reply-To": "<20180607123849.14439-1-qi.z.zhang@intel.com>",
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v12 00/19] enable hotplug on multi-process",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "v12:\n- fix return value in eal_dev_hotplug_request_to_primary.\n- add more error log in rte_eal_hotplug_add.\n- fix return value in rte_eal_hotplug_add and rte_eal_hotplug_remove\n  any failure due to IPC error will return -ENOMSG, but not -1.\n- remove unnecessary changes from previous rework.\n\nv11:\n- move out common code from pci_vfio_unmap_secondary and\n  pci_vfio_unmap_primary.\n- move RTE_BUS_NAME_MAX_LEN and RTE_DEV_ARGS_MAX_LEN into hotplug_mp.h\n- fix reply check in eal_dev_hotplug_request_to_primary.\n- move skeleton code for attaching device from secondary from patch 6/19\n  to patch 5/19 to improve code readability.\n\nv10:\n- Since hotplug add/remove a vdev on a secondary process will sync on\n  all processes now, it is not necessary to support private vdev for\n  a secondary process which is identified by a not-NULL devargs in\n  \"--vdev\". So re-work on all vdev driver changes to simpified device\n  probe scenario on a secondary process, devargs will be ignored on\n  secondary process now.\n- fix lisence header in example/multi-process/hotplug_mp/Makefile.\n\nv9:\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 hotplug on secondary process\n  net/ixgbe: enable hotplug on secondary process\n  net/af_packet: enable hotplug on secondary process\n  net/bonding: enable hotplug on secondary process\n  net/kni: enable hotplug on secondary process\n  net/null: enable hotplug on secondary process\n  net/octeontx: enable hotplug on secondary process\n  net/pcap: enable hotplug on secondary process\n  net/softnic: enable hotplug on secondary process\n  net/tap: enable hotplug on secondary process\n  net/vhost: enable hotplug 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               | 129 +++++++--\n drivers/net/af_packet/rte_eth_af_packet.c      |   7 +-\n drivers/net/bonding/rte_eth_bond_pmd.c         |   7 +-\n drivers/net/i40e/i40e_ethdev.c                 |   2 +\n drivers/net/ixgbe/ixgbe_ethdev.c               |   3 +\n drivers/net/kni/rte_eth_kni.c                  |   7 +-\n drivers/net/null/rte_eth_null.c                |  12 +-\n drivers/net/octeontx/octeontx_ethdev.c         |   9 +\n drivers/net/pcap/rte_eth_pcap.c                |  11 +-\n drivers/net/softnic/rte_eth_softnic.c          |  15 +-\n drivers/net/tap/rte_eth_tap.c                  |  13 +-\n drivers/net/vhost/rte_eth_vhost.c              |   7 +-\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         | 177 ++++++++++++-\n lib/librte_eal/common/eal_private.h            |  37 +++\n lib/librte_eal/common/hotplug_mp.c             | 348 +++++++++++++++++++++++++\n lib/librte_eal/common/hotplug_mp.h             |  48 ++++\n lib/librte_eal/common/include/rte_dev.h        |   6 +\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 33 files changed, 1117 insertions(+), 103 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"
}