From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0082.outbound.protection.outlook.com [104.47.0.82]) by dpdk.org (Postfix) with ESMTP id 10D4E2BBD for ; Mon, 11 Jul 2016 12:21:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coriant.onmicrosoft.com; s=selector1-coriant-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Crb8SFcK2VY+K9L73YQ8kTVwff0W8DVI84SAYlRbWgw=; b=T7KSJTpBa9ARe1LvI8/2Hbg/5U6J+Peho6Kmgk0xdUBls2tcB+o47m0/BH9KAF0fnV+VwdO9f8NHWf2Tqf4lFTu0/YnxsIWEvJGAxJ3TaX+0USKRLLlf09YkaBGpYugxltkKNG2xFQF4rkDvygu6lHXhrVlVuKAdMJm39WS/p5w= Received: from AM4PR0401CA0010.eurprd04.prod.outlook.com (2603:10a6:200:5::20) by AM3PR04MB1267.eurprd04.prod.outlook.com (2a01:111:e400:586c::21) with Microsoft SMTP Server (TLS) id 15.1.528.16; Mon, 11 Jul 2016 10:21:46 +0000 Received: from VE1EUR02FT014.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e06::206) by AM4PR0401CA0010.outlook.office365.com (2603:10a6:200:5::20) with Microsoft SMTP Server (TLS) id 15.1.539.6 via Frontend Transport; Mon, 11 Jul 2016 10:21:47 +0000 Authentication-Results: spf=pass (sender IP is 204.154.129.192) smtp.mailfrom=coriant.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=bestguesspass action=none header.from=coriant.com; Received-SPF: Pass (protection.outlook.com: domain of coriant.com designates 204.154.129.192 as permitted sender) receiver=protection.outlook.com; client-ip=204.154.129.192; helo=usnvwwmspedge01.tellabs-west.tellabsinc.net; Received: from usnvwwmspedge01.tellabs-west.tellabsinc.net (204.154.129.192) by VE1EUR02FT014.mail.protection.outlook.com (10.152.12.148) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Mon, 11 Jul 2016 10:21:46 +0000 Received: from usnvwwmspht02.tellabs-west.tellabsinc.net (172.23.211.70) by usnvwwmspedge01.tellabs-west.tellabsinc.net (204.154.131.192) with Microsoft SMTP Server (TLS) id 8.3.389.2; Mon, 11 Jul 2016 05:16:00 -0500 Received: from ubuntu-14-04-lxc-sim-v11.tellabs.fi (172.23.229.50) by usnvwwmspht02.tellabs-west.tellabsinc.net (172.23.211.70) with Microsoft SMTP Server id 8.3.298.1; Mon, 11 Jul 2016 05:21:44 -0500 From: Juhamatti Kuusisaari To: Date: Mon, 11 Jul 2016 13:20:55 +0300 Message-ID: <20160711102055.14855-1-juhamatti.kuusisaari@coriant.com> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:204.154.129.192; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(368134002)(189002)(81156014)(8936002)(189998001)(6806005)(81166006)(8746002)(86362001)(53416004)(450100001)(50466002)(77096005)(586003)(5003940100001)(47776003)(92566002)(8676002)(19580405001)(68736007)(48376002)(2906002)(36756003)(19580395003)(33646002)(87936001)(106466001)(7846002)(97736004)(50226002)(16796002)(107886002)(110136002)(50986999)(356003)(2351001)(229853001)(305945005)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR04MB1267; H:usnvwwmspedge01.tellabs-west.tellabsinc.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-MS-Office365-Filtering-Correlation-Id: 77d560ba-8a44-41e9-a788-08d3a97529c7 X-Microsoft-Exchange-Diagnostics: 1; AM3PR04MB1267; 2:zx8L8WnGgizGDRe01/Rv+pnns735q3DAQKW2TWPw7Qae1aJyHI0HeQd3TwlxNbr1ip833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3nxoXfN3u7aW4gCbH2XstWHh3uDrWD65x6Qk9lxgLQjwkGVHaDlYIw2XnhBkhDpdw//v60WGfpwORj0ch1edg==; 20:Uf6tYjIq4FJ9QTi5aOEQ780P4+wseZsCE0bTFOhREW01XFc+Lurpnx+b3KyxamsN/8ikpnH6kVOKV2Wto4E8kFw5k57Ih1MgpVva946yauTLMVpNzfCkBW92MBdO51Ua76Jlli23iQrrJEE556Mf03ttb2Kl5Bq1DDEnvBkqeJkuw+6+l7lm1LtRL54R8G+Z/nkVUvrZUHqhc5kDJ7KnOoX47COBPPzqKzWa+1JBPnLMkRrbo3RfmhGIj2vpJqWr7xkx1fKSHSP5+d8H3s5N27sqzO3UyJV4W+/QXSact9v9zYBdRDeTJK5QBJKwOkuT+fyUffaFq/4NW0T6e47rIs6AGgaaCP6nEIt8JgTyVirul9acsc6djFeJat5Ulvd050Mfoq6DWAbm0LHmskAPrX1VYFwhO9y3VT2vAJ70oQPx4PEvBxvlt3CYUxKZXmlsZ3bWkl7AW2gAi5Bk+Bf5s/gKcOARcu0A8s6fReNCbZ4+VQ7V+tCN5h7/i5kBX54m X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(51653755401839); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13024025)(13018025)(13015025)(13017025)(5005006)(8121501046)(10201501046)(3002001)(6055026); SRVR:AM3PR04MB1267; BCL:0; PCL:0; RULEID:; SRVR:AM3PR04MB1267; X-Microsoft-Exchange-Diagnostics: 1; AM3PR04MB1267; 4:Hf0Lqt4hwwaXloL0iSUgFUhXIpnBElzDwPUjXzLpcc7Y8cyDtU+8j7WazrF93V4DaeZ19uRtiRcCbcthZaf1JZa3cMyuwklulrsArV+yxb/lQzaPV1eFHZ6Y5rnvK3WgeC5PEVlaXVZE1BRQAyZMIBtfMwYPjkEjSXT03K4GcNxOhVt2utspw2F4nl8BpDAM+ADg8DMJF1aFnbd4Ud6b28xc9Y7V3heXZ/eBMUuE9yhr5XnwiVGzuVFxgjcRTxCCyVEKNNy2M3ciQMWm/rj63XaIEHiQXI7DGrqOfB8IV/S2Se0drn8JprjuZAtZSv13JAxQ4Y9AppXMybngv4X0Al2SysDQtKl9Ip/imnI3p3QeY3/mrfw6mvrpbhMm41g9UQRuHn2m3fcZ8EwXtFG/5k15u/1jzb2AStfngLQ0q4iAaH3+zcVgLR4tD38vBIEBChlP+3gh5ljo917mYLKgbWwNPztEy+bJIK2h2kKSc8SJsLkIocLo1yKYnNAN1NO1bj9LfgiIROZFs6it9Kja6g== X-Forefront-PRVS: 00003DBFE7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR04MB1267; 23:exFOPMRXNiwsUUBzolI5e8bcP9p6sq/rGevm0Jz7E?= =?us-ascii?Q?lHfi3u9G86sKuIiW3YfVVo29DWP5LfKoeuUlWFLjwE/lXdi9pHev4lKsDplz?= =?us-ascii?Q?UUEwlQza1d7z3YU1kg8rHZWcRMCjcNt7J45owR+s+trfadIlA38ay5SirQbs?= =?us-ascii?Q?SD12TD6lIx9bZfDcmeKaUE1HvYssCdgNjxhYQlmPDjQPaQHdxoY5xtBT3ycB?= =?us-ascii?Q?TXkPq1cbKoU6t5WrX6mtmafadgvDDEzKBgnV0S6uOI/6LtchfaZ+cxGBb+z6?= =?us-ascii?Q?bp1dssb+QRrmP2I9eIQsFUcLB/b8tR3XyC7XqN3VDbJM/LfeqN9mQckwyFUJ?= =?us-ascii?Q?FDUNXgwfgCuflLYywzGD3EFREzSuQCT9nLLuPntX+kC38wub3bk0YJcr6miX?= =?us-ascii?Q?isNqyStuRTeaXdRtgy/VnmkB28YZ2Pp2HxMWukSM/kqPC6Q7iZKxEvd072cb?= =?us-ascii?Q?objgdkJD6kwHEBv7+G05uAoPPYqhz9WuDFNNIrYSFVlL4RKi+xvc6uqtiPO2?= =?us-ascii?Q?OE80652+esvDeXlqVy9Vphki1jd+2YM/dHiaT2Uq8YN0DnKVOZQ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BSYntTYq9dJreBUVG0Z1BLlziCxUncOCvdgUWlrXYhtDQwJoAUqjQjJn7fUR5da4R53PMi6HO6vzriPfMVtX6p7QhvmqVB0oJvSTnH8Cfy6b1SBz8N+L/ffJWqStkiF3Pq07g==; 24:QB+sHJ80x/Tmz9bBr7k4sJaPMVVsoeDFBV2T2GsIDAonl3ppk4tYWgYfNcu2WBRvuhI5GjdXEi7YPyDveoFpjDE3LxIydRX9zzeKk4JmSUE=; 7:ILGNrKwfVl3KMRm+vbrKOwZZ8SAcGx9eD1rqJNv0dY0K5uLEXvp3q0TTNtxn1PNJ38IfP07p+0LIe0wa0CEx8iurljEmDHBhmlFScOZnR2EkhmPpwwfsgqupULi3XKnrqzqNKqibdQso6Md0uxrB7IoygND8Qew5QYQTJBwxRgZMjPY7tBwQ1aWn77tTPFMn5WQh+8ETJTWQO9D3gx1/lXLCxTeOMShdxwmhXRCS/iwdioAAtf13puLcO5iPz5Qn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: coriant.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2016 10:21:46.2371 (UTC) X-MS-Exchange-CrossTenant-Id: 76595477-907e-4695-988b-a6b39087332d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=76595477-907e-4695-988b-a6b39087332d; Ip=[204.154.129.192]; Helo=[usnvwwmspedge01.tellabs-west.tellabsinc.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR04MB1267 Subject: [dpdk-dev] [PATCH] lib: move rte_ring read barrier to correct location X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2016 10:21:49 -0000 Fix the location of the rte_ring data dependency read barrier. It needs to be called before accessing indexed data to ensure that the data itself is guaranteed to be correctly updated. See more details at kernel/Documentation/memory-barriers.txt section 'Data dependency barriers'. Signed-off-by: Juhamatti Kuusisaari --- lib/librte_ring/rte_ring.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index eb45e41..a923e49 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -662,9 +662,10 @@ __rte_ring_mc_do_dequeue(struct rte_ring *r, void **ob= j_table, cons_next); } while (unlikely(success =3D=3D 0)); + rte_smp_rmb(); + /* copy in table */ DEQUEUE_PTRS(); - rte_smp_rmb(); /* * If there are other dequeues in progress that preceded us, @@ -746,9 +747,10 @@ __rte_ring_sc_do_dequeue(struct rte_ring *r, void **ob= j_table, cons_next =3D cons_head + n; r->cons.head =3D cons_next; + rte_smp_rmb(); + /* copy in table */ DEQUEUE_PTRS(); - rte_smp_rmb(); __RING_STAT_ADD(r, deq_success, n); r->cons.tail =3D cons_next; -- 2.9.0 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any reproduction, dissemination or distribution of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Coriant-Tellabs =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D