From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60068.outbound.protection.outlook.com [40.107.6.68]) by dpdk.org (Postfix) with ESMTP id 3693E1B2CC for ; Fri, 19 Jan 2018 01:44:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3D/oUhJs8mQ0bnlipk3HKQy4ANIn9qSvh4qWwW66y7c=; b=PXKp7Wco6sFWDSZ3JfO9byymK/Ifp/oYXSF3eIOT9YJdSYlsFt51ZdxFmTifAEOvuvzs/TKw4gsC2Ucv0Dba2eDvfPoeZd+akhoVA6KKY7PXNWZy0k2uUwe8VFQxKd68A+4tkcr9BgKCt54tpZ97ttPoGs5RxKdCQa5DxIXUfE8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; Received: from mellanox.com (209.116.155.178) by VI1PR0501MB2045.eurprd05.prod.outlook.com (2603:10a6:800:36::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Fri, 19 Jan 2018 00:44:48 +0000 From: Yongseok Koh To: adrien.mazarguil@6wind.com, nelio.laranjeiro@6wind.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, chaozhu@linux.vnet.ibm.com, jerin.jacob@caviumnetworks.com, jianbo.liu@arm.com Cc: dev@dpdk.org, Yongseok Koh Date: Thu, 18 Jan 2018 16:44:23 -0800 Message-Id: <20180119004430.15305-2-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180119004430.15305-1-yskoh@mellanox.com> References: <20180116011050.18866-1-yskoh@mellanox.com> <20180119004430.15305-1-yskoh@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [209.116.155.178] X-ClientProxiedBy: DM5PR2001CA0022.namprd20.prod.outlook.com (2603:10b6:4:16::32) To VI1PR0501MB2045.eurprd05.prod.outlook.com (2603:10a6:800:36::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27e8efd4-bed2-46be-a131-08d55ed5d93c X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:VI1PR0501MB2045; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 3:KWdSUFt/izERKg1XZll6PSurIf3krSRGEm0MHQ4aIrGFfV5pl703w0pjg39+7h4yZ6g0VOcO3Vjg+MWsAhQFPQSKBNh6W5Lb6nkagqh/4T1KyyyhSrTMRvF/pyCRSqYC5xcTItIUY8geBVRnzqyDQ/GxhvUUfs02eUjZxeGOOBtCcEh/ycWaN3lLW/lxIc7Jpb0UJ160vEzmQaiQoPFCpOMolZDsVExa7TGeLv5Bi1if8r2RbRvcMDjaLBQ/c50O; 25:GWVmyOgj482+XeCuDP+buMiCjhlr5Jn7n2UczWZgbys5zq/cfSoRBGpGqep95dZxrPocWLOwxj4NbQT2fDTwD1rp6ByJ+5Z6SmBvK8PiKFwxCJqZEuDO6qXxYGGwILVxTenHEcBzJBfeA6bntB76Ll0HGSarIyxMVjvl9Idwk8nShp3jptP3un3x0IIeatMOvMJxZ77grvCbjYS/V6afxNLDwekAzKPjmeBRf+12Ihq8c2KDQJJDZIC4EShWC6aQnEZevWVlipMi+kHf+V3X/SUlKB1ZXB+ftKmOn/A4wK5goht0tgNLxyrzC1yIX3iOaj0Dj5BEq63FFfuHeGrHfw==; 31:sBryq1O/1yrc9DDoevW0FwDO8zrR5Vw9zaNbIw0zBaK2+ZSTU61XdcnlPIM1z3TVxcWpIF4BEs+WfGezm4JRSZyCcSsQriJbAksQO30YqfEDO5X1ixkcB3GnhKEBXwbHNuPf1EBligVN/ewmrJG2rvUZIhlyi0coKl2UHrJoslNPyzmyJdti+OATYkItzAvN4/51Kvu+HPoTH8EsBRDfXpUSzrzjSyYiDL0C9FTAuzo= X-MS-TrafficTypeDiagnostic: VI1PR0501MB2045: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 20:EkpUz8FG5hmT73IvaNVmxxO7k9H29VButsxiBWsAmvaRr7aVFK1BAROQNdCyigG9aUn+aUo351boI98+u0l/r1z2TtPcF2NY1sF+O1mwJmEondB4YdyXddwpkIqs7V5eTgBsHyBdOriz+7381FMHD4TPOYItpQJm9NaHw9QFLAvhdmr8DIEHt+A1c4XH4uRdxsAzwq62kxuSfsPA+IWheNebG08N0GjEycnzWEesKYmWiO5wEkjB1znX7J7VeLnzHlX2azCCZ4Hp1hY+nQ4YGUIWpBseGV08ZbFt13nZXBGI9TZMzTk1sFq4SLJVP7AMjW6UaUQKOmYkKv9Nk6yAfYY7i7sTbmZwgmtdl0p9cHxhK16LBKpW8VAhHXVgVux3zhZz54z2fL49dVIiNzn5xAwh8ze7G9pSsP9JnkoPETozhMz916dtya1s4Vb4PKDVAJHuec9CUnE7N4j07hvs05DRC+qlpSNMq8vPoxeEtvH4XRHqBKZh5wh1lT9dNSA1; 4:cmJyvk3BCxiliTDCTK8uPZAq6wd2jlMDIM9qNRyUk9P736ic/CFZNJofVNg4euoQH0ccdghnGPlncQJAet+wo8zkGKTSv1eySLGDYe0UGARAYAAGYYQc3Q6UfphkYXqUsZUxiyTNwnNSu4YXiFaEqzcBIAshlI1F/+Hwufy1Pd656yPIkXsFZsGEYkkTlMZp33ofSOc+LB76D7fg/T19eBib1cWvK34xaR5mSJuxQdvMkz69PqsdGQ2kvuJ1SeDsF0rUCtMmsh46NM9t85NOnA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040495)(2401047)(5005006)(8121501046)(3231023)(2400069)(944501161)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041282)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:VI1PR0501MB2045; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0501MB2045; X-Forefront-PRVS: 0557CBAD84 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(346002)(376002)(366004)(39860400002)(189003)(199004)(25786009)(48376002)(59450400001)(50466002)(386003)(7696005)(76176011)(51416003)(52116002)(4326008)(478600001)(86362001)(36756003)(305945005)(7736002)(16526018)(26005)(16586007)(2950100002)(6666003)(316002)(97736004)(5660300001)(105586002)(106356001)(53936002)(47776003)(66066001)(8936002)(8676002)(21086003)(81156014)(50226002)(81166006)(2906002)(6116002)(3846002)(68736007)(69596002)(107886003)(1076002)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2045; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0501MB2045; 23:eRBRXON2FePH5jYZSEYZsSpJ8MVH7KB+Td6PcMO?= =?us-ascii?Q?o3pfa67DPLM5SqiwkAxiO7cJtNVb7YQ1ZmYyS/uqtUXVJ2N1tZGwihcyzGyN?= =?us-ascii?Q?87A1KuZuPsx9FgRVL4GzcxQKJG7LEnDHQFzFlxz40KYfCkRJDVsSYBbZ0ALT?= =?us-ascii?Q?u2CmihkY2aRY0kXyM351Y9OLD7grqPoaY3SpMYd9DUWhMb+oDJ2iH7nY/2SX?= =?us-ascii?Q?KXhwt3brphMoGftcezbuIEoyvHVZArdW3GWT4YT32LsAgj/Drfcn74RdXug5?= =?us-ascii?Q?tHYwUAubWBij/EiRmkwM/9KUX3GiW4BXr0bjINRDkbc1vwH8FJKWDYf550jl?= =?us-ascii?Q?Ffmqk32HNTWjtrbOKyNn9BR1/Sp0gpgyuvF/NE8vyyo2FvSicA7dEzLvYcwO?= =?us-ascii?Q?51LEsicF/A8IWSfrPJWjnEduE1ggPXOHJr5HRzsH7GDfHRM6qddHGkfsq+RC?= =?us-ascii?Q?jm+87d3HwktpUvZBe6Ex6IMyruBb60IxeV0NJq/KNOhXijvxY3B9wmOVgpuq?= =?us-ascii?Q?9CYdUkC8OA76rjy2jJz+y69EuJ859oaP0G31ojvmuBd4vH66dLSWN/oWgwIR?= =?us-ascii?Q?jHG6oMfGtlaT/qRy1d9+S2RDid1Gavkf2tLBMiQfWttvcjWXk5nHIhfJMTPA?= =?us-ascii?Q?49g56EUoYr4Mt19Y6XAYIu9h02AqukTx5fT+E/SjUtMMPk/qScJO8Pd9JFjm?= =?us-ascii?Q?fX+dcGLthL24PE22eP33ENwH8GOt3UoVvAzxoz8luB3goRM9xzsDyRylJzf6?= =?us-ascii?Q?AUJGchLXPHWZ/AIU/WTFyJF2ngoTEtpI+GNs159HlMchwYAsLRWfQIJQJgSi?= =?us-ascii?Q?txjuwd/XSqSxJKbWJnyXkVUjszQ0G72E+sWGZJDAHlmVXpSgOnWKW+GnRRBV?= =?us-ascii?Q?fyt51T0M2FcObcOj+VRw47SfY3wK+U1taKgWqMhNsiZ2KCbpNjFm6p9j/s6N?= =?us-ascii?Q?x7q29yStmDZuewhBfByJFxldw2ii+fn70eGn3+2L/BkcD/TusfxTw89MTh+Q?= =?us-ascii?Q?lE0dPOZe0J6NCjNKjEOZZ+AJV9W8j8X1rtclxXXZThgKsLAejlsa83CzCB8L?= =?us-ascii?Q?NzeUie+u5PEfmZO/k+Mrj0BkxOzNbIQidweIOvrpQy8pZjBtDDrnXrq1fSb7?= =?us-ascii?Q?5nncxCt6secxRMyyeBP+XlTHyDDn5Eb4AScDNvCDdR7YNd2yM4qT3oA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0501MB2045; 6:2a7IZPDbr6vmUuYV7C3GwS/XtOXOOa6MYKHzvj7qpnz32Lf+kgGWLh8I2Fw6Sg378BvhHTq+GQUoTlPBVhQPUcHUQ9tgD1iNekXl/T8ue7yhOgWC/jBmFVVzFgDV5OtCiO7tvzvdsrrOxxRJAbYGjEzrlocWkFFO78vjgbSTOLvP7IEixRFIKzuYgGqwblSdvuf5Ert2Rse260qseySwG00kqcIppOr2kb/Mcq486VVeuC9KJ/qiDzKM8iNsBzEgRb2EA91r+vQDECg2z9x6K1DTc1KZA4kLUz5zMVQZtWz/JP5Ox2uJd473AZzsLM/hsB3HWhllUjxP9z5gUBbCQojcgVz+9gjhQgywMWl5YQ8=; 5:JEG/x9VBX21dLdXQvASZGKsEKv1L6oUwTNVumq85/U7Erpp36JHbrk8hf3/Qfr/b7hQf46P15+kmnHG/FBLoxsPNtWIm+0e+2KNU/pPukcfhOFezXaAh0qDsrqKCGbk8ihnrnTzHoayqso2dubWj8p9R1JFG7WetF/k93Vh0F2c=; 24:vv5fFZbgyPiJAtU3RNbvOsKfIzAsYcVwkJpOvHLShgbK0+eHvVOcXVqTLlLzJ6k88ILzrQgYuSEXgZ/S7CMk57Nn5urrTJ+UR1O5NRvD/H8=; 7:dqlXDQXmx9apdUY1zgbOQPKQbD7Z4sSk9v9nJxeH18ecWxiAH9P/TEHy1MqHyGNyXOhIKP9gnWbQPCKd8Y8zH1WeYvu9ubBfY+DHdK1I9g5ETcnb6FbmAA7XrrCXw5v0OFA9mlZxeEAKzLKjj3Cn3FRkaR2hwpOYbD+P3X3ywWzy7bucB727OPupyfSWCl0TaH1hThGEun3R/9eaSZCGC7AKV6CPCSBK4OcP7M/3DBevSfUisBRVNeIjwksq1kGn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 00:44:48.9404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27e8efd4-bed2-46be-a131-08d55ed5d93c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2045 Subject: [dpdk-dev] [PATCH v3 1/8] eal: introduce DMA memory barriers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jan 2018 00:44:53 -0000 This commit introduces rte_dma_wmb() and rte_dma_rmb(), in order to guarantee the ordering of coherent shared memory between the CPU and a DMA capable device. Signed-off-by: Yongseok Koh --- lib/librte_eal/common/include/generic/rte_atomic.h | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/lib/librte_eal/common/include/generic/rte_atomic.h b/lib/librte_eal/common/include/generic/rte_atomic.h index 3ba7245a3..1ffa51e31 100644 --- a/lib/librte_eal/common/include/generic/rte_atomic.h +++ b/lib/librte_eal/common/include/generic/rte_atomic.h @@ -98,6 +98,58 @@ static inline void rte_io_wmb(void); */ static inline void rte_io_rmb(void); +/** + * Write memory barrier for coherent memory between lcore and IO device + * + * Guarantees that the STORE operations on coherent memory that + * precede the rte_dma_wmb() call are visible to I/O device before the + * STORE operations that follow it. + * + * DMA memory barrier is a lightweight version of I/O device barriers + * which are system-wide data synchronization barriers. This is for + * only coherent memory domain between lcore and IO device but it is + * same as the I/O device barriers in most of architectures. However, + * some architecture provides even lighter barriers which are + * somewhere in between I/O device barriers and SMP barriers. For + * example, in case of ARMv8, data memory barrier can have different + * shareability domains - inner-shareable and outer-shareable. And + * inner-shareable data memory barrier fits for SMP barriers and + * outer-shareable one for DMA barriers, which acts on coherent + * memory. + * + * In most cases, I/O device barriers are safer but if operations are + * on coherent memory instead of incoherent MMIO region of a device, + * then DMA barriers can be used and this could bring performance gain + * depending on architectures. + */ +static inline void rte_dma_wmb(void); + +/** + * Read memory barrier for coherent memory between lcore and IO device + * + * Guarantees that the LOAD operations on coherent memory updated by + * IO device that precede the rte_dma_rmb() call are visible to CPU + * before the LOAD operations that follow it. + * + * DMA memory barrier is a lightweight version of I/O device barriers + * which are system-wide data synchronization barriers. This is for + * only coherent memory domain between lcore and IO device but it is + * same as the I/O device barriers in most of architectures. However, + * some architecture provides even lighter barriers which are + * somewhere in between I/O device barriers and SMP barriers. For + * example, in case of ARMv8, data memory barrier can have different + * shareability domains - inner-shareable and outer-shareable. And + * inner-shareable data memory barrier fits for SMP barriers and + * outer-shareable one for DMA barriers, which acts on coherent + * memory. + * + * In most cases, I/O device barriers are safer but if operations are + * on coherent memory instead of incoherent MMIO region of a device, + * then DMA barriers can be used and this could bring performance gain + * depending on architectures. + */ +static inline void rte_dma_rmb(void); + #endif /* __DOXYGEN__ */ /** -- 2.11.0