Show a cover letter.

GET /api/covers/42034/
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 42034,
    "url": "http://patches.dpdk.org/api/covers/42034/",
    "web_url": "http://patches.dpdk.org/cover/42034/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/",
        "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": "<20180702054450.29269-1-qi.z.zhang@intel.com>",
    "date": "2018-07-02T05:44:31",
    "name": "[v8,00/19] enable hotplug on multi-process",
    "submitter": {
        "id": 504,
        "url": "http://patches.dpdk.org/api/people/504/",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "http://patches.dpdk.org/cover/42034/mbox/",
    "series": [
        {
            "id": 344,
            "url": "http://patches.dpdk.org/api/series/344/",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=344",
            "date": "2018-07-02T05:44:31",
            "name": "enable hotplug on multi-process",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/344/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/covers/42034/comments/",
    "headers": {
        "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>",
        "X-Original-To": "patchwork@dpdk.org",
        "Date": "Mon,  2 Jul 2018 13:44:31 +0800",
        "In-Reply-To": "<20180607123849.14439-1-qi.z.zhang@intel.com>",
        "Precedence": "list",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<20180607123849.14439-1-qi.z.zhang@intel.com>",
        "X-Mailer": "git-send-email 2.13.6",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "To": "thomas@monjalon.net,\n\tanatoly.burakov@intel.com",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 12ED64F9C;\n\tMon,  2 Jul 2018 07:44:26 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 285C64F9A\n\tfor <dev@dpdk.org>; Mon,  2 Jul 2018 07:44:23 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t01 Jul 2018 22:44:22 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga007.jf.intel.com with ESMTP; 01 Jul 2018 22:44:13 -0700"
        ],
        "From": "Qi Zhang <qi.z.zhang@intel.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "X-ExtLoop1": "1",
        "X-Amp-File-Uploaded": "False",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "Subject": "[dpdk-dev] [PATCH v8 00/19] enable hotplug on multi-process",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,298,1526367600\"; d=\"scan'208\";a=\"53378897\"",
        "Delivered-To": "patchwork@dpdk.org",
        "Message-Id": "<20180702054450.29269-1-qi.z.zhang@intel.com>",
        "X-Mailman-Version": "2.1.15"
    },
    "content": "v8:\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 share device from primary\n2. Detach a share device from primary\n3. Attach a share device from secondary\n4. Detach a share device from secondary\n5. Attach a private device from secondary\n6. Detach a private device from secondary\n7. Detach a share device from secondary privately\n8. Attach a share device from secondary privately\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 process will cause inconsistent status\nbetween processes, so proper rollback action should be considered.\nAlso, it is not safe to detach a share device when other process still\nuse it, so a handshake mechanism is introduced.\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\nCase 5, 6:\nSecondary process can attach private device which only visible to\nitself, in this case no IPC is involved, primary process is not allowed\nto have private device so far.\n\nCase 7, 8:\nSecondary process can also temporally to detach a share device\n\"privately\" then attach it back later, this action also not impact other\nprocesses.\n\nAPIs chenages:\n==============\n\nrte_eth_dev_attach and rte_eth_dev_attach are extended to support\nshare device attach/detach in primary-secondary process model, it will\nbe called in case 1,2,3,4.\n\nNew API rte_eth_dev_attach_private and rte_eth_dev_detach_private are\nintroduced to cover case 5,6,7,8, this API can only be invoked in\nsecondary process.\n\nNew API rte_eth_dev_lock and rte_eth_dev_unlock are introduced to let\napplication lock or unlock on specific ethdev, a locked device\ncan't be detached. This help applicaiton to prevent unexpected\ndevice detaching, especially in multi-process envrionment.\nAslo the new API let application to register a callback function\nwhich will be invoked before a device is going to be detached,\nthe return value of the function will decide if device will continue\nbe detached or not, this support application to do condition check\nat runtime.\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\nLimitation:\n===========\n\n1. The solution does not cover the case that primary process exit while\n   secondary processes still be active. Though this is not a typial use\n   case, but if this happens:\n   a. secondary process can't attach / detach any shared device since no\n      primary exist.\n   b. secondary process still can attach / detach private device.\n   c. secondary process still can detach a share device privately but may\n      not attach it back, that ethdev slot will become zombie slot.\n\n2. So for, for PCI bus, case 5,6 is not supported. PCI bus scan/probe\n   mechanism can be improved to support attach private device on secondary\n   process, but this is not the scope of this patchset.\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\n/* attach a private af_packet vdev (secondary process only)*/\n>attachp net_af_packet,iface=eth0\n\n/* detach a private device (secondary process only) */\n>detachp 0\n\n/* lock port 0 */\n>lock 0\n\n/* unlock port 0 */\n>unlock 0\n\nQi Zhang (19):\n  ethdev: add function to release port in local process\n  eal: enable multi process init callback\n  ethdev: enable hotplug on multi-process\n  ethdev: introduce device lock\n  ethdev: support attach or detach share device from secondary\n  ethdev: support attach private device as first\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       |  20 ++\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 | 356 ++++++++++++++++++++++\n examples/multi_process/hotplug_mp/commands.h |  10 +\n examples/multi_process/hotplug_mp/main.c     |  41 +++\n lib/librte_eal/common/eal_common_proc.c      |  57 +++-\n lib/librte_eal/common/eal_private.h          |   5 +\n lib/librte_eal/common/include/rte_eal.h      |  34 +++\n lib/librte_eal/linuxapp/eal/eal.c            |   2 +\n lib/librte_eal/rte_eal_version.map           |   1 +\n lib/librte_ethdev/Makefile                   |   2 +\n lib/librte_ethdev/ethdev_lock.c              | 140 +++++++++\n lib/librte_ethdev/ethdev_lock.h              |  31 ++\n lib/librte_ethdev/ethdev_mp.c                | 431 +++++++++++++++++++++++++++\n lib/librte_ethdev/ethdev_mp.h                |  42 +++\n lib/librte_ethdev/ethdev_private.h           |  42 +++\n lib/librte_ethdev/meson.build                |   2 +\n lib/librte_ethdev/rte_ethdev.c               | 311 +++++++++++++++++--\n lib/librte_ethdev/rte_ethdev.h               | 169 +++++++++++\n lib/librte_ethdev/rte_ethdev_core.h          |   5 +\n lib/librte_ethdev/rte_ethdev_driver.h        |  13 +\n lib/librte_ethdev/rte_ethdev_pci.h           |   3 +\n lib/librte_ethdev/rte_ethdev_version.map     |   4 +\n 35 files changed, 1840 insertions(+), 37 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_ethdev/ethdev_lock.c\n create mode 100644 lib/librte_ethdev/ethdev_lock.h\n create mode 100644 lib/librte_ethdev/ethdev_mp.c\n create mode 100644 lib/librte_ethdev/ethdev_mp.h\n create mode 100644 lib/librte_ethdev/ethdev_private.h"
}