Show a patch.

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

{
    "id": 73379,
    "url": "https://patches.dpdk.org/api/patches/73379/",
    "web_url": "https://patches.dpdk.org/patch/73379/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20200707090320.2463-1-sarosh.arif@emumba.com>",
    "date": "2020-07-07T09:03:20",
    "name": "lib/librte_timer:fix corruption with reset",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5763cbe128f93f392c098916afa66026af79ef67",
    "submitter": {
        "id": 1638,
        "url": "https://patches.dpdk.org/api/people/1638/",
        "name": "Sarosh Arif",
        "email": "sarosh.arif@emumba.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/patch/73379/mbox/",
    "series": [
        {
            "id": 10841,
            "url": "https://patches.dpdk.org/api/series/10841/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=10841",
            "date": "2020-07-07T09:03:20",
            "name": "lib/librte_timer:fix corruption with reset",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/10841/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/73379/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/73379/checks/",
    "tags": {},
    "headers": {
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "Return-Path": "<dev-bounces@dpdk.org>",
        "To": "rsanford@akamai.com,\n\terik.g.carrillo@intel.com,\n\tdev@dpdk.org",
        "X-Google-Smtp-Source": "\n ABdhPJyRWtffNM+1LvJ1XDgS/ZzQ9f8HgLCcPzfa0iZqPMtrHQU5PNqA5LkhADsbJyj3AB9bCda7aw==",
        "Message-Id": "<20200707090320.2463-1-sarosh.arif@emumba.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "X-Gm-Message-State": "AOAM5303zPbZmLmETPqbFpD5/d5wIAhtvB8nH59p16/Hw0kbXQJZmKwO\n bbsch8UIctJxp9ZTFEYk+qIkRQ==",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=emumba-com.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id;\n bh=0gWkV/fCAqx4M3JH8PXCSXRIEPpN0MOoGGuhybwuPhY=;\n b=idyQxuPkBPd8uAxKINzHdkeo6jukVaRn9lwd38gTnpvCLrXB9tLXjVlFLFwfQnxwFx\n R+1h+xqJmXkCbShngsmpP21kWO48b3dzb3sv2oZDnxO41juM1I7OVX7xfdOqeLXZ1m7H\n uRZ2TqsdAK0aWmb73Dr/VxuursCbI1tQoWc8kpcgSWhdePj5MHy9yXfE/72WD+MdjuGJ\n 2/PlnTMVrCvV9KmccG3B8LCnyVvCbjCxmho8Acmv7zbRLVpyVAKRMRu9GJxigMaU9XA+\n 1KBLvCNqkAlEZLWzz/cEqI7wXs05HEwLXOzuG3H211y/rzIALH9av7jpIKou/scNVS4P\n GaZw==",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-BeenThere": "dev@dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id DFBB3A00BE;\n\tTue,  7 Jul 2020 11:03:39 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BDB261DB3E;\n\tTue,  7 Jul 2020 11:03:39 +0200 (CEST)",
            "from mail-wr1-f66.google.com (mail-wr1-f66.google.com\n [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 545F11DB3E\n for <dev@dpdk.org>; Tue,  7 Jul 2020 11:03:38 +0200 (CEST)",
            "by mail-wr1-f66.google.com with SMTP id k6so44330941wrn.3\n for <dev@dpdk.org>; Tue, 07 Jul 2020 02:03:38 -0700 (PDT)",
            "from localhost.localdomain ([39.40.116.181])\n by smtp.gmail.com with ESMTPSA id 1sm187544wmf.21.2020.07.07.02.03.35\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 07 Jul 2020 02:03:37 -0700 (PDT)"
        ],
        "Subject": "[dpdk-dev] [PATCH] lib/librte_timer:fix corruption with reset",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "Cc": "stable@dpdk.org, Sarosh Arif <sarosh.arif@emumba.com>,\n h.mikita89@gmail.com",
        "Precedence": "list",
        "From": "Sarosh Arif <sarosh.arif@emumba.com>",
        "X-Received": "by 2002:a5d:5084:: with SMTP id a4mr54624044wrt.191.1594112618033;\n Tue, 07 Jul 2020 02:03:38 -0700 (PDT)",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Errors-To": "dev-bounces@dpdk.org",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Date": "Tue,  7 Jul 2020 14:03:20 +0500",
        "X-Mailman-Version": "2.1.15",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id;\n bh=0gWkV/fCAqx4M3JH8PXCSXRIEPpN0MOoGGuhybwuPhY=;\n b=snMFjQNxzL1TnkqsRewEl4tYW5U/lh5rC2EDgBFK/eOxlesItQ1mekncUrtx/xHQrm\n LTQ/42KYkWgigp94mMy1zpEUsFdPF/lGqSkppQslhTNOB6h5wWgvgHsyVGqsvUeYFYbA\n Wt/nteyZ8dZcNs8DxeGOHX3M4WHdP9+STzv5DyMHZK2WLnnYMJSvbGRhOFFnY6Ddt+29\n 0VkhNEiDomWnRahVq6oA8QZFkLvvzekq3+lpBBV75ow+NmIGSvkGl5MJ/90HeCjolS7L\n FvPkkEoOATP+6yefauFmd9Y6UgFc4j92RZVAkXa4sFGBZ9yWt01eDlaRqQ9yCKWaA+En\n Oudg=="
    },
    "content": "If the user tries to reset/stop some other timer in it's callback\nfunction, which is also about to expire, using \nrte_timer_reset_sync/rte_timer_stop_sync the application goes into\nan infinite loop. This happens because \nrte_timer_reset_sync/rte_timer_stop_sync loop until the timer \nresets/stops and there is check inside timer_set_config_state which\nprevents a running timer from being reset/stopped by not it's own \ntimer_cb. Therefore timer_set_config_state returns -1 due to which \nrte_timer_reset returns -1 and rte_timer_reset_sync goes into an \ninfinite loop. \n\nThe soloution to this problem is to return -1 from \nrte_timer_reset_sync/rte_timer_stop_sync in case the user tries to \nreset/stop some other timer in it's callback function.\n\nBugzilla ID: 491\nFixes: 20d159f20543 (\"timer: fix corruption with reset\")\nCc: h.mikita89@gmail.com\nSigned-off-by: Sarosh Arif <sarosh.arif@emumba.com>\n---\n lib/librte_timer/rte_timer.c | 25 +++++++++++++++++++++++--\n lib/librte_timer/rte_timer.h |  4 ++--\n 2 files changed, 25 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c\nindex 6d19ce469..ed48bcbfd 100644\n--- a/lib/librte_timer/rte_timer.c\n+++ b/lib/librte_timer/rte_timer.c\n@@ -576,14 +576,24 @@ rte_timer_alt_reset(uint32_t timer_data_id, struct rte_timer *tim,\n }\n \n /* loop until rte_timer_reset() succeed */\n-void\n+int\n rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks,\n \t\t     enum rte_timer_type type, unsigned tim_lcore,\n \t\t     rte_timer_cb_t fct, void *arg)\n {\n+\tstruct rte_timer_data *timer_data;\n+\tTIMER_DATA_VALID_GET_OR_ERR_RET(default_data_id, timer_data, -EINVAL);\n+\n+\tif (tim->status.state == RTE_TIMER_RUNNING &&\t\\\n+\t(tim->status.owner != (uint16_t)tim_lcore ||\t\\\n+\ttim != timer_data->priv_timer[tim_lcore].running_tim))\n+\t\treturn -1;\n+\n \twhile (rte_timer_reset(tim, ticks, type, tim_lcore,\n \t\t\t       fct, arg) != 0)\n \t\trte_pause();\n+\n+\treturn 0;\n }\n \n static int\n@@ -642,11 +652,22 @@ rte_timer_alt_stop(uint32_t timer_data_id, struct rte_timer *tim)\n }\n \n /* loop until rte_timer_stop() succeed */\n-void\n+int\n rte_timer_stop_sync(struct rte_timer *tim)\n {\n+\tstruct rte_timer_data *timer_data;\n+\tTIMER_DATA_VALID_GET_OR_ERR_RET(default_data_id, timer_data, -EINVAL);\n+\tunsigned int lcore_id = rte_lcore_id();\n+\n+\tif (tim->status.state == RTE_TIMER_RUNNING &&\t\\\n+\t(tim->status.owner != (uint16_t)lcore_id ||\t\\\n+\ttim != timer_data->priv_timer[lcore_id].running_tim))\n+\t\treturn -1;\n+\n \twhile (rte_timer_stop(tim) != 0)\n \t\trte_pause();\n+\n+\treturn 0;\n }\n \n /* Test the PENDING status of the timer handle tim */\ndiff --git a/lib/librte_timer/rte_timer.h b/lib/librte_timer/rte_timer.h\nindex c6b3d450d..392ca423d 100644\n--- a/lib/librte_timer/rte_timer.h\n+++ b/lib/librte_timer/rte_timer.h\n@@ -275,7 +275,7 @@ int rte_timer_reset(struct rte_timer *tim, uint64_t ticks,\n  * @param arg\n  *   The user argument of the callback function.\n  */\n-void\n+int\n rte_timer_reset_sync(struct rte_timer *tim, uint64_t ticks,\n \t\t     enum rte_timer_type type, unsigned tim_lcore,\n \t\t     rte_timer_cb_t fct, void *arg);\n@@ -314,7 +314,7 @@ int rte_timer_stop(struct rte_timer *tim);\n  * @param tim\n  *   The timer handle.\n  */\n-void rte_timer_stop_sync(struct rte_timer *tim);\n+int rte_timer_stop_sync(struct rte_timer *tim);\n \n /**\n  * Test if a timer is pending.\n",
    "prefixes": []
}