get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 475,
    "url": "https://patches.dpdk.org/api/patches/475/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/60ABE07DBB3A454EB7FAD707B4BB1582138971EC@IRSMSX109.ger.corp.intel.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": "<60ABE07DBB3A454EB7FAD707B4BB1582138971EC@IRSMSX109.ger.corp.intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/60ABE07DBB3A454EB7FAD707B4BB1582138971EC@IRSMSX109.ger.corp.intel.com",
    "date": "2014-09-24T11:38:52",
    "name": "[dpdk-dev] Change alarm cancel function to thread-safe.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b5bdb0a4da055dc7aa89f91df5f61060dadb8570",
    "submitter": {
        "id": 74,
        "url": "https://patches.dpdk.org/api/people/74/?format=api",
        "name": "Michal Jastrzebski",
        "email": "michalx.k.jastrzebski@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/60ABE07DBB3A454EB7FAD707B4BB1582138971EC@IRSMSX109.ger.corp.intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/475/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/475/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 1497FB39D;\n\tWed, 24 Sep 2014 13:32:49 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 162E86896\n\tfor <dev@dpdk.org>; Wed, 24 Sep 2014 13:32:46 +0200 (CEST)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga103.fm.intel.com with ESMTP; 24 Sep 2014 04:29:46 -0700",
            "from irsmsx102.ger.corp.intel.com ([163.33.3.155])\n\tby FMSMGA003.fm.intel.com with ESMTP; 24 Sep 2014 04:32:59 -0700",
            "from irsmsx105.ger.corp.intel.com (163.33.3.28) by\n\tIRSMSX102.ger.corp.intel.com (163.33.3.155) with Microsoft SMTP\n\tServer (TLS) id 14.3.195.1; Wed, 24 Sep 2014 12:38:53 +0100",
            "from irsmsx109.ger.corp.intel.com ([169.254.13.200]) by\n\tIRSMSX105.ger.corp.intel.com ([169.254.7.158]) with mapi id\n\t14.03.0195.001; Wed, 24 Sep 2014 12:38:53 +0100"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"4.97,862,1389772800\"; d=\"scan'208\";a=\"390900902\"",
        "From": "\"Jastrzebski, MichalX K\" <michalx.k.jastrzebski@intel.com>",
        "To": "\"dev@dpdk.org\" <dev@dpdk.org>",
        "Thread-Topic": "[PATCH] Change alarm cancel function to thread-safe.",
        "Thread-Index": "AQHP1z+gNpYWcLJ780a2XEwi95k/LJwQKTow",
        "Date": "Wed, 24 Sep 2014 11:38:52 +0000",
        "Message-ID": "<60ABE07DBB3A454EB7FAD707B4BB1582138971EC@IRSMSX109.ger.corp.intel.com>",
        "References": "<1411484549-711-1-git-send-email-michalx.k.jastrzebski@intel.com>",
        "In-Reply-To": "<1411484549-711-1-git-send-email-michalx.k.jastrzebski@intel.com>",
        "Accept-Language": "en-US",
        "Content-Language": "en-US",
        "X-MS-Has-Attach": "",
        "X-MS-TNEF-Correlator": "",
        "x-originating-ip": "[163.33.239.181]",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "quoted-printable",
        "MIME-Version": "1.0",
        "Subject": "Re: [dpdk-dev] [PATCH] Change alarm cancel function to thread-safe.",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch is related to discussion from mode 4 link bonding patch set.\n\nBest regards\nMichal\n\n-----Original Message-----\nFrom: Jastrzebski, MichalX K \nSent: Tuesday, September 23, 2014 5:02 PM\nTo: dev@dpdk.org\nCc: Jastrzebski, MichalX K; Wodkowski, PawelX\nSubject: [PATCH] Change alarm cancel function to thread-safe.\n\nIt eliminates a race between threads using rte_alarm_cancel and rte_alarm_set.\n\nSigned-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>\nReviewed-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>\n---\n lib/librte_eal/common/include/rte_alarm.h |    3 +-\n lib/librte_eal/linuxapp/eal/eal_alarm.c   |   68 +++++++++++++++++++----------\n 2 files changed, 46 insertions(+), 25 deletions(-)\n\n+\t\tap->executing_id = pthread_self();\n \t\trte_spinlock_unlock(&alarm_list_lk);\n \n \t\tap->cb_fn(ap->cb_arg);\n \n \t\trte_spinlock_lock(&alarm_list_lk);\n+\t\tap->executing = 0;\n+\n \t\tLIST_REMOVE(ap, next);\n \t\trte_free(ap);\n \t}\n@@ -156,7 +161,6 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)\n \tnew_alarm->cb_arg = cb_arg;\n \tnew_alarm->time.tv_usec = (now.tv_usec + us) % US_PER_S;\n \tnew_alarm->time.tv_sec = now.tv_sec + ((now.tv_usec + us) / US_PER_S);\n-\tnew_alarm->executing = 0;\n \n \trte_spinlock_lock(&alarm_list_lk);\n \tif (!handler_registered) {\n@@ -202,34 +206,50 @@ rte_eal_alarm_cancel(rte_eal_alarm_callback cb_fn, void *cb_arg)  {\n \tstruct alarm_entry *ap, *ap_prev;\n \tint count = 0;\n+\tint executing;\n \n \tif (!cb_fn)\n \t\treturn -1;\n \n-\trte_spinlock_lock(&alarm_list_lk);\n-\t/* remove any matches at the start of the list */\n-\twhile ((ap = LIST_FIRST(&alarm_list)) != NULL &&\n-\t\t\tcb_fn == ap->cb_fn && ap->executing == 0 &&\n-\t\t\t(cb_arg == (void *)-1 || cb_arg == ap->cb_arg)) {\n-\t\tLIST_REMOVE(ap, next);\n-\t\trte_free(ap);\n-\t\tcount++;\n-\t}\n-\tap_prev = ap;\n-\n-\t/* now go through list, removing entries not at start */\n-\tLIST_FOREACH(ap, &alarm_list, next) {\n-\t\t/* this won't be true first time through */\n-\t\tif (cb_fn == ap->cb_fn &&  ap->executing == 0 &&\n+\tdo {\n+\t\texecuting = 0;\n+\t\trte_spinlock_lock(&alarm_list_lk);\n+\t\t/* remove any matches at the start of the list */\n+\t\twhile ((ap = LIST_FIRST(&alarm_list)) != NULL &&\n+\t\t\t\tcb_fn == ap->cb_fn &&\n \t\t\t\t(cb_arg == (void *)-1 || cb_arg == ap->cb_arg)) {\n-\t\t\tLIST_REMOVE(ap,next);\n-\t\t\trte_free(ap);\n-\t\t\tcount++;\n-\t\t\tap = ap_prev;\n+\n+\t\t\tif (ap->executing == 0) {\n+\t\t\t\tLIST_REMOVE(ap, next);\n+\t\t\t\trte_free(ap);\n+\t\t\t\tcount++;\n+\t\t\t} else {\n+\t\t\t\tif (pthread_equal(ap->executing_id, pthread_self()) == 0)\n+\t\t\t\t\texecuting++;\n+\n+\t\t\t\tbreak;\n+\t\t\t}\n \t\t}\n \t\tap_prev = ap;\n-\t}\n-\trte_spinlock_unlock(&alarm_list_lk);\n+\n+\t\t/* now go through list, removing entries not at start */\n+\t\tLIST_FOREACH(ap, &alarm_list, next) {\n+\t\t\t/* this won't be true first time through */\n+\t\t\tif (cb_fn == ap->cb_fn &&\n+\t\t\t\t\t(cb_arg == (void *)-1 || cb_arg == ap->cb_arg)) {\n+\n+\t\t\t\tif (ap->executing == 0) {\n+\t\t\t\t\tLIST_REMOVE(ap, next);\n+\t\t\t\t\trte_free(ap);\n+\t\t\t\t\tcount++;\n+\t\t\t\t\tap = ap_prev;\n+\t\t\t\t} else if (pthread_equal(ap->executing_id, pthread_self()) == 0)\n+\t\t\t\t\texecuting++;\n+\t\t\t}\n+\t\t\tap_prev = ap;\n+\t\t}\n+\t\trte_spinlock_unlock(&alarm_list_lk);\n+\t} while (executing != 0);\n+\n \treturn count;\n }\n-\n--\n1.7.9.5",
    "diff": "diff --git a/lib/librte_eal/common/include/rte_alarm.h b/lib/librte_eal/common/include/rte_alarm.h\nindex d451522..f5f7de4 100644\n--- a/lib/librte_eal/common/include/rte_alarm.h\n+++ b/lib/librte_eal/common/include/rte_alarm.h\n@@ -76,7 +76,8 @@ typedef void (*rte_eal_alarm_callback)(void *arg);  int rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb, void *cb_arg);\n \n /**\n- * Function to cancel an alarm callback which has been registered before.\n+ * Function to cancel an alarm callback which has been registered \n+ before. If\n+ * used ouside alarm callback it wait for all callbacks to finish its execution.\n  *\n  * @param cb_fn\n  *  alarm callback\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_alarm.c b/lib/librte_eal/linuxapp/eal/eal_alarm.c\nindex 480f0cb..0561dbf 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_alarm.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_alarm.c\n@@ -69,12 +69,14 @@ struct alarm_entry {\n \tstruct timeval time;\n \trte_eal_alarm_callback cb_fn;\n \tvoid *cb_arg;\n-\tvolatile int executing;\n+\tvolatile uint8_t executing;\n+\tvolatile pthread_t executing_id;\n };\n \n static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();  static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;\n \n+\n static struct rte_intr_handle intr_handle = {.fd = -1 };  static int handler_registered = 0;  static void eal_alarm_callback(struct rte_intr_handle *hdl, void *arg); @@ -108,11 +110,14 @@ eal_alarm_callback(struct rte_intr_handle *hdl __rte_unused,\n \t\t\t(ap->time.tv_sec < now.tv_sec || (ap->time.tv_sec == now.tv_sec &&\n \t\t\t\t\t\tap->time.tv_usec <= now.tv_usec))){\n \t\tap->executing = 1;\n",
    "prefixes": [
        "dpdk-dev"
    ]
}