get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 113831,
    "url": "http://patches.dpdk.org/api/patches/113831/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220708125645.3141464-2-harry.van.haaren@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": "<20220708125645.3141464-2-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220708125645.3141464-2-harry.van.haaren@intel.com",
    "date": "2022-07-08T12:56:45",
    "name": "[2/2] service: fix potential stats race-condition on MT services",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9cf40dd1b768d51a3298f52324bb352d6b170374",
    "submitter": {
        "id": 317,
        "url": "http://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.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/20220708125645.3141464-2-harry.van.haaren@intel.com/mbox/",
    "series": [
        {
            "id": 23942,
            "url": "http://patches.dpdk.org/api/series/23942/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=23942",
            "date": "2022-07-08T12:56:44",
            "name": "[1/2] test/service: add perf measurements for with stats mode",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/23942/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/113831/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/113831/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 02AE9A00C5;\n\tFri,  8 Jul 2022 14:57:17 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4C415427F6;\n\tFri,  8 Jul 2022 14:57:13 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id 7F97F4021E\n for <dev@dpdk.org>; Fri,  8 Jul 2022 14:57:11 +0200 (CEST)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Jul 2022 05:56:55 -0700",
            "from silpixa00401454.ir.intel.com ([10.55.128.122])\n by orsmga001.jf.intel.com with ESMTP; 08 Jul 2022 05:56:54 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1657285031; x=1688821031;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=ZDcCKvRR4iJnNFmy7AtBkPKOUJmX/r6dxAcR/AuBRcM=;\n b=SdEThxaquzZ4Ej64Wo2PcnSLpR5wNNEJyZCPPN8z5NXjvGfb6L/2Wd+X\n NDSiVY73oIH0x6hpXrpe0D5v3LxFW8KEqWnxqN45yUOXKxCmLDvDzWwlZ\n 1IE/vyOZnPgHAphJG1wWhPguK36lds308ZkZ7bH6aHMXlql8ad4LuVYj6\n W80CQh8Jl+OhT+fgDbClUf6pmIo9N2H4/AkaV+sXQeyrf7kXo2MEvSuUu\n Bc++41TFOFUm9AdGgTAQei+9m9Whm7m1xWk4BHAANd+R0CB56vljqndnJ\n fsyzICEEuFn6mZNh2QA0UFDgLO02B92+mT2uvhQAvAqP2Hh7vQm9zfczt g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10401\"; a=\"264053439\"",
            "E=Sophos;i=\"5.92,255,1650956400\"; d=\"scan'208\";a=\"264053439\"",
            "E=Sophos;i=\"5.92,255,1650956400\"; d=\"scan'208\";a=\"626696695\""
        ],
        "X-ExtLoop1": "1",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Harry van Haaren <harry.van.haaren@intel.com>, =?utf-8?q?Mattias_R=C3=B6?=\n\t=?utf-8?q?nnblom?= <mattias.ronnblom@ericsson.com>,\n Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>, =?utf-8?q?Morten_Br?=\n\t=?utf-8?q?=C3=B8rup?= <mb@smartsharesystems.com>",
        "Subject": "[PATCH 2/2] service: fix potential stats race-condition on MT\n services",
        "Date": "Fri,  8 Jul 2022 12:56:45 +0000",
        "Message-Id": "<20220708125645.3141464-2-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20220708125645.3141464-1-harry.van.haaren@intel.com>",
        "References": "<20220708125645.3141464-1-harry.van.haaren@intel.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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": "This commit fixes a potential racey-add that could occur if\nmultiple service-lcores were executing the same MT-safe service\nat the same time, with service statistics collection enabled.\n\nBecause multiple threads can run and execute the service, the\nstats values can have multiple writer threads, resulting in the\nrequirement of using atomic addition for correctness.\n\nNote that when a MT unsafe service is executed, a spinlock is\nheld, so the stats increments are protected. This fact is used\nto avoid executing atomic add instructions when not required.\n\nThis patch causes a 1.25x increase in cycle-cost for polling a\nMT safe service when statistics are enabled. No change was seen\nfor MT unsafe services, or when statistics are disabled.\n\nReported-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>\nSuggested-by: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>\nSuggested-by: Morten Brørup <mb@smartsharesystems.com>\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n\n---\n---\n lib/eal/common/rte_service.c | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/eal/common/rte_service.c b/lib/eal/common/rte_service.c\nindex ef31b1f63c..f045e74ef3 100644\n--- a/lib/eal/common/rte_service.c\n+++ b/lib/eal/common/rte_service.c\n@@ -363,9 +363,15 @@ service_runner_do_callback(struct rte_service_spec_impl *s,\n \t\tuint64_t start = rte_rdtsc();\n \t\ts->spec.callback(userdata);\n \t\tuint64_t end = rte_rdtsc();\n-\t\ts->cycles_spent += end - start;\n+\t\tuint64_t cycles = end - start;\n \t\tcs->calls_per_service[service_idx]++;\n-\t\ts->calls++;\n+\t\tif (service_mt_safe(s)) {\n+\t\t\t__atomic_fetch_add(&s->cycles_spent, cycles, __ATOMIC_RELAXED);\n+\t\t\t__atomic_fetch_add(&s->calls, 1, __ATOMIC_RELAXED);\n+\t\t} else {\n+\t\t\ts->cycles_spent += cycles;\n+\t\t\ts->calls++;\n+\t\t}\n \t} else\n \t\ts->spec.callback(userdata);\n }\n",
    "prefixes": [
        "2/2"
    ]
}