get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 120497,
    "url": "http://patches.dpdk.org/api/patches/120497/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20221206150509.772408-1-mkp@redhat.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": "<20221206150509.772408-1-mkp@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221206150509.772408-1-mkp@redhat.com",
    "date": "2022-12-06T15:05:09",
    "name": "[v2] vhost: exclude VM hugepages from coredumps",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "cca9e7bffd50d122df3662bf22594dd1e162ca8b",
    "submitter": {
        "id": 2561,
        "url": "http://patches.dpdk.org/api/people/2561/?format=api",
        "name": "Mike Pattrick",
        "email": "mkp@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20221206150509.772408-1-mkp@redhat.com/mbox/",
    "series": [
        {
            "id": 26021,
            "url": "http://patches.dpdk.org/api/series/26021/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=26021",
            "date": "2022-12-06T15:05:09",
            "name": "[v2] vhost: exclude VM hugepages from coredumps",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/26021/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/120497/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/120497/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 89B0FA054A;\n\tTue,  6 Dec 2022 16:05:43 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 36FBC40687;\n\tTue,  6 Dec 2022 16:05:43 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id 5798F4021D\n for <dev@dpdk.org>; Tue,  6 Dec 2022 16:05:42 +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-342-yUsAHSzENPWIAyaUWwGXXw-1; Tue, 06 Dec 2022 10:05:39 -0500",
            "from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com\n [10.11.54.3])\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 16C2388283B;\n Tue,  6 Dec 2022 15:05:36 +0000 (UTC)",
            "from mpattric.remote.csb (unknown [10.22.32.61])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 9CF54112131B;\n Tue,  6 Dec 2022 15:05:35 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1670339141;\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=HME/2Oofj4CKyjvkHRDCeR/R8QueJL86OUfxDBup1w8=;\n b=dcMi6G+YqRkWhu8u5J2LYK+W1VYpmOts17vJi4bsPjNE0Xsi/GID9m3mvmbhr0eZwpScjZ\n VRWGOYLmTkjSWZLlqPwW6qwqm74P5u6w646zLkwsecER1NRC6aE7sU3KDpVYwJrwWaW+AU\n Zssk3K6bQS+ZFhMm8wjFiB8Ry3Cf/YY=",
        "X-MC-Unique": "yUsAHSzENPWIAyaUWwGXXw-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 v2] vhost: exclude VM hugepages from coredumps",
        "Date": "Tue,  6 Dec 2022 10:05:09 -0500",
        "Message-Id": "<20221206150509.772408-1-mkp@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.1 on 10.11.54.3",
        "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---\nv2:\n* Removed warning on unsupported platforms\n\n---\n lib/vhost/iotlb.c      |  5 +++++\n lib/vhost/vhost.h      | 12 ++++++++++++\n lib/vhost/vhost_user.c | 10 ++++++++++\n 3 files changed, 27 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..1f913803f6 100644\n--- a/lib/vhost/vhost.h\n+++ b/lib/vhost/vhost.h\n@@ -13,6 +13,7 @@\n #include <linux/virtio_net.h>\n #include <sys/socket.h>\n #include <linux/if.h>\n+#include <sys/mman.h>\n \n #include <rte_log.h>\n #include <rte_ether.h>\n@@ -987,4 +988,15 @@ mbuf_is_consumed(struct rte_mbuf *m)\n \n \treturn true;\n }\n+\n+static __rte_always_inline void\n+mem_set_dump(__rte_unused void *ptr, __rte_unused size_t size, __rte_unused 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": [
        "v2"
    ]
}