get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 117362,
    "url": "http://patches.dpdk.org/api/patches/117362/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/tencent_0B93F8FCA9FCE91504A8B1BF4396ED766105@qq.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": "<tencent_0B93F8FCA9FCE91504A8B1BF4396ED766105@qq.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/tencent_0B93F8FCA9FCE91504A8B1BF4396ED766105@qq.com",
    "date": "2022-10-05T04:09:49",
    "name": "[v5,07/10] memarea: support backup memory mechanism",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0bc24e60be708103487e4df32f72f3d0ed0181c5",
    "submitter": {
        "id": 2867,
        "url": "http://patches.dpdk.org/api/people/2867/?format=api",
        "name": "datshan",
        "email": "datshan@qq.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/tencent_0B93F8FCA9FCE91504A8B1BF4396ED766105@qq.com/mbox/",
    "series": [
        {
            "id": 24981,
            "url": "http://patches.dpdk.org/api/series/24981/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24981",
            "date": "2022-10-05T04:09:43",
            "name": "[v5,01/10] memarea: introduce memarea library",
            "version": 5,
            "mbox": "http://patches.dpdk.org/series/24981/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/117362/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/117362/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 8F61CA0542;\n\tWed,  5 Oct 2022 06:10:36 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 6F72542686;\n\tWed,  5 Oct 2022 06:10:08 +0200 (CEST)",
            "from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com\n [162.62.57.252]) by mails.dpdk.org (Postfix) with ESMTP id 9518642B6E\n for <dev@dpdk.org>; Wed,  5 Oct 2022 06:10:06 +0200 (CEST)",
            "from qq.com ([120.229.93.179])\n by newxmesmtplogicsvrsza31.qq.com (NewEsmtp) with SMTP\n id 27598E97; Wed, 05 Oct 2022 12:09:53 +0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512;\n t=1664943005; bh=LMmxCGlG6l0rZDAWe4UHhtK6mISXvZkGWi0AQ2eGU3U=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References;\n b=KJUVEJ38bozofYBdmp18chzRbyVtPZkrhX9p3sGLn9RiqBuNneYwOKi9THFoe8rTR\n fX3FTJSPUuUNfaHA+lK14gecrrUqLeXFQtN4fk6KYnnzUu7T2No9/5l1Qb3A13LEKX\n CU0R9d0Mm6WDqL/f3lZttSGNiPOqHPpfeCEzedYY=",
        "X-QQ-mid": "xmsmtpt1664943003thqhk0chq",
        "Message-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/5MBddYh5o0sJJogloAShfE6mX1UOWUXT7U021B+NIPCmFWMsXTnDH7eDBomQGyLIHGJgyd\n 9bnp5bdmL91uzhEHx2bHQwY7s0s9M=",
        "From": "datshan <datshan@qq.com>",
        "To": "david.marchand@redhat.com, mb@smartsharesystems.com,\n anatoly.burakov@intel.com, dmitry.kozliuk@gmail.com, jerinjacobk@gmail.com",
        "Cc": "thomas@monjalon.net, dev@dpdk.org, Chengwen Feng <fengchengwen@huawei.com>",
        "Subject": "[PATCH v5 07/10] memarea: support backup memory mechanism",
        "Date": "Wed,  5 Oct 2022 12:09:49 +0800",
        "X-OQ-MSGID": "<20221005040952.8166-8-datshan@qq.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20221005040952.8166-1-datshan@qq.com>",
        "References": "<20220721044648.6817-1-fengchengwen@huawei.com>\n <20221005040952.8166-1-datshan@qq.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "From: Chengwen Feng <fengchengwen@huawei.com>\n\nThis patch supports backup memory mechanism, the memarea could use\nanother memarea as a backup.\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n doc/guides/prog_guide/memarea_lib.rst |  3 +++\n lib/memarea/memarea_private.h         |  2 ++\n lib/memarea/rte_memarea.c             | 22 ++++++++++++++++++++++\n lib/memarea/rte_memarea.h             |  7 +++++++\n 4 files changed, 34 insertions(+)",
    "diff": "diff --git a/doc/guides/prog_guide/memarea_lib.rst b/doc/guides/prog_guide/memarea_lib.rst\nindex c77012fe44..842d35f77a 100644\n--- a/doc/guides/prog_guide/memarea_lib.rst\n+++ b/doc/guides/prog_guide/memarea_lib.rst\n@@ -25,6 +25,9 @@ The main features are as follows:\n \n * It supports MT-safe as long as it's specified at creation time.\n \n+* It provides backup memory mechanism, the memarea could use another memarea\n+  as a backup.\n+\n Library API Overview\n --------------------\n \ndiff --git a/lib/memarea/memarea_private.h b/lib/memarea/memarea_private.h\nindex 98406879b9..08735ca81f 100644\n--- a/lib/memarea/memarea_private.h\n+++ b/lib/memarea/memarea_private.h\n@@ -23,11 +23,13 @@ struct rte_memarea {\n \tstruct rte_memarea_param init;\n \trte_spinlock_t           lock;\n \tvoid                    *area_addr;\n+\tvoid                    *top_addr;\n \tstruct memarea_elem_list elem_list;\n \tstruct memarea_elem_list free_list;\n \n \tuint64_t alloc_fails;\n \tuint64_t refcnt_check_fails;\n+\tuint64_t bak_alloc_fails;\n } __rte_cache_aligned;\n \n #endif /* MEMAREA_PRIVATE_H */\ndiff --git a/lib/memarea/rte_memarea.c b/lib/memarea/rte_memarea.c\nindex b70830d0bb..f45191aa7f 100644\n--- a/lib/memarea/rte_memarea.c\n+++ b/lib/memarea/rte_memarea.c\n@@ -132,6 +132,7 @@ rte_memarea_create(const struct rte_memarea_param *init)\n \tTAILQ_INIT(&ma->elem_list);\n \tTAILQ_INIT(&ma->free_list);\n \tma->area_addr = addr;\n+\tma->top_addr = (void *)((uintptr_t)addr + init->total_sz - 1);\n \telem = addr;\n \telem->size = init->total_sz - sizeof(struct memarea_elem);\n \telem->cookie = MEMAREA_FREE_ELEM_COOKIE;\n@@ -200,6 +201,15 @@ memarea_add_node(struct rte_memarea *ma, struct memarea_elem *elem, size_t need_\n \telem->size = align_size;\n }\n \n+static inline void *\n+memarea_alloc_backup(struct rte_memarea *ma, size_t size, uint32_t cookie)\n+{\n+\tvoid *ptr = rte_memarea_alloc(ma->init.bak_memarea, size, cookie);\n+\tif (unlikely(ptr == NULL))\n+\t\tma->bak_alloc_fails++;\n+\treturn ptr;\n+}\n+\n void *\n rte_memarea_alloc(struct rte_memarea *ma, size_t size, uint32_t cookie)\n {\n@@ -221,6 +231,8 @@ rte_memarea_alloc(struct rte_memarea *ma, size_t size, uint32_t cookie)\n \t\tptr = (void *)((uintptr_t)elem + sizeof(struct memarea_elem));\n \t\tbreak;\n \t}\n+\tif (ptr == NULL && ma->init.bak_memarea != NULL)\n+\t\tptr = memarea_alloc_backup(ma, size, cookie);\n \tif (unlikely(ptr == NULL))\n \t\tma->alloc_fails++;\n \tmemarea_unlock(ma);\n@@ -283,6 +295,12 @@ rte_memarea_update_refcnt(struct rte_memarea *ma, void *ptr, int16_t value)\n \t\treturn;\n \n \tmemarea_lock(ma);\n+\tif (ptr < ma->area_addr || ptr > ma->top_addr) {\n+\t\trte_memarea_update_refcnt(ma->init.bak_memarea, ptr, value);\n+\t\tmemarea_unlock(ma);\n+\t\treturn;\n+\t}\n+\n \tif (unlikely(elem->refcnt <= 0 || elem->refcnt + value < 0)) {\n \t\tRTE_LOG(ERR, MEMAREA,\n \t\t\t\"memarea: %s cookie: 0x%x curr refcnt: %d update refcnt: %d check fail!\\n\",\n@@ -373,10 +391,14 @@ rte_memarea_dump(struct rte_memarea *ma, FILE *f, bool dump_all)\n \tfprintf(f, \"  algorithm: %s\\n\", memarea_alg_name(ma->init.alg));\n \tfprintf(f, \"  total-size: 0x%zx\\n\", ma->init.total_sz);\n \tfprintf(f, \"  mt-safe: %s\\n\", ma->init.mt_safe ? \"yes\" : \"no\");\n+\tif (ma->init.bak_memarea)\n+\t\tfprintf(f, \"  backup-memarea-name: %s\\n\", ma->init.bak_memarea->init.name);\n \tfprintf(f, \"  total-regions: %u\\n\", memarea_elem_list_num(ma));\n \tfprintf(f, \"  total-free-regions: %u\\n\", memarea_free_list_num(ma));\n \tfprintf(f, \"  alloc_fails: %\" PRIu64 \"\\n\", ma->alloc_fails);\n \tfprintf(f, \"  refcnt_check_fails: %\" PRIu64 \"\\n\", ma->refcnt_check_fails);\n+\tif (ma->init.bak_memarea)\n+\t\tfprintf(f, \"  backup_alloc_fails: %\" PRIu64 \"\\n\", ma->bak_alloc_fails);\n \tif (dump_all)\n \t\tmemarea_dump_all(ma, f);\n \tmemarea_unlock(ma);\ndiff --git a/lib/memarea/rte_memarea.h b/lib/memarea/rte_memarea.h\nindex 10b8229c64..348febab7f 100644\n--- a/lib/memarea/rte_memarea.h\n+++ b/lib/memarea/rte_memarea.h\n@@ -39,6 +39,9 @@\n  *   specified, all the functions of the memarea API are lock-free, and assume\n  *   to not be invoked in parallel on different logical cores to work on the\n  *   same memarea.\n+ * - It provides backup memory mechanism, the memarea could use another memarea\n+ *   as a backup. It will attempts to allocate object from backup memarea when\n+ *   the current memarea failed to allocate.\n  */\n \n #include <stdbool.h>\n@@ -105,6 +108,10 @@ struct rte_memarea_param {\n \t\t */\n \t\tstruct rte_memarea *user_memarea;\n \t};\n+\t/** Backup memarea, which is used to handle the scenario where the\n+\t * current memarea allocation failure.\n+\t */\n+\tstruct rte_memarea *bak_memarea;\n };\n \n /**\n",
    "prefixes": [
        "v5",
        "07/10"
    ]
}