get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 48856,
    "url": "https://patches.dpdk.org/api/patches/48856/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181214123704.20110-1-i.maximets@samsung.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": "<20181214123704.20110-1-i.maximets@samsung.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181214123704.20110-1-i.maximets@samsung.com",
    "date": "2018-12-14T12:37:04",
    "name": "[RFC] net/virtio: use real barriers for vDPA",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d2311d45c53d7a0528996dad5ddeb778022055d9",
    "submitter": {
        "id": 323,
        "url": "https://patches.dpdk.org/api/people/323/?format=api",
        "name": "Ilya Maximets",
        "email": "i.maximets@samsung.com"
    },
    "delegate": {
        "id": 2642,
        "url": "https://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20181214123704.20110-1-i.maximets@samsung.com/mbox/",
    "series": [
        {
            "id": 2781,
            "url": "https://patches.dpdk.org/api/series/2781/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=2781",
            "date": "2018-12-14T12:37:04",
            "name": "[RFC] net/virtio: use real barriers for vDPA",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/2781/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/48856/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/48856/checks/",
    "tags": {},
    "related": [],
    "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 1CB741BA96;\n\tFri, 14 Dec 2018 13:37:20 +0100 (CET)",
            "from mailout2.w1.samsung.com (mailout2.w1.samsung.com\n\t[210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 6E4E21BA92\n\tfor <dev@dpdk.org>; Fri, 14 Dec 2018 13:37:18 +0100 (CET)",
            "from eucas1p1.samsung.com (unknown [182.198.249.206])\n\tby mailout2.w1.samsung.com (KnoxPortal) with ESMTP id\n\t20181214123717euoutp02a9b5725dec471fe2e30780ff24443392~wM0OSYefL2228722287euoutp02G\n\tfor <dev@dpdk.org>; Fri, 14 Dec 2018 12:37:17 +0000 (GMT)",
            "from eusmges3new.samsung.com (unknown [203.254.199.245]) by\n\teucas1p1.samsung.com (KnoxPortal) with ESMTP id\n\t20181214123717eucas1p1075d7078e11c9a69e7cbda44dc28f251~wM0N5HPcx1231112311eucas1p13;\n\tFri, 14 Dec 2018 12:37:17 +0000 (GMT)",
            "from eucas1p1.samsung.com ( [182.198.249.206]) by\n\teusmges3new.samsung.com (EUCPMTA) with SMTP id 5D.3A.04806.CF3A31C5;\n\tFri, 14 Dec 2018 12:37:16 +0000 (GMT)",
            "from eusmtrp2.samsung.com (unknown [182.198.249.139]) by\n\teucas1p2.samsung.com (KnoxPortal) with ESMTPA id\n\t20181214123716eucas1p2928654e37999b8fc32899eed326a3581~wM0M_zrFg2067520675eucas1p27;\n\tFri, 14 Dec 2018 12:37:16 +0000 (GMT)",
            "from eusmgms2.samsung.com (unknown [182.198.249.180]) by\n\teusmtrp2.samsung.com (KnoxPortal) with ESMTP id\n\t20181214123715eusmtrp22ae4cc9427f60fb49816c37c60ec8dba~wM0MwBFmG1910619106eusmtrp28;\n\tFri, 14 Dec 2018 12:37:15 +0000 (GMT)",
            "from eusmtip1.samsung.com ( [203.254.199.221]) by\n\teusmgms2.samsung.com (EUCPMTA) with SMTP id 2A.C4.04128.BF3A31C5;\n\tFri, 14 Dec 2018 12:37:15 +0000 (GMT)",
            "from imaximets.rnd.samsung.ru (unknown [106.109.129.180]) by\n\teusmtip1.samsung.com (KnoxPortal) with ESMTPA id\n\t20181214123714eusmtip1e3b2aad4b06932eda8bd92a4856cbd2b~wM0L7vh7t1016210162eusmtip1N;\n\tFri, 14 Dec 2018 12:37:14 +0000 (GMT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com\n\t20181214123717euoutp02a9b5725dec471fe2e30780ff24443392~wM0OSYefL2228722287euoutp02G",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;\n\ts=mail20170921; t=1544791037;\n\tbh=Yrmy3vkEjGLWTp3RsdrjbelwJVN/KAQBk+pLqRR+gr8=;\n\th=From:To:Cc:Subject:Date:References:From;\n\tb=E4aCkhztwuQy9mHNiBdQC+jt1uiyDNU18RDDyT0G/1ao5NX5wXEKl603U5Sku7AGX\n\tOFfFzUZuSLdknEognb3vCEogT9cOrKsO18/k8Rp3J7AUAmIiWOo+bub80NtqDRjms1\n\t1pkrY2Vib5p0OiANyAYRlr8RkHXR8ip0KoHzl37U=",
        "X-AuditID": "cbfec7f5-367ff700000012c6-d4-5c13a3fce016",
        "From": "Ilya Maximets <i.maximets@samsung.com>",
        "To": "dev@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>, \"Michael S .\n\tTsirkin\" <mst@redhat.com>, Xiao Wang <xiao.w.wang@intel.com>",
        "Cc": "Tiwei Bie <tiwei.bie@intel.com>, Zhihong Wang <zhihong.wang@intel.com>, \n\tjfreimann@redhat.com, Jason Wang <jasowang@redhat.com>,\n\txiaolong.ye@intel.com, alejandro.lucero@netronome.com, Ilya Maximets\n\t<i.maximets@samsung.com>, stable@dpdk.org",
        "Date": "Fri, 14 Dec 2018 15:37:04 +0300",
        "Message-Id": "<20181214123704.20110-1-i.maximets@samsung.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "X-Brightmail-Tracker": [
            "H4sIAAAAAAAAA+NgFupgleLIzCtJLcpLzFFi42LZduznOd0/i4VjDE5t1bc492kZk8W7T9uZ\n\tLK60/2S3WHbpM5PFuTVLWSyOde5hsfj/6xWrxb+OP+wWWxv+M1nsf36Y3eLPG1OLzRcnMTnw\n\tePxasJTVY/Gel0we07sfMnu833eVzaNvyyrGANYoLpuU1JzMstQifbsEroz7e++xFhw3r2i8\n\tcY21gfGhbhcjJ4eEgInE2l+9rF2MXBxCAisYJV5P+84E4XxhlGjceIgZwvnMKNHyYw07TMuS\n\t1uNQieWMEmd+t7BBOD8YJXqWzWQDqWIT0JE4tfoII0hCRKCbUeLV089gVcwgVRM2NrOCVAkL\n\tmErsm/MDrINFQFXi2cJjjCA2r4C1RMfer8wQ++QlVm84ALZPQuA/m8TUCa/ZIBIuEl+ezmOB\n\tsIUlXh3fAnWgjMT/nfOZIOx6ifstLxkhmjsYJaYf+geVsJfY8vocUAMH0EmaEut36UOEHSUa\n\tel+AhSUE+CRuvBUECTMDmZO2TWeGCPNKdLQJQVSrSPw+uBzqTCmJm+8+A3WyA9keEv8iQaJC\n\tArESz5s2sE1glJuFsGkBI+MqRvHU0uLc9NRi47zUcr3ixNzi0rx0veT83E2MwPRx+t/xrzsY\n\t9/1JOsQowMGoxMN7YrZQjBBrYllxZe4hRgkOZiUR3rBW4Rgh3pTEyqrUovz4otKc1OJDjNIc\n\tLErivNUMD6KFBNITS1KzU1MLUotgskwcnFINjGHTeK6JZNks+d/Ek+DyQPr/3b0lr3sSJ8yd\n\tKdlm6iHZeE81yT5+z8OWqTcdv4g169116et1mMjuvd7N3u69b2zdOV8lxw2XIwU3cAX83Kml\n\t4zPvRlJh3a1DORtPzo4+k/bxtOfRawUG/ZJxq11/XZoz8+hTj1S9D0mLt7i5q6w9WFHLvnex\n\tpRJLcUaioRZzUXEiANBNBNEbAwAA",
            "H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsVy+t/xu7q/FwvHGHy7rm9x7tMyJot3n7Yz\n\tWVxp/8lusezSZyaLc2uWslgc69zDYvH/1ytWi38df9gttjb8Z7LY//wwu8WfN6YWmy9OYnLg\n\t8fi1YCmrx+I9L5k8pnc/ZPZ4v+8qm0ffllWMAaxRejZF+aUlqQoZ+cUltkrRhhZGeoaWFnpG\n\tJpZ6hsbmsVZGpkr6djYpqTmZZalF+nYJehn3995jLThuXtF44xprA+ND3S5GTg4JAROJJa3H\n\tmbsYuTiEBJYySjzd95QFIiEl8ePXBVYIW1jiz7UuNoiib4wS+y4eZQJJsAnoSJxafYQRJCEi\n\t0M8osfv6TbBRzAINTBIzZu4GGyUsYCqxb84PNhCbRUBV4tnCY4wgNq+AtUTH3q/MECvkJVZv\n\tOMA8gZFnASPDKkaR1NLi3PTcYiO94sTc4tK8dL3k/NxNjMDQ3Xbs55YdjF3vgg8xCnAwKvHw\n\tHpgiFCPEmlhWXJl7iFGCg1lJhDesVThGiDclsbIqtSg/vqg0J7X4EKMp0PKJzFKiyfnAuMor\n\tiTc0NTS3sDQ0NzY3NrNQEuc9b1AZJSSQnliSmp2aWpBaBNPHxMEp1cCYvzxxSvznp+lNFt7Z\n\t+81qZx5bseanhvbc6Gbp96cWWylapL+u1LA8n8fI1v1UsjZxipuWRFSqEIPi/CDJycfEDx1Z\n\tJ3rqYvbunVLHtSuZZa4cvSVR2X7rw01WiTcbc/+culeW4usmNO370vmXL314sHkv64MrR04b\n\tpgad/51XILd4F7O47j8zJZbijERDLeai4kQAcSsKQ3MCAAA="
        ],
        "X-CMS-MailID": "20181214123716eucas1p2928654e37999b8fc32899eed326a3581",
        "X-Msg-Generator": "CA",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "X-RootMTR": "20181214123716eucas1p2928654e37999b8fc32899eed326a3581",
        "X-EPHeader": "CA",
        "CMS-TYPE": "201P",
        "X-CMS-RootMailID": "20181214123716eucas1p2928654e37999b8fc32899eed326a3581",
        "References": "<CGME20181214123716eucas1p2928654e37999b8fc32899eed326a3581@eucas1p2.samsung.com>",
        "Subject": "[dpdk-dev] [RFC] net/virtio: use real barriers for vDPA",
        "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": "SMP barriers are OK for software vhost implementation, but vDPA is a\nDMA capable hardware and we have to use at least DMA barriers to\nensure the memory ordering.\n\nThis patch mimics the kernel virtio-net driver in part of choosing\nbarriers we need.\n\nFixes: a3f8150eac6d (\"net/ifcvf: add ifcvf vDPA driver\")\nCc: stable@dpdk.org\n\nSigned-off-by: Ilya Maximets <i.maximets@samsung.com>\n---\n\nSending as RFC, because the patch is completely not tested. I heve no\nHW to test the real behaviour. And I actually do not know if the\nsubsystem_vendor/device_id's are available at the time and has\nIFCVF_SUBSYS_* values inside the real guest system.\n\nOne more thing I want to mention that cross net client Live Migration\nis actually not possible without any support from the guest driver.\nBecause migration from the software vhost to vDPA will lead to using\nweaker barriers than required.\n\nThe similar change (weak_barriers = false) should be made in the linux\nkernel virtio-net driver.\n\nAnother dirty solution could be to restrict the vDPA support to x86\nsystems only.\n\n drivers/net/virtio/virtio_ethdev.c      |  9 +++++++\n drivers/net/virtio/virtio_pci.h         |  1 +\n drivers/net/virtio/virtio_rxtx.c        | 14 +++++-----\n drivers/net/virtio/virtio_user_ethdev.c |  1 +\n drivers/net/virtio/virtqueue.h          | 35 +++++++++++++++++++++----\n 5 files changed, 48 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c\nindex cb2b2e0bf..249b536fd 100644\n--- a/drivers/net/virtio/virtio_ethdev.c\n+++ b/drivers/net/virtio/virtio_ethdev.c\n@@ -1448,6 +1448,9 @@ virtio_configure_intr(struct rte_eth_dev *dev)\n \treturn 0;\n }\n \n+#define IFCVF_SUBSYS_VENDOR_ID\t0x8086\n+#define IFCVF_SUBSYS_DEVICE_ID\t0x001A\n+\n /* reset device and renegotiate features if needed */\n static int\n virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n@@ -1477,6 +1480,12 @@ virtio_init_device(struct rte_eth_dev *eth_dev, uint64_t req_features)\n \tif (!hw->virtio_user_dev) {\n \t\tpci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);\n \t\trte_eth_copy_pci_info(eth_dev, pci_dev);\n+\n+\t\tif (pci_dev->id.subsystem_vendor_id == IFCVF_SUBSYS_VENDOR_ID &&\n+\t\t    pci_dev->id.subsystem_device_id == IFCVF_SUBSYS_DEVICE_ID)\n+\t\t\thw->weak_barriers = 0;\n+\t\telse\n+\t\t\thw->weak_barriers = 1;\n \t}\n \n \t/* If host does not support both status and MSI-X then disable LSC */\ndiff --git a/drivers/net/virtio/virtio_pci.h b/drivers/net/virtio/virtio_pci.h\nindex e961a58ca..1f8e719a9 100644\n--- a/drivers/net/virtio/virtio_pci.h\n+++ b/drivers/net/virtio/virtio_pci.h\n@@ -240,6 +240,7 @@ struct virtio_hw {\n \tuint8_t     use_simple_rx;\n \tuint8_t     use_inorder_rx;\n \tuint8_t     use_inorder_tx;\n+\tuint8_t     weak_barriers;\n \tbool        has_tx_offload;\n \tbool        has_rx_offload;\n \tuint16_t    port_id;\ndiff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c\nindex cb8f89f18..66195bf47 100644\n--- a/drivers/net/virtio/virtio_rxtx.c\n+++ b/drivers/net/virtio/virtio_rxtx.c\n@@ -906,7 +906,7 @@ virtio_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)\n \n \tnb_used = VIRTQUEUE_NUSED(vq);\n \n-\tvirtio_rmb();\n+\tvirtio_rmb(hw->weak_barriers);\n \n \tnum = likely(nb_used <= nb_pkts) ? nb_used : nb_pkts;\n \tif (unlikely(num > VIRTIO_MBUF_BURST_SZ))\n@@ -1017,7 +1017,7 @@ virtio_recv_mergeable_pkts_inorder(void *rx_queue,\n \tnb_used = RTE_MIN(nb_used, nb_pkts);\n \tnb_used = RTE_MIN(nb_used, VIRTIO_MBUF_BURST_SZ);\n \n-\tvirtio_rmb();\n+\tvirtio_rmb(hw->weak_barriers);\n \n \tPMD_RX_LOG(DEBUG, \"used:%d\", nb_used);\n \n@@ -1202,7 +1202,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,\n \n \tnb_used = VIRTQUEUE_NUSED(vq);\n \n-\tvirtio_rmb();\n+\tvirtio_rmb(hw->weak_barriers);\n \n \tPMD_RX_LOG(DEBUG, \"used:%d\", nb_used);\n \n@@ -1365,7 +1365,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n \tPMD_TX_LOG(DEBUG, \"%d packets to xmit\", nb_pkts);\n \tnb_used = VIRTQUEUE_NUSED(vq);\n \n-\tvirtio_rmb();\n+\tvirtio_rmb(hw->weak_barriers);\n \tif (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))\n \t\tvirtio_xmit_cleanup(vq, nb_used);\n \n@@ -1407,7 +1407,7 @@ virtio_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n \t\t/* Positive value indicates it need free vring descriptors */\n \t\tif (unlikely(need > 0)) {\n \t\t\tnb_used = VIRTQUEUE_NUSED(vq);\n-\t\t\tvirtio_rmb();\n+\t\t\tvirtio_rmb(hw->weak_barriers);\n \t\t\tneed = RTE_MIN(need, (int)nb_used);\n \n \t\t\tvirtio_xmit_cleanup(vq, need);\n@@ -1463,7 +1463,7 @@ virtio_xmit_pkts_inorder(void *tx_queue,\n \tPMD_TX_LOG(DEBUG, \"%d packets to xmit\", nb_pkts);\n \tnb_used = VIRTQUEUE_NUSED(vq);\n \n-\tvirtio_rmb();\n+\tvirtio_rmb(hw->weak_barriers);\n \tif (likely(nb_used > vq->vq_nentries - vq->vq_free_thresh))\n \t\tvirtio_xmit_cleanup_inorder(vq, nb_used);\n \n@@ -1511,7 +1511,7 @@ virtio_xmit_pkts_inorder(void *tx_queue,\n \t\tneed = slots - vq->vq_free_cnt;\n \t\tif (unlikely(need > 0)) {\n \t\t\tnb_used = VIRTQUEUE_NUSED(vq);\n-\t\t\tvirtio_rmb();\n+\t\t\tvirtio_rmb(hw->weak_barriers);\n \t\t\tneed = RTE_MIN(need, (int)nb_used);\n \n \t\t\tvirtio_xmit_cleanup_inorder(vq, need);\ndiff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c\nindex f8791391a..f075774b4 100644\n--- a/drivers/net/virtio/virtio_user_ethdev.c\n+++ b/drivers/net/virtio/virtio_user_ethdev.c\n@@ -434,6 +434,7 @@ virtio_user_eth_dev_alloc(struct rte_vdev_device *vdev)\n \thw->use_simple_rx = 0;\n \thw->use_inorder_rx = 0;\n \thw->use_inorder_tx = 0;\n+\thw->weak_barriers = 1;\n \thw->virtio_user_dev = dev;\n \treturn eth_dev;\n }\ndiff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h\nindex 26518ed98..7bf17d3bf 100644\n--- a/drivers/net/virtio/virtqueue.h\n+++ b/drivers/net/virtio/virtqueue.h\n@@ -19,15 +19,40 @@\n struct rte_mbuf;\n \n /*\n- * Per virtio_config.h in Linux.\n+ * Per virtio_ring.h in Linux.\n  *     For virtio_pci on SMP, we don't need to order with respect to MMIO\n  *     accesses through relaxed memory I/O windows, so smp_mb() et al are\n  *     sufficient.\n  *\n+ *     For using virtio to talk to real devices (eg. vDPA) we do need real\n+ *     barriers.\n  */\n-#define virtio_mb()\trte_smp_mb()\n-#define virtio_rmb()\trte_smp_rmb()\n-#define virtio_wmb()\trte_smp_wmb()\n+static inline void\n+virtio_mb(uint8_t weak_barriers)\n+{\n+\tif (weak_barriers)\n+\t\trte_smp_mb();\n+\telse\n+\t\trte_mb();\n+}\n+\n+static inline void\n+virtio_rmb(uint8_t weak_barriers)\n+{\n+\tif (weak_barriers)\n+\t\trte_smp_rmb();\n+\telse\n+\t\trte_cio_rmb();\n+}\n+\n+static inline void\n+virtio_wmb(uint8_t weak_barriers)\n+{\n+\tif (weak_barriers)\n+\t\trte_smp_wmb();\n+\telse\n+\t\trte_cio_wmb();\n+}\n \n #ifdef RTE_PMD_PACKET_PREFETCH\n #define rte_packet_prefetch(p)  rte_prefetch1(p)\n@@ -312,7 +337,7 @@ void vq_ring_free_inorder(struct virtqueue *vq, uint16_t desc_idx,\n static inline void\n vq_update_avail_idx(struct virtqueue *vq)\n {\n-\tvirtio_wmb();\n+\tvirtio_wmb(vq->hw->weak_barriers);\n \tvq->vq_ring.avail->idx = vq->vq_avail_idx;\n }\n \n",
    "prefixes": [
        "RFC"
    ]
}