Show a cover letter.

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

{
    "id": 41615,
    "url": "https://patches.dpdk.org/api/covers/41615/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/cover/20180627071740.19870-1-qi.z.zhang@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": "<20180627071740.19870-1-qi.z.zhang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180627071740.19870-1-qi.z.zhang@intel.com",
    "date": "2018-06-27T07:17:16",
    "name": "[v5,00/24] enable hotplug on multi-process",
    "submitter": {
        "id": 504,
        "url": "https://patches.dpdk.org/api/people/504/?format=api",
        "name": "Qi Zhang",
        "email": "qi.z.zhang@intel.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/cover/20180627071740.19870-1-qi.z.zhang@intel.com/mbox/",
    "series": [
        {
            "id": 252,
            "url": "https://patches.dpdk.org/api/series/252/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=252",
            "date": "2018-06-27T07:17:16",
            "name": "enable hotplug on multi-process",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/252/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/covers/41615/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 3CB511B53B;\n\tWed, 27 Jun 2018 09:17:14 +0200 (CEST)",
            "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 0A4BA1B53A\n\tfor <dev@dpdk.org>; Wed, 27 Jun 2018 09:17:11 +0200 (CEST)",
            "from orsmga007.jf.intel.com ([10.7.209.58])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jun 2018 00:17:08 -0700",
            "from dpdk51.sh.intel.com ([10.67.110.190])\n\tby orsmga007.jf.intel.com with ESMTP; 27 Jun 2018 00:17:06 -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,278,1526367600\"; d=\"scan'208\";a=\"52236012\"",
        "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, 27 Jun 2018 15:17:16 +0800",
        "Message-Id": "<20180627071740.19870-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 v5 00/24] 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": "v5:\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 (24):\n  eal: introduce one device scan\n  bus/vdev: enable one device scan\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/e1000: enable port detach on secondary process\n  net/igb: enable port detach on secondary process\n  net/fm10k: 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/failsafe: 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\n drivers/bus/vdev/vdev.c                      |  30 ++\n drivers/net/af_packet/rte_eth_af_packet.c    |  11 +\n drivers/net/bonding/rte_eth_bond_pmd.c       |  11 +\n drivers/net/e1000/em_ethdev.c                |   9 +\n drivers/net/e1000/igb_ethdev.c               |   9 +\n drivers/net/failsafe/failsafe.c              |  16 ++\n drivers/net/fm10k/fm10k_ethdev.c             |   9 +\n drivers/net/i40e/i40e_ethdev.c               |   2 +\n drivers/net/i40e/i40e_ethdev_vf.c            |   9 +\n drivers/net/ixgbe/ixgbe_ethdev.c             |  12 +\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_dev.c       |  17 +-\n lib/librte_eal/common/eal_common_proc.c      |  51 +++-\n lib/librte_eal/common/eal_private.h          |   5 +\n lib/librte_eal/common/include/rte_bus.h      |  16 ++\n lib/librte_eal/common/include/rte_eal.h      |  34 +++\n lib/librte_eal/linuxapp/eal/eal.c            |   2 +\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                | 415 +++++++++++++++++++++++++++\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               | 312 ++++++++++++++++++--\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 39 files changed, 1911 insertions(+), 41 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"
}