get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 120280,
    "url": "https://patches.dpdk.org/api/patches/120280/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20221129144832.2750-6-lucp.at.work@gmail.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20221129144832.2750-6-lucp.at.work@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20221129144832.2750-6-lucp.at.work@gmail.com",
    "date": "2022-11-29T14:48:33",
    "name": "[v3,5/5] failsafe: make sub-device remove flag thread-safe",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1d595e2828563550227a8d08aa31c5be90b8ea89",
    "submitter": {
        "id": 2151,
        "url": "https://patches.dpdk.org/api/people/2151/?format=api",
        "name": "Luc Pelletier",
        "email": "lucp.at.work@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20221129144832.2750-6-lucp.at.work@gmail.com/mbox/",
    "series": [
        {
            "id": 25706,
            "url": "https://patches.dpdk.org/api/series/25706/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=25706",
            "date": "2022-11-10T16:34:12",
            "name": "failsafe: fix segfault on hotplug event",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/25706/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/120280/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/120280/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 AAFD1A00C3;\n\tTue, 29 Nov 2022 15:51:02 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4020142B8C;\n\tTue, 29 Nov 2022 15:50:41 +0100 (CET)",
            "from mail-qk1-f177.google.com (mail-qk1-f177.google.com\n [209.85.222.177])\n by mails.dpdk.org (Postfix) with ESMTP id C429542C4D;\n Tue, 29 Nov 2022 15:50:34 +0100 (CET)",
            "by mail-qk1-f177.google.com with SMTP id k4so9883522qkj.8;\n Tue, 29 Nov 2022 06:50:34 -0800 (PST)",
            "from ubuntu.home\n (bras-base-hullpq2034w-grc-26-74-12-221-152.dsl.bell.ca. [74.12.221.152])\n by smtp.gmail.com with ESMTPSA id\n y14-20020a05620a44ce00b006fb7c42e73asm11068836qkp.21.2022.11.29.06.50.33\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 29 Nov 2022 06:50:33 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=z08scHU6YsGW9fJPGihyWAEtBdpF8UbFlvJFRsIy3x0=;\n b=V8oX6RkZZK27smXvPIMWfcFKg4lJ2+taeslJS067brlmWuJ93PjFYqaGtwM63jKrRz\n F04qJhxxb0b/IfozBpk4+Pff7BChtQuEto8Af/su09w10QuWbglZbBHeLDnRN7nzQmXi\n kXKU+AsoeN0XMs3fUW1T7J7HE/bO9rLp0MNRfUeaxSiXEn67wkpMkK6FXXBSnoaAWK2X\n pXKWop/ylzT6U07sAbv2Ai5vghFO/hQ3UsHrmQgkQ67VO9fL2IDhkik+vKY3eUreB1w6\n 9mT1nVi0QYTz1P/ch6Gcv01fewNpmZD3ThRjEXcBe9ndVKaifBUiR38AFQGViQ/WNVge\n gDzw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=z08scHU6YsGW9fJPGihyWAEtBdpF8UbFlvJFRsIy3x0=;\n b=eOXEzg0djAu1V9Fk6zmMXyR3C04bVy3kVEN0cl/Hr2sEPaDD6A76XRnDzPoUtECrwb\n taM0PSKTEghRZ3dNlOcuA1rk/wU/j3DupmeP/Sm4m2aVTf+po32nB36iHMJZvx/GxrsR\n yuTl9eJB0Znwo20R3Hhr/mAWc6vWWFUDlWlC2r/O1/QWFGo1L7otf+AyM0d14cLxltev\n rIH6pFMOaI4WfZz8Ss4vbDUs13wex/kFOS2EJy1tC5TufNJwbK0L0KbiFMtq5BAuj4kI\n J/NSYaIRHxySVqOwbwYEX8UoFDa86AkVtThPbJUDiAG+KMe/BEx75i8jJZaAnrijCjmM\n 1m7A==",
        "X-Gm-Message-State": "ANoB5pl2voZqsTyIxzvTFpMqhxreDKJARXN7dZmxjHq++ANnZoBnwh5G\n 0JNWOi9w2axmL2nDmFuIwlY=",
        "X-Google-Smtp-Source": "\n AA0mqf5WK1GPMD5//aJMLijZUKU5HRCMTPnPVU85Y1rJE31X49wGDshHOEvdrn8/LJ8suiwhwBdRlQ==",
        "X-Received": "by 2002:a05:620a:1e9:b0:6b8:ec83:2922 with SMTP id\n x9-20020a05620a01e900b006b8ec832922mr51746860qkn.107.1669733434202;\n Tue, 29 Nov 2022 06:50:34 -0800 (PST)",
        "From": "Luc Pelletier <lucp.at.work@gmail.com>",
        "To": "grive@u256.net",
        "Cc": "dev@dpdk.org, stephen@networkplumber.org, konstantin.ananyev@huawei.com,\n Luc Pelletier <lucp.at.work@gmail.com>, stable@dpdk.org",
        "Subject": "[PATCH v3 5/5] failsafe: make sub-device remove flag thread-safe",
        "Date": "Tue, 29 Nov 2022 09:48:33 -0500",
        "Message-Id": "<20221129144832.2750-6-lucp.at.work@gmail.com>",
        "X-Mailer": "git-send-email 2.38.1",
        "In-Reply-To": "<20221110163410.12734-1-lucp.at.work@gmail.com>",
        "References": "<20221110163410.12734-1-lucp.at.work@gmail.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": "For each sub-device, there's a remove flag that's used to indicate if\nthe sub-device has been removed or not. This flag is currently a\nvolatile bit field. Even if it's marked as volatile, a bit field is not\nthread-safe according to the C standard.\n\nThe remove flag is now an unsigned int rather than a bit field. We also\nnow use the atomic built-ins to read/write the value of the remove flag\nto ensure thread-safety.\n\nFixes: 598fb8aec6f6 (\"net/failsafe: support device removal\")\nCc: Gaetan Rivet <grive@u256.net>\nCc: stable@dpdk.org\n\nSigned-off-by: Luc Pelletier <lucp.at.work@gmail.com>\n---\n drivers/net/failsafe/failsafe_ether.c   | 8 ++++----\n drivers/net/failsafe/failsafe_ops.c     | 2 +-\n drivers/net/failsafe/failsafe_private.h | 4 ++--\n drivers/net/failsafe/failsafe_rxtx.c    | 2 +-\n 4 files changed, 8 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c\nindex 3bfc446638..9014777e52 100644\n--- a/drivers/net/failsafe/failsafe_ether.c\n+++ b/drivers/net/failsafe/failsafe_ether.c\n@@ -311,7 +311,7 @@ fs_dev_remove(struct sub_device *sdev)\n \t\t/* the end */\n \t\tbreak;\n \t}\n-\tsdev->remove = 0;\n+\t__atomic_store_n(&sdev->remove, 0, __ATOMIC_RELEASE);\n \tfailsafe_hotplug_alarm_install(fs_dev(sdev));\n }\n \n@@ -388,7 +388,7 @@ failsafe_dev_remove(struct rte_eth_dev *dev)\n \tuint8_t i;\n \n \tFOREACH_SUBDEV(sdev, i, dev) {\n-\t\tif (!sdev->remove)\n+\t\tif (!__atomic_load_n(&sdev->remove, __ATOMIC_ACQUIRE))\n \t\t\tcontinue;\n \n \t\t/* Active devices must have finished their burst and\n@@ -556,7 +556,7 @@ failsafe_eth_dev_state_sync(struct rte_eth_dev *dev)\n err_remove:\n \tFOREACH_SUBDEV(sdev, i, dev)\n \t\tif (sdev->state != PRIV(dev)->state)\n-\t\t\tsdev->remove = 1;\n+\t\t\t__atomic_store_n(&sdev->remove, 1, __ATOMIC_RELEASE);\n \treturn ret;\n }\n \n@@ -597,7 +597,7 @@ failsafe_eth_rmv_event_callback(uint16_t port_id __rte_unused,\n \t * Async removal, the sub-PMD will try to unregister\n \t * the callback at the source of the current thread context.\n \t */\n-\tsdev->remove = 1;\n+\t__atomic_store_n(&sdev->remove, 1, __ATOMIC_RELEASE);\n \tfs_unlock(fs_dev(sdev), 0);\n \treturn 0;\n }\ndiff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c\nindex 7bd223af37..86d97970bc 100644\n--- a/drivers/net/failsafe/failsafe_ops.c\n+++ b/drivers/net/failsafe/failsafe_ops.c\n@@ -838,7 +838,7 @@ fs_link_update(struct rte_eth_dev *dev,\n \t\t\tif (TX_SUBDEV(dev) == sdev)\n \t\t\t\tret = rte_eth_linkstatus_set(dev, &link_info);\n \t\t}\n-\t\telse if (sdev->remove == 0 &&\n+\t\telse if (__atomic_load_n(&sdev->remove, __ATOMIC_ACQUIRE) == 0 &&\n \t\t\t\trte_eth_dev_is_removed(PORT_ID(sdev)) == 0) {\n \t\t\tERROR(\"Link get failed for sub_device %d with error %d\",\n \t\t\t\ti, sdev_link_ret);\ndiff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h\nindex 3865f2fc34..0577a62ab2 100644\n--- a/drivers/net/failsafe/failsafe_private.h\n+++ b/drivers/net/failsafe/failsafe_private.h\n@@ -131,7 +131,7 @@ struct sub_device {\n \t/* sub device port id*/\n \tuint16_t sdev_port_id; /* shared between processes */\n \t/* flag calling for recollection */\n-\tvolatile unsigned int remove:1;\n+\tunsigned int remove;\n \t/* flow isolation state */\n \tint flow_isolated:1;\n \t/* RMV callback registration state */\n@@ -490,7 +490,7 @@ static inline int\n fs_err(struct sub_device *sdev, int err)\n {\n \t/* A device removal shouldn't be reported as an error. */\n-\tif (sdev->remove == 1 || err == -EIO)\n+\tif (__atomic_load_n(&sdev->remove, __ATOMIC_ACQUIRE) == 1 || err == -EIO)\n \t\treturn rte_errno = 0;\n \treturn err;\n }\ndiff --git a/drivers/net/failsafe/failsafe_rxtx.c b/drivers/net/failsafe/failsafe_rxtx.c\nindex 6d8ab0a6e7..c5caab4204 100644\n--- a/drivers/net/failsafe/failsafe_rxtx.c\n+++ b/drivers/net/failsafe/failsafe_rxtx.c\n@@ -16,7 +16,7 @@ fs_rx_unsafe(struct sub_device *sdev)\n \treturn (ETH(sdev) == NULL) ||\n \t\t(ETH(sdev)->rx_pkt_burst == NULL) ||\n \t\t(sdev->state != DEV_STARTED) ||\n-\t\t(sdev->remove != 0);\n+\t\t(__atomic_load_n(&sdev->remove, __ATOMIC_ACQUIRE) != 0);\n }\n \n static inline int\n",
    "prefixes": [
        "v3",
        "5/5"
    ]
}