From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0094.outbound.protection.outlook.com [157.56.111.94]) by dpdk.org (Postfix) with ESMTP id C7AE537AF for ; Tue, 3 Nov 2015 16:52:30 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@caviumnetworks.com; Received: from localhost.caveonetworks.com (111.93.218.67) by SN1PR0701MB1982.namprd07.prod.outlook.com (10.163.131.21) with Microsoft SMTP Server (TLS) id 15.1.312.18; Tue, 3 Nov 2015 15:52:27 +0000 From: Jerin Jacob To: Date: Tue, 3 Nov 2015 21:22:01 +0530 Message-ID: <1446565921-18088-1-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BLUPR0601CA0006.namprd06.prod.outlook.com (25.163.210.16) To SN1PR0701MB1982.namprd07.prod.outlook.com (25.163.131.21) X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB1982; 2:14GnzRBKo4LAcUSUW3qFBx96ESXknizi4Q+vopFi3fgtiqOxBVetZoJ+Cd4Fwcgp2VSYXm1/RKK3RIA/ffbD0dCtMJ070EhYSjl4Wv6pjjCb/6AMdEadwJSj9Xo6IiLXAyb/LOMEyKvpeFMFol3AccZxyC0pg3uoE94zjLlvFtI=; 3:qtIoOjcECkh7hfnqmyzgLm4EQ2jwF+QlfQD2MqIxEGAszNj5Nmu49GLFdOpgbszfrk/IzJYFMzdWKHsoIM3eGYQBAFrKb3RrGZJLD95wA56HgVC5d6jjITywQGDLbAzPb2EwrY+7S7S6AYBDHowPEA==; 25:9ySAPl11zbAc613DeVVeStx67pY5ToedQt8nTPCC7AWukO0lZY3MuxSn8rJF+6dGYQu3/mxbglnLWxb04QXtwC+FooqUH7IrAbwfXV+Be3nbuE3CfN/NKEAHCLUIzFqXMU4y8isNIsS7DR+ECipJ2+EBHwF+uO+J7QneqQ5/7NbKSniBMLTqxzQHyt6HEF8arsTI3TyfqfIAgn7K4wNKavxgPt2d+OBqqqsskcILCXkfptytTYF3Xa8Osxt8b2CYBJs0CZHfF6s3Xo/e9+m9JQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0701MB1982; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB1982; 20:q5nSbcJXKTfrcYenkx2Wt7kBSGgvdlXiTmi4FO/gqGsATPVviHfaGrtYoFatoDmlHl3iXAQv09e35e9zQDhMUM1UIa/7cLvOEHqhgjoA6eOvWORbt6B3PY+FBPCumbnPtSD+DIvE2s52Tm4SA5LR+bCYyr1mTOX+DgxzuL7vJRFhny57xhjqhZJ6ZeHOyPyikmZ4FUC8hKgdoPqOPSMaABIuK4r6QqhVVQIDrkbX30nEah5CsCdvklrFDTsP6D1y/4hb6Kq5ShEZaZY3+Tt5rpp73aR4fo8uLaQakY39/P83didu0bP32mDvsUVjrFy3QtTjBfl5Zcxtsslj4dL2FyvDrQMgZwwtkwiHqeMcFPlZ+eGDQfkkJ5Q8RcOako6kq9dRm7NSLGR/kmZoc1bGcBHnaZIvRNz6Y0i/HV59f9HHrBbXgS7Td8RT5bc02SmPkrd2RlwSnNW1MNTQPOBYmyteMaGgti9vOxAPQFicXFHi9U2ux0i9ZZMBaPtIyxGibq9Va9GlzxjKHhj3tKHMJeV/6u+WkVL9+ui6wnfCpTMRPtnCrhPVQcLas1Z8JskUU1/bipIF68A1tGBhDO2+vIHPw5EaumAhqg+uNE95Tpk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(520078)(10201501046)(3002001); SRVR:SN1PR0701MB1982; BCL:0; PCL:0; RULEID:; SRVR:SN1PR0701MB1982; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB1982; 4:P9hN53bOZcQIxcTJoi/E2OvTLOqsoyhKF1pyTbq831X+zLM8Y9MwsX964TsqP0VMnP99IfnB1QXW3/2sPJzLnS9NXmHIvfe9zWM7BFQaSdlSaPFf4h6VqS78VLLZvdGma6zTLknA+/fmMVsCHycy5CFF0rQTmcyMeymPqiKoz821ToYPqlWkAQ1kQcM3DgqA7MkVgIPm21eT8H4puiZbqoybLeKfusyON+kUU1oL5HbZjgJPxd/3pXQH2GzBqCqa3k3pW3AL/T3EaHcVXyrO/rbsp5To7AvH3501W+mK0sDjqyMUriDDwCHZ3TEaAmqa6d5Wu7k0jZ9sqX1lAO9hsxkI2GLsaXGR/X5juJl6KksVxKptSS3uIhjQVazGH0/3 X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(6069001)(189002)(199003)(76506005)(66066001)(5001960100002)(33646002)(50226001)(50986999)(5009440100003)(81156007)(69596002)(40100003)(97736004)(36756003)(47776003)(110136002)(229853001)(101416001)(4001430100002)(19580405001)(92566002)(5008740100001)(77096005)(86362001)(87976001)(122386002)(107886002)(106356001)(105586002)(5003940100001)(5007970100001)(48376002)(50466002)(19580395003)(53416004)(42186005)(2351001)(189998001)(5004730100002)(7099028)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0701MB1982; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0701MB1982; 23:5EGXvdeskEanm4b1VVGmTUQyWWx0yi0CBLamWzP?= =?us-ascii?Q?6fze9E4kn2DUVlx2df7kfb2XvVRnqj+0T+f8P1X7aGsHO/4vVcwLbhaz2MEv?= =?us-ascii?Q?jQCu4amPnIKolRGgQD75IX3VTp2ABdCsTnKZB4sc05sGfkk4ljNQchM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qRcSU5jqLvArFvkAZ7LztSYl6jzBmCJ+0z3?= =?us-ascii?Q?RBIPYzghGllX87JbSzxtLINMS3XQ14+hPhLACUHscC/Kc8tObh6pFpbILc+0?= =?us-ascii?Q?3uPjMNxoXUB0zwl0+kJAQKf3UwMywz6QvKgH42BdDi0qV2J6fDFhMXzB9zGO?= =?us-ascii?Q?fIbA6a4KFDKbdCabZYW1fxpyaHV/p+82mNSkTtl6dvJCchIcZG7btKa5QiSs?= =?us-ascii?Q?JUWbiMg5gCkFQyb8Ntdk=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0701MB1982; 5:W1fhsZ/iEhUH4iG0lbPyr19U3mZfz99/NvVkUlTFdfnsp2eizpz9OQFwDNObGaAng1Qik/28iWSrM/+GVZ0l/1pVsLiCKmvCGtxwPl50ZejxrzrBwTqVJYi+GQyIDTKo4trfzuMmmz8/KqcjhdZy5w==; 24:9juIHZ9p8ZJelR2XI14d1DLRAqIBJmhJDvKRbGudHGkmQbKCLxgcAIB5DwNWKfLNehXDCz2AmDo7d/F5HRkBAmXIH0k0nNXe4xnN3wWGZes=; 20:hbak8dqkTEaoERLizgy/7idaxYzHHHh0Bm/SxQUlH7Hq82UfPYUiIUm+jR6BNahln+aGlkanrzJuugU/s7PILA== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2015 15:52:27.2800 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB1982 Subject: [dpdk-dev] [RFC ][PATCH] Introduce RTE_ARCH_STRONGLY_ORDERED_MEM_OPS configuration parameter 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: Tue, 03 Nov 2015 15:52:31 -0000 rte_ring implementation needs explicit memory barrier in weakly ordered architecture like ARM unlike strongly ordered architecture like X86 Introducing RTE_ARCH_STRONGLY_ORDERED_MEM_OPS configuration to abstract such dependency so that other weakly ordered architectures can reuse this infrastructure. Signed-off-by: Jerin Jacob --- config/common_bsdapp | 5 +++++ config/common_linuxapp | 5 +++++ config/defconfig_arm64-armv8a-linuxapp-gcc | 1 + config/defconfig_arm64-thunderx-linuxapp-gcc | 1 + lib/librte_ring/rte_ring.h | 20 ++++++++++++++++++++ 5 files changed, 32 insertions(+) diff --git a/config/common_bsdapp b/config/common_bsdapp index b37dcf4..c8d1f63 100644 --- a/config/common_bsdapp +++ b/config/common_bsdapp @@ -79,6 +79,11 @@ CONFIG_RTE_FORCE_INTRINSICS=n CONFIG_RTE_ARCH_STRICT_ALIGN=n # +# Machine has strongly-ordered memory operations on normal memory like x86 +# +CONFIG_RTE_ARCH_STRONGLY_ORDERED_MEM_OPS=y + +# # Compile to share library # CONFIG_RTE_BUILD_SHARED_LIB=n diff --git a/config/common_linuxapp b/config/common_linuxapp index 0de43d5..d040a74 100644 --- a/config/common_linuxapp +++ b/config/common_linuxapp @@ -79,6 +79,11 @@ CONFIG_RTE_FORCE_INTRINSICS=n CONFIG_RTE_ARCH_STRICT_ALIGN=n # +# Machine has strongly-ordered memory operations on normal memory like x86 +# +CONFIG_RTE_ARCH_STRONGLY_ORDERED_MEM_OPS=y + +# # Compile to share library # CONFIG_RTE_BUILD_SHARED_LIB=n diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc index 6ea38a5..5289152 100644 --- a/config/defconfig_arm64-armv8a-linuxapp-gcc +++ b/config/defconfig_arm64-armv8a-linuxapp-gcc @@ -37,6 +37,7 @@ CONFIG_RTE_ARCH="arm64" CONFIG_RTE_ARCH_ARM64=y CONFIG_RTE_ARCH_64=y CONFIG_RTE_ARCH_ARM_NEON=y +CONFIG_RTE_ARCH_STRONGLY_ORDERED_MEM_OPS=n CONFIG_RTE_FORCE_INTRINSICS=y diff --git a/config/defconfig_arm64-thunderx-linuxapp-gcc b/config/defconfig_arm64-thunderx-linuxapp-gcc index e8fccc7..79fa9e6 100644 --- a/config/defconfig_arm64-thunderx-linuxapp-gcc +++ b/config/defconfig_arm64-thunderx-linuxapp-gcc @@ -37,6 +37,7 @@ CONFIG_RTE_ARCH="arm64" CONFIG_RTE_ARCH_ARM64=y CONFIG_RTE_ARCH_64=y CONFIG_RTE_ARCH_ARM_NEON=y +CONFIG_RTE_ARCH_STRONGLY_ORDERED_MEM_OPS=n CONFIG_RTE_FORCE_INTRINSICS=y diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h index af68888..1ccd186 100644 --- a/lib/librte_ring/rte_ring.h +++ b/lib/librte_ring/rte_ring.h @@ -457,7 +457,12 @@ __rte_ring_mp_do_enqueue(struct rte_ring *r, void * const *obj_table, /* write entries in ring */ ENQUEUE_PTRS(); + +#ifdef RTE_ARCH_STRONGLY_ORDERED_MEM_OPS rte_compiler_barrier(); +#else + rte_wmb(); +#endif /* if we exceed the watermark */ if (unlikely(((mask + 1) - free_entries + n) > r->prod.watermark)) { @@ -552,7 +557,12 @@ __rte_ring_sp_do_enqueue(struct rte_ring *r, void * const *obj_table, /* write entries in ring */ ENQUEUE_PTRS(); + +#ifdef RTE_ARCH_STRONGLY_ORDERED_MEM_OPS rte_compiler_barrier(); +#else + rte_wmb(); +#endif /* if we exceed the watermark */ if (unlikely(((mask + 1) - free_entries + n) > r->prod.watermark)) { @@ -643,7 +653,12 @@ __rte_ring_mc_do_dequeue(struct rte_ring *r, void **obj_table, /* copy in table */ DEQUEUE_PTRS(); + +#ifdef RTE_ARCH_STRONGLY_ORDERED_MEM_OPS rte_compiler_barrier(); +#else + rte_rmb(); +#endif /* * If there are other dequeues in progress that preceded us, @@ -727,7 +742,12 @@ __rte_ring_sc_do_dequeue(struct rte_ring *r, void **obj_table, /* copy in table */ DEQUEUE_PTRS(); + +#ifdef RTE_ARCH_STRONGLY_ORDERED_MEM_OPS rte_compiler_barrier(); +#else + rte_rmb(); +#endif __RING_STAT_ADD(r, deq_success, n); r->cons.tail = cons_next; -- 2.1.0