get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 817374,
    "url": "http://patchwork.ozlabs.org/api/patches/817374/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1506067355-5771-3-git-send-email-jasowang@redhat.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1506067355-5771-3-git-send-email-jasowang@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-22T08:02:32",
    "name": "[net-next,RFC,2/5] vhost: introduce helper to prefetch desc index",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "6b8de41dd2c78474e5902f60d8c18a51894b9d16",
    "submitter": {
        "id": 5225,
        "url": "http://patchwork.ozlabs.org/api/people/5225/?format=api",
        "name": "Jason Wang",
        "email": "jasowang@redhat.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1506067355-5771-3-git-send-email-jasowang@redhat.com/mbox/",
    "series": [
        {
            "id": 4565,
            "url": "http://patchwork.ozlabs.org/api/series/4565/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4565",
            "date": "2017-09-22T08:02:35",
            "name": "batched tx processing in vhost_net",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/4565/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/817374/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/817374/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=jasowang@redhat.com"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xz5bB6KJlz9sNc\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 22 Sep 2017 18:03:50 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752013AbdIVIC4 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 04:02:56 -0400",
            "from mx1.redhat.com ([209.132.183.28]:55846 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751995AbdIVICv (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 22 Sep 2017 04:02:51 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2DBA3C0546D1;\n\tFri, 22 Sep 2017 08:02:51 +0000 (UTC)",
            "from jason-ThinkPad-T450s.redhat.com (ovpn-12-19.pek2.redhat.com\n\t[10.72.12.19])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id D7AA962679;\n\tFri, 22 Sep 2017 08:02:47 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 2DBA3C0546D1",
        "From": "Jason Wang <jasowang@redhat.com>",
        "To": "mst@redhat.com, jasowang@redhat.com,\n\tvirtualization@lists.linux-foundation.org, netdev@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org",
        "Cc": "kvm@vger.kernel.org",
        "Subject": "[PATCH net-next RFC 2/5] vhost: introduce helper to prefetch desc\n\tindex",
        "Date": "Fri, 22 Sep 2017 16:02:32 +0800",
        "Message-Id": "<1506067355-5771-3-git-send-email-jasowang@redhat.com>",
        "In-Reply-To": "<1506067355-5771-1-git-send-email-jasowang@redhat.com>",
        "References": "<1506067355-5771-1-git-send-email-jasowang@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tFri, 22 Sep 2017 08:02:51 +0000 (UTC)",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "This patch introduces vhost_prefetch_desc_indices() which could batch\ndescriptor indices fetching and used ring updating. This intends to\nreduce the cache misses of indices fetching and updating and reduce\ncache line bounce when virtqueue is almost full. copy_to_user() was\nused in order to benefit from modern cpus that support fast string\ncopy. Batched virtqueue processing will be the first user.\n\nSigned-off-by: Jason Wang <jasowang@redhat.com>\n---\n drivers/vhost/vhost.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++\n drivers/vhost/vhost.h |  3 +++\n 2 files changed, 58 insertions(+)",
    "diff": "diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c\nindex f87ec75..8424166d 100644\n--- a/drivers/vhost/vhost.c\n+++ b/drivers/vhost/vhost.c\n@@ -2437,6 +2437,61 @@ struct vhost_msg_node *vhost_dequeue_msg(struct vhost_dev *dev,\n }\n EXPORT_SYMBOL_GPL(vhost_dequeue_msg);\n \n+int vhost_prefetch_desc_indices(struct vhost_virtqueue *vq,\n+\t\t\t\tstruct vring_used_elem *heads,\n+\t\t\t\tu16 num, bool used_update)\n+{\n+\tint ret, ret2;\n+\tu16 last_avail_idx, last_used_idx, total, copied;\n+\t__virtio16 avail_idx;\n+\tstruct vring_used_elem __user *used;\n+\tint i;\n+\n+\tif (unlikely(vhost_get_avail(vq, avail_idx, &vq->avail->idx))) {\n+\t\tvq_err(vq, \"Failed to access avail idx at %p\\n\",\n+\t\t       &vq->avail->idx);\n+\t\treturn -EFAULT;\n+\t}\n+\tlast_avail_idx = vq->last_avail_idx & (vq->num - 1);\n+\tvq->avail_idx = vhost16_to_cpu(vq, avail_idx);\n+\ttotal = vq->avail_idx - vq->last_avail_idx;\n+\tret = total = min(total, num);\n+\n+\tfor (i = 0; i < ret; i++) {\n+\t\tret2 = vhost_get_avail(vq, heads[i].id,\n+\t\t\t\t      &vq->avail->ring[last_avail_idx]);\n+\t\tif (unlikely(ret2)) {\n+\t\t\tvq_err(vq, \"Failed to get descriptors\\n\");\n+\t\t\treturn -EFAULT;\n+\t\t}\n+\t\tlast_avail_idx = (last_avail_idx + 1) & (vq->num - 1);\n+\t}\n+\n+\tif (!used_update)\n+\t\treturn ret;\n+\n+\tlast_used_idx = vq->last_used_idx & (vq->num - 1);\n+\twhile (total) {\n+\t\tcopied = min((u16)(vq->num - last_used_idx), total);\n+\t\tret2 = vhost_copy_to_user(vq,\n+\t\t\t\t\t  &vq->used->ring[last_used_idx],\n+\t\t\t\t\t  &heads[ret - total],\n+\t\t\t\t\t  copied * sizeof(*used));\n+\n+\t\tif (unlikely(ret2)) {\n+\t\t\tvq_err(vq, \"Failed to update used ring!\\n\");\n+\t\t\treturn -EFAULT;\n+\t\t}\n+\n+\t\tlast_used_idx = 0;\n+\t\ttotal -= copied;\n+\t}\n+\n+\t/* Only get avail ring entries after they have been exposed by guest. */\n+\tsmp_rmb();\n+\treturn ret;\n+}\n+EXPORT_SYMBOL(vhost_prefetch_desc_indices);\n \n static int __init vhost_init(void)\n {\ndiff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h\nindex 39ff897..16c2cb6 100644\n--- a/drivers/vhost/vhost.h\n+++ b/drivers/vhost/vhost.h\n@@ -228,6 +228,9 @@ ssize_t vhost_chr_read_iter(struct vhost_dev *dev, struct iov_iter *to,\n ssize_t vhost_chr_write_iter(struct vhost_dev *dev,\n \t\t\t     struct iov_iter *from);\n int vhost_init_device_iotlb(struct vhost_dev *d, bool enabled);\n+int vhost_prefetch_desc_indices(struct vhost_virtqueue *vq,\n+\t\t\t\tstruct vring_used_elem *heads,\n+\t\t\t\tu16 num, bool used_update);\n \n #define vq_err(vq, fmt, ...) do {                                  \\\n \t\tpr_debug(pr_fmt(fmt), ##__VA_ARGS__);       \\\n",
    "prefixes": [
        "net-next",
        "RFC",
        "2/5"
    ]
}