Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/47828/?format=api
http://patches.dpdk.org/api/patches/47828/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20181105173913.61225-4-bruce.richardson@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": "<20181105173913.61225-4-bruce.richardson@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20181105173913.61225-4-bruce.richardson@intel.com", "date": "2018-11-05T17:39:12", "name": "[3/4] eal/x86: reduce contention when retrying TSX", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "ffd1bc746437ae0157e0c3f4db6cf853f92eed34", "submitter": { "id": 20, "url": "http://patches.dpdk.org/api/people/20/?format=api", "name": "Bruce Richardson", "email": "bruce.richardson@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/20181105173913.61225-4-bruce.richardson@intel.com/mbox/", "series": [ { "id": 2267, "url": "http://patches.dpdk.org/api/series/2267/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2267", "date": "2018-11-05T17:39:09", "name": "fixes for rte_hash with TSX", "version": 1, "mbox": "http://patches.dpdk.org/series/2267/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/47828/comments/", "check": "warning", "checks": "http://patches.dpdk.org/api/patches/47828/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A094A5587;\n\tMon, 5 Nov 2018 18:39:49 +0100 (CET)", "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 7D4134CBD\n\tfor <dev@dpdk.org>; Mon, 5 Nov 2018 18:39:47 +0100 (CET)", "from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t05 Nov 2018 09:39:46 -0800", "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.223.223])\n\tby fmsmga006.fm.intel.com with ESMTP; 05 Nov 2018 09:39:45 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.54,468,1534834800\"; d=\"scan'208\";a=\"278500836\"", "From": "Bruce Richardson <bruce.richardson@intel.com>", "To": "dev@dpdk.org", "Cc": "Bruce Richardson <bruce.richardson@intel.com>", "Date": "Mon, 5 Nov 2018 17:39:12 +0000", "Message-Id": "<20181105173913.61225-4-bruce.richardson@intel.com>", "X-Mailer": "git-send-email 2.19.1", "In-Reply-To": "<20181105173913.61225-1-bruce.richardson@intel.com>", "References": "<20181105173913.61225-1-bruce.richardson@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH 3/4] eal/x86: reduce contention when retrying TSX", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "When TSX transactions abort, it is generally worth retrying a number of\ntimes before falling back to the traditional locking path, as the\nparallelism benefits from TSX can be worth it when a transaction does\nsucceed. For cases with multiple threads and high contention rates, it can\nbe useful to have increasing delays between retry attempts, so as to avoid\nhaving the same threads repeatedly collide.\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/librte_eal/common/include/arch/x86/rte_spinlock.h | 19 ++++++++++++++++---\n lib/librte_eal/linuxapp/eal/eal_alarm.c | 2 ++\n 2 files changed, 18 insertions(+), 3 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h\nindex 60321da..961a3c0 100644\n--- a/lib/librte_eal/common/include/arch/x86/rte_spinlock.h\n+++ b/lib/librte_eal/common/include/arch/x86/rte_spinlock.h\n@@ -15,8 +15,9 @@\n #include \"rte_branch_prediction.h\"\n #include \"rte_common.h\"\n #include \"rte_pause.h\"\n+#include \"rte_cycles.h\"\n \n-#define RTE_RTM_MAX_RETRIES (10)\n+#define RTE_RTM_MAX_RETRIES (20)\n #define RTE_XABORT_LOCK_BUSY (0xff)\n \n #ifndef RTE_FORCE_INTRINSICS\n@@ -87,7 +88,7 @@ static inline int rte_tm_supported(void)\n \n \t\tunsigned int status = rte_xbegin();\n \n-\t\tif (likely(RTE_XBEGIN_STARTED == status)) {\n+\t\tif (RTE_XBEGIN_STARTED == status) {\n \t\t\tif (unlikely(*lock))\n \t\t\t\trte_xabort(RTE_XABORT_LOCK_BUSY);\n \t\t\telse\n@@ -97,8 +98,20 @@ static inline int rte_tm_supported(void)\n \t\t\trte_pause();\n \n \t\tif ((status & RTE_XABORT_EXPLICIT) &&\n-\t\t\t(RTE_XABORT_CODE(status) == RTE_XABORT_LOCK_BUSY))\n+\t\t (RTE_XABORT_CODE(status) == RTE_XABORT_LOCK_BUSY)) {\n+\t\t\t/* add a small delay before retrying, basing the\n+\t\t\t * delay on the number of times we've already tried,\n+\t\t\t * to give a back-off type of behaviour. We\n+\t\t\t * randomize trycount by taking bits from the tsc count\n+\t\t\t */\n+\t\t\tint try_count = RTE_RTM_MAX_RETRIES - retries;\n+\t\t\tint pause_count = (rte_rdtsc() & 0x7) | 1;\n+\t\t\tpause_count <<= try_count;\n+\t\t\tint i;\n+\t\t\tfor (i = 0; i < pause_count; i++)\n+\t\t\t\trte_pause();\n \t\t\tcontinue;\n+\t\t}\n \n \t\tif ((status & RTE_XABORT_RETRY) == 0) /* do not retry */\n \t\t\tbreak;\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_alarm.c b/lib/librte_eal/linuxapp/eal/eal_alarm.c\nindex 391d2a6..840ede7 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_alarm.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_alarm.c\n@@ -30,7 +30,9 @@\n #define NS_PER_US 1000\n #define US_PER_MS 1000\n #define MS_PER_S 1000\n+#ifndef US_PER_S\n #define US_PER_S (US_PER_MS * MS_PER_S)\n+#endif\n \n #ifdef CLOCK_MONOTONIC_RAW /* Defined in glibc bits/time.h */\n #define CLOCK_TYPE_ID CLOCK_MONOTONIC_RAW\n", "prefixes": [ "3/4" ] }{ "id": 47828, "url": "