get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 44291,
    "url": "http://patches.dpdk.org/api/patches/44291/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180905042852.6212-4-tiwei.bie@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": "<20180905042852.6212-4-tiwei.bie@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180905042852.6212-4-tiwei.bie@intel.com",
    "date": "2018-09-05T04:28:52",
    "name": "[3/3] net/virtio-user: fix memory hotplug support in vhost-kernel",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7eb0c11da08fcea6b54b761b93644505a9aa78b2",
    "submitter": {
        "id": 617,
        "url": "http://patches.dpdk.org/api/people/617/?format=api",
        "name": "Tiwei Bie",
        "email": "tiwei.bie@intel.com"
    },
    "delegate": {
        "id": 2642,
        "url": "http://patches.dpdk.org/api/users/2642/?format=api",
        "username": "mcoquelin",
        "first_name": "Maxime",
        "last_name": "Coquelin",
        "email": "maxime.coquelin@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180905042852.6212-4-tiwei.bie@intel.com/mbox/",
    "series": [
        {
            "id": 1180,
            "url": "http://patches.dpdk.org/api/series/1180/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1180",
            "date": "2018-09-05T04:28:49",
            "name": "Some fixes/improvements for virtio-user memory table",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1180/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/44291/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/44291/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 311FB3772;\n\tWed,  5 Sep 2018 06:31:07 +0200 (CEST)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n\tby dpdk.org (Postfix) with ESMTP id AA974F11;\n\tWed,  5 Sep 2018 06:31:02 +0200 (CEST)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Sep 2018 21:31:00 -0700",
            "from btwcube1.sh.intel.com ([10.67.104.194])\n\tby fmsmga008.fm.intel.com with ESMTP; 04 Sep 2018 21:29:50 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.53,332,1531810800\"; d=\"scan'208\";a=\"68456353\"",
        "From": "Tiwei Bie <tiwei.bie@intel.com>",
        "To": "maxime.coquelin@redhat.com,\n\tzhihong.wang@intel.com,\n\tdev@dpdk.org",
        "Cc": "seanbh@gmail.com,\n\tanatoly.burakov@intel.com,\n\tstable@dpdk.org",
        "Date": "Wed,  5 Sep 2018 12:28:52 +0800",
        "Message-Id": "<20180905042852.6212-4-tiwei.bie@intel.com>",
        "X-Mailer": "git-send-email 2.18.0",
        "In-Reply-To": "<20180905042852.6212-1-tiwei.bie@intel.com>",
        "References": "<20180905042852.6212-1-tiwei.bie@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 3/3] net/virtio-user: fix memory hotplug support\n\tin vhost-kernel",
        "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": "It's possible to have much more hugepage backed memory regions\nthan what vhost-kernel supports due to the memory hotplug, which\nmay cause problems. A better solution is to have the virtio-user\npass all the memory ranges reserved by DPDK to vhost-kernel.\n\nFixes: 12ecb2f63b12 (\"net/virtio-user: support memory hotplug\")\nCc: stable@dpdk.org\n\nSigned-off-by: Tiwei Bie <tiwei.bie@intel.com>\n---\n drivers/net/virtio/virtio_user/vhost_kernel.c | 38 +++++++++----------\n 1 file changed, 18 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c\nindex 897fee0af..9338166d9 100644\n--- a/drivers/net/virtio/virtio_user/vhost_kernel.c\n+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c\n@@ -70,41 +70,41 @@ static uint64_t vhost_req_user_to_kernel[] = {\n \t[VHOST_USER_SET_MEM_TABLE] = VHOST_SET_MEM_TABLE,\n };\n \n-struct walk_arg {\n-\tstruct vhost_memory_kernel *vm;\n-\tuint32_t region_nr;\n-};\n static int\n-add_memory_region(const struct rte_memseg_list *msl __rte_unused,\n-\t\tconst struct rte_memseg *ms, size_t len, void *arg)\n+add_memseg_list(const struct rte_memseg_list *msl, void *arg)\n {\n-\tstruct walk_arg *wa = arg;\n+\tstruct vhost_memory_kernel *vm = arg;\n \tstruct vhost_memory_region *mr;\n \tvoid *start_addr;\n+\tuint64_t len;\n \n-\tif (wa->region_nr >= max_regions)\n+\tif (vm->nregions >= max_regions)\n \t\treturn -1;\n \n-\tmr = &wa->vm->regions[wa->region_nr++];\n-\tstart_addr = ms->addr;\n+\tstart_addr = msl->base_va;\n+\tlen = msl->page_sz * msl->memseg_arr.len;\n+\n+\tmr = &vm->regions[vm->nregions++];\n \n \tmr->guest_phys_addr = (uint64_t)(uintptr_t)start_addr;\n \tmr->userspace_addr = (uint64_t)(uintptr_t)start_addr;\n \tmr->memory_size = len;\n-\tmr->mmap_offset = 0;\n+\tmr->mmap_offset = 0; /* flags_padding */\n+\n+\tPMD_DRV_LOG(DEBUG, \"index=%u addr=%p len=%\" PRIu64,\n+\t\t\tvm->nregions - 1, start_addr, len);\n \n \treturn 0;\n }\n \n-/* By default, vhost kernel module allows 64 regions, but DPDK allows\n- * 256 segments. As a relief, below function merges those virtually\n- * adjacent memsegs into one region.\n+/* By default, vhost kernel module allows 64 regions, but DPDK may\n+ * have much more memory regions. Below function will treat each\n+ * contiguous memory space reserved by DPDK as one region.\n  */\n static struct vhost_memory_kernel *\n prepare_vhost_memory_kernel(void)\n {\n \tstruct vhost_memory_kernel *vm;\n-\tstruct walk_arg wa;\n \n \tvm = malloc(sizeof(struct vhost_memory_kernel) +\n \t\t\tmax_regions *\n@@ -112,20 +112,18 @@ prepare_vhost_memory_kernel(void)\n \tif (!vm)\n \t\treturn NULL;\n \n-\twa.region_nr = 0;\n-\twa.vm = vm;\n+\tvm->nregions = 0;\n+\tvm->padding = 0;\n \n \t/*\n \t * The memory lock has already been taken by memory subsystem\n \t * or virtio_user_start_device().\n \t */\n-\tif (rte_memseg_contig_walk_thread_unsafe(add_memory_region, &wa) < 0) {\n+\tif (rte_memseg_list_walk_thread_unsafe(add_memseg_list, vm) < 0) {\n \t\tfree(vm);\n \t\treturn NULL;\n \t}\n \n-\tvm->nregions = wa.region_nr;\n-\tvm->padding = 0;\n \treturn vm;\n }\n \n",
    "prefixes": [
        "3/3"
    ]
}