get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 120467,
    "url": "http://patchwork.dpdk.org/api/patches/120467/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20221206044616.725392-1-mkp@redhat.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20221206044616.725392-1-mkp@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221206044616.725392-1-mkp@redhat.com",
    "date": "2022-12-06T04:46:16",
    "name": "vhost: exclude VM hugepages from coredumps",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e4c4974812108f800f9f42ed9b1f294897af2896",
    "submitter": {
        "id": 2561,
        "url": "http://patchwork.dpdk.org/api/people/2561/?format=api",
        "name": "Mike Pattrick",
        "email": "mkp@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20221206044616.725392-1-mkp@redhat.com/mbox/",
    "series": [
        {
            "id": 26004,
            "url": "http://patchwork.dpdk.org/api/series/26004/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=26004",
            "date": "2022-12-06T04:46:16",
            "name": "vhost: exclude VM hugepages from coredumps",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/26004/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/120467/comments/",
    "check": "fail",
    "checks": "http://patchwork.dpdk.org/api/patches/120467/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 9333BA0552;\n\tTue,  6 Dec 2022 05:46:28 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3C0EE40156;\n\tTue,  6 Dec 2022 05:46:28 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id C174B40151\n for <dev@dpdk.org>; Tue,  6 Dec 2022 05:46:26 +0100 (CET)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-459-Xhl0IRxsOP-z2JTFteJQ2g-1; Mon, 05 Dec 2022 23:46:24 -0500",
            "from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com\n [10.11.54.9])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B90E7833A09;\n Tue,  6 Dec 2022 04:46:23 +0000 (UTC)",
            "from mpattric.remote.csb (unknown [10.22.32.61])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 3170D477F55;\n Tue,  6 Dec 2022 04:46:23 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1670301985;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=SxKQHpa8xvJbJUKM/WW8UuAZ2ga2t/gUf8ULlJWxycs=;\n b=GeLdGUZT0fIqr4F4m+adjLq+B+yM02EqORCaXoWckGTBTtQQzDHxol1C6BCKnFn1LQfi9f\n JEOCf1fISm8cXj7hHajKOW0otRvEbNnytz070TNvQjlxuUkxgwG+SNNbg2Ng/fLnCUcDez\n 8phDUmOnyTV3Yqfi2z4EZpFUOGlTazY=",
        "X-MC-Unique": "Xhl0IRxsOP-z2JTFteJQ2g-1",
        "From": "Mike Pattrick <mkp@redhat.com>",
        "To": "Maxime Coquelin <maxime.coquelin@redhat.com>,\n Chenbo Xia <chenbo.xia@intel.com>",
        "Cc": "dev@dpdk.org,\n\tMike Pattrick <mkp@redhat.com>",
        "Subject": "[PATCH] vhost: exclude VM hugepages from coredumps",
        "Date": "Mon,  5 Dec 2022 23:46:16 -0500",
        "Message-Id": "<20221206044616.725392-1-mkp@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.9",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "Currently if an application wants to include shared hugepages in\ncoredumps in conjunction with the vhost library, the coredump will be\nlarger than expected and include unneeded virtual machine memory.\n\nThis patch will mark all vhost huge pages as DONTDUMP, except for some\nselect pages used by DPDK.\n\nSigned-off-by: Mike Pattrick <mkp@redhat.com>\n---\n lib/vhost/iotlb.c      |  5 +++++\n lib/vhost/vhost.h      | 11 +++++++++++\n lib/vhost/vhost_user.c | 10 ++++++++++\n 3 files changed, 26 insertions(+)",
    "diff": "diff --git a/lib/vhost/iotlb.c b/lib/vhost/iotlb.c\nindex 6a729e8804..2f89f88817 100644\n--- a/lib/vhost/iotlb.c\n+++ b/lib/vhost/iotlb.c\n@@ -149,6 +149,7 @@ vhost_user_iotlb_cache_remove_all(struct vhost_virtqueue *vq)\n \trte_rwlock_write_lock(&vq->iotlb_lock);\n \n \tRTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {\n+\t\tmem_set_dump((void *)node->uaddr, node->size, true);\n \t\tTAILQ_REMOVE(&vq->iotlb_list, node, next);\n \t\tvhost_user_iotlb_pool_put(vq, node);\n \t}\n@@ -170,6 +171,7 @@ vhost_user_iotlb_cache_random_evict(struct vhost_virtqueue *vq)\n \n \tRTE_TAILQ_FOREACH_SAFE(node, &vq->iotlb_list, next, temp_node) {\n \t\tif (!entry_idx) {\n+\t\t\tmem_set_dump((void *)node->uaddr, node->size, true);\n \t\t\tTAILQ_REMOVE(&vq->iotlb_list, node, next);\n \t\t\tvhost_user_iotlb_pool_put(vq, node);\n \t\t\tvq->iotlb_cache_nr--;\n@@ -222,12 +224,14 @@ vhost_user_iotlb_cache_insert(struct virtio_net *dev, struct vhost_virtqueue *vq\n \t\t\tvhost_user_iotlb_pool_put(vq, new_node);\n \t\t\tgoto unlock;\n \t\t} else if (node->iova > new_node->iova) {\n+\t\t\tmem_set_dump((void *)node->uaddr, node->size, true);\n \t\t\tTAILQ_INSERT_BEFORE(node, new_node, next);\n \t\t\tvq->iotlb_cache_nr++;\n \t\t\tgoto unlock;\n \t\t}\n \t}\n \n+\tmem_set_dump((void *)node->uaddr, node->size, true);\n \tTAILQ_INSERT_TAIL(&vq->iotlb_list, new_node, next);\n \tvq->iotlb_cache_nr++;\n \n@@ -255,6 +259,7 @@ vhost_user_iotlb_cache_remove(struct vhost_virtqueue *vq,\n \t\t\tbreak;\n \n \t\tif (iova < node->iova + node->size) {\n+\t\t\tmem_set_dump((void *)node->uaddr, node->size, true);\n \t\t\tTAILQ_REMOVE(&vq->iotlb_list, node, next);\n \t\t\tvhost_user_iotlb_pool_put(vq, node);\n \t\t\tvq->iotlb_cache_nr--;\ndiff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h\nindex ef211ed519..09e1d5d97b 100644\n--- a/lib/vhost/vhost.h\n+++ b/lib/vhost/vhost.h\n@@ -987,4 +987,15 @@ mbuf_is_consumed(struct rte_mbuf *m)\n \n \treturn true;\n }\n+\n+static __rte_always_inline void\n+mem_set_dump(void *ptr, size_t size, bool enable)\n+{\n+#ifdef MADV_DONTDUMP\n+\tif (madvise(ptr, size, enable ? MADV_DODUMP : MADV_DONTDUMP) == -1) {\n+\t\trte_log(RTE_LOG_INFO, vhost_config_log_level,\n+\t\t\t\"VHOST_CONFIG: could not set coredump preference (%s).\\n\", strerror(errno));\n+\t}\n+#endif\n+}\n #endif /* _VHOST_NET_CDEV_H_ */\ndiff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c\nindex 9902ae9944..8f33d5f4d9 100644\n--- a/lib/vhost/vhost_user.c\n+++ b/lib/vhost/vhost_user.c\n@@ -793,6 +793,9 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)\n \t\t\treturn;\n \t\t}\n \n+\t\tmem_set_dump(vq->desc_packed, len, true);\n+\t\tmem_set_dump(vq->driver_event, len, true);\n+\t\tmem_set_dump(vq->device_event, len, true);\n \t\tvq->access_ok = true;\n \t\treturn;\n \t}\n@@ -846,6 +849,9 @@ translate_ring_addresses(struct virtio_net **pdev, struct vhost_virtqueue **pvq)\n \t\t\t\"some packets maybe resent for Tx and dropped for Rx\\n\");\n \t}\n \n+\tmem_set_dump(vq->desc, len, true);\n+\tmem_set_dump(vq->avail, len, true);\n+\tmem_set_dump(vq->used, len, true);\n \tvq->access_ok = true;\n \n \tVHOST_LOG_CONFIG(dev->ifname, DEBUG, \"mapped address desc: %p\\n\", vq->desc);\n@@ -1224,6 +1230,7 @@ vhost_user_mmap_region(struct virtio_net *dev,\n \tregion->mmap_addr = mmap_addr;\n \tregion->mmap_size = mmap_size;\n \tregion->host_user_addr = (uint64_t)(uintptr_t)mmap_addr + mmap_offset;\n+\tmem_set_dump(mmap_addr, mmap_size, false);\n \n \tif (dev->async_copy) {\n \t\tif (add_guest_pages(dev, region, alignment) < 0) {\n@@ -1528,6 +1535,7 @@ inflight_mem_alloc(struct virtio_net *dev, const char *name, size_t size, int *f\n \t\treturn NULL;\n \t}\n \n+\tmem_set_dump(ptr, size, false);\n \t*fd = mfd;\n \treturn ptr;\n }\n@@ -1736,6 +1744,7 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev,\n \t\tdev->inflight_info->fd = -1;\n \t}\n \n+\tmem_set_dump(addr, mmap_size, false);\n \tdev->inflight_info->fd = fd;\n \tdev->inflight_info->addr = addr;\n \tdev->inflight_info->size = mmap_size;\n@@ -2283,6 +2292,7 @@ vhost_user_set_log_base(struct virtio_net **pdev,\n \tdev->log_addr = (uint64_t)(uintptr_t)addr;\n \tdev->log_base = dev->log_addr + off;\n \tdev->log_size = size;\n+\tmem_set_dump(addr, size, false);\n \n \tfor (i = 0; i < dev->nr_vring; i++) {\n \t\tstruct vhost_virtqueue *vq = dev->virtqueue[i];\n",
    "prefixes": []
}