Show a patch.

GET /api/patches/74614/
Content-Type: application/json
Vary: Accept

    "id": 74614,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": ""
    "msgid": "<>",
    "date": "2020-07-22T10:37:01",
    "name": "[v3,2/2] test/service: fix race condition on stopping lcore",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2765addf14da62328501136aa9f0e93c23e5cfa3",
    "submitter": {
        "id": 317,
        "url": "",
        "name": "Van Haaren, Harry",
        "email": ""
    "delegate": {
        "id": 24651,
        "url": "",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": ""
    "mbox": "",
    "series": [
            "id": 11234,
            "url": "",
            "web_url": "",
            "date": "2020-07-22T10:37:00",
            "name": "[v3,1/2] service: add API to retrieve service core active",
            "version": 3,
            "mbox": ""
    "comments": "",
    "check": "fail",
    "checks": "",
    "tags": {},
    "headers": {
        "List-Subscribe": "<>,\n <>",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9689\"; a=\"150282917\"",
            "E=Sophos;i=\"5.75,381,1589266800\"; d=\"scan'208\";a=\"150282917\"",
            "E=Sophos;i=\"5.75,381,1589266800\"; d=\"scan'208\";a=\"301910615\""
        "IronPort-SDR": [
            "\n BcD7calIFHJcPa9j5Lqz30tnOFoADVHvEmt/kmRYBhMgiHOhdLzsYV7TEPqKowxl9EIPdpSJZE\n UKz6Vc4qeFpg==",
            "\n LW3KG1kjv1b6BIjs6rZBR0IO4kVhRS2/saXVMyjW/ZvCA3xMY/tnBlurV3b5d00r49MvRvmaC0\n 1TeF5WLulm1g=="
        "X-Amp-File-Uploaded": "False",
        "Precedence": "list",
        "X-Mailman-Version": "2.1.15",
        "X-Original-To": "",
        "List-Post": "<>",
        "List-Id": "DPDK patches and discussions <>",
        "X-BeenThere": "",
        "References": "<>\n <>",
        "Subject": "[dpdk-dev] [PATCH v3 2/2] test/service: fix race condition on\n\tstopping lcore",
        "Sender": "\"dev\" <>",
        "Delivered-To": "",
        "Received": [
            "from ( [])\n\tby (Postfix) with ESMTP id 9302CA0526;\n\tWed, 22 Jul 2020 12:36:22 +0200 (CEST)",
            "from [] (localhost [])\n\tby (Postfix) with ESMTP id 6BA111C010;\n\tWed, 22 Jul 2020 12:36:22 +0200 (CEST)",
            "from ( [])\n by (Postfix) with ESMTP id A9F081C010\n for <>; Wed, 22 Jul 2020 12:36:20 +0200 (CEST)",
            "from ([])\n by with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 22 Jul 2020 03:36:16 -0700",
            "from (HELO\n ([])\n by with ESMTP; 22 Jul 2020 03:36:13 -0700"
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "List-Archive": "<>",
        "X-Mailer": "git-send-email 2.17.1",
        "List-Unsubscribe": "<>,\n <>",
        "X-ExtLoop1": "1",
        "Date": "Wed, 22 Jul 2020 11:37:01 +0100",
        "To": "",
        "From": "Harry van Haaren <>",
        "In-Reply-To": "<>",
        "Cc": ",,\n,,,\n,,,\n Harry van Haaren <>",
        "List-Help": "<>",
        "Errors-To": "",
        "Message-Id": "<>",
        "Return-Path": "<>"
    "content": "This commit fixes a potential race condition in the tests\nwhere the lcore running a service would increment a counter\nthat was already reset by the test-suite thread. The resulting\nrace-condition incremented value could cause CI failures, as\nindicated by DPDK's CI.\n\nThis patch fixes the race-condition by making use of the\nadded rte_service_lcore_active() API, which indicates when\na service-core is no longer in the service-core polling loop.\n\nThe unit test makes use of the above function to detect when\nall statistics increments are done in the service-core thread,\nand then the unit test continues finalizing and checking state.\n\nFixes: f28f3594ded2 (\"service: add attribute API\")\n\nReported-by: David Marchand <>\nSigned-off-by: Harry van Haaren <>\nReviewed-by: Phil Yang <>\n\n---\n\nv3:\n- Refactor while() to for() to simplify (Harry)\n- Use SERVICE_DELAY instead of magic const 1 (Phil)\n- Add Phil's reviewed by tag from ML\n\nv2:\nThanks for discussion on v1, this v2 fixup for the CI\nincluding previous feedback on ML.\n---\n app/test/test_service_cores.c | 20 +++++++++++++++++++-\n 1 file changed, 19 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c\nindex ef1d8fcb9..a6bc4487e 100644\n--- a/app/test/test_service_cores.c\n+++ b/app/test/test_service_cores.c\n@@ -362,6 +362,9 @@ service_lcore_attr_get(void)\n \t\t\t\"Service core add did not return zero\");\n \tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(id, slcore_id, 1),\n \t\t\t\"Enabling valid service and core failed\");\n+\t/* Ensure service is not active before starting */\n+\tTEST_ASSERT_EQUAL(0, rte_service_lcore_active(slcore_id),\n+\t\t\t\"Not-active service core reported as active\");\n \tTEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id),\n \t\t\t\"Starting service core failed\");\n \n@@ -382,7 +385,22 @@ service_lcore_attr_get(void)\n \t\t\tlcore_attr_id, &lcore_attr_value),\n \t\t\t\"Invalid lcore attr didn't return -EINVAL\");\n \n-\trte_service_lcore_stop(slcore_id);\n+\t/* Ensure service is active */\n+\tTEST_ASSERT_EQUAL(1, rte_service_lcore_active(slcore_id),\n+\t\t\t\"Active service core reported as not-active\");\n+\n+\tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(id, slcore_id, 0),\n+\t\t\t\"Disabling valid service and core failed\");\n+\tTEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id),\n+\t\t\t\"Failed to stop service lcore\");\n+\n+\t/* Wait until service lcore not active, or for 100x SERVICE_DELAY */\n+\tfor (int i = 0; i < 100 && rte_service_lcore_active(slcore_id) == 1;\n+\t\t\ti++)\n+\t\trte_delay_ms(SERVICE_DELAY);\n+\n+\tTEST_ASSERT_EQUAL(0, rte_service_lcore_active(slcore_id),\n+\t\t\t  \"Service lcore not stopped after waiting.\");\n \n \tTEST_ASSERT_EQUAL(0, rte_service_lcore_attr_reset_all(slcore_id),\n \t\t\t  \"Valid lcore_attr_reset_all() didn't return success\");\n",
    "prefixes": [