From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0721.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe46::721]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 908AB1A1DF5 for ; Thu, 11 Aug 2016 14:34:25 -0700 (PDT) Received: from AT5PR84MB0291.NAMPRD84.PROD.OUTLOOK.COM (10.162.138.25) by AT5PR84MB0289.NAMPRD84.PROD.OUTLOOK.COM (10.162.138.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Thu, 11 Aug 2016 21:34:07 +0000 Received: from AT5PR84MB0291.NAMPRD84.PROD.OUTLOOK.COM ([10.162.138.25]) by AT5PR84MB0291.NAMPRD84.PROD.OUTLOOK.COM ([10.162.138.25]) with mapi id 15.01.0549.025; Thu, 11 Aug 2016 21:34:08 +0000 From: "Cohen, Eugene" To: Ard Biesheuvel , "edk2-devel@lists.01.org" , "leif.lindholm@linaro.org" , "liming.gao@intel.com" Thread-Topic: [PATCH 1/3] ArmPkg/CompilerIntrinsicsLib: replace memcpy and memset with C code Thread-Index: AQHR8/01dHO/RFTUsUaiX85wquZhcKBERUEw Date: Thu, 11 Aug 2016 21:34:08 +0000 Message-ID: References: <1470939632-32198-1-git-send-email-ard.biesheuvel@linaro.org> In-Reply-To: <1470939632-32198-1-git-send-email-ard.biesheuvel@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=eugene@hp.com; x-originating-ip: [15.65.254.4] x-ms-office365-filtering-correlation-id: d42632f7-ad5c-4e0b-636f-08d3c22f3a06 x-microsoft-exchange-diagnostics: 1; AT5PR84MB0289; 6:yo72nsmCJvCAFT5dB35GtxvSyWxScUVMXVvndTj5c9u4t/p6BX8JCLGqCQRlGVWA1TKz1QuYeBHx3vNp8Rcz3apZXXFpwtd0Dgd4mcRXkvJIx3P03uaAIB7LiSi8lTo8l4j7FxR1s6Cs2cKIFnPDXbijhnKPwVp6xjI9fEJ4lUQnyW5su5KkU55XIiNuNuPqldT44nT85syFR8unApKIDWfdJScrpscMXtJ91n7btzyG16XVgDkkaPl7vuazTHjsnyVXIUjtfIh08J12B6ymQGhnOUq8M3g2nF0d9UHUDk4=; 5:fBY57NyW5+GaEWagX72+WMmUPJhKsSogkL3yYT5nbdQGAV5cGugEOynfmOd08KToeh85r4athJOv4hslL6CWDwxyEtcSqfu38XfKcol21NYH3ROTaK7EYkqMjrlhCyjqioQKN2yX2/JnZbKnzrFzhA==; 24:XAQqqDftBgqryFzk4r6X9pGZHMRU7R2oWKbxcK00NmHqXihKyB2/G0qDLCBCzPiH51iGNA9/2kLAFtY4O2+yjvVaNTlXVbo9eJWegNdP8B8=; 7:2Wcjps9pmaSqQDhbDElgFyTWOajeeLAyoFS8t/vl318WflqDpHTF7ZzQkmPr3Mah1JwLnyRtL3sU+R0jodvZTf7c7JrfCfEQQGqt171doQ4eKo2Pn0qBCUBrrCke62mfrDvBYU79hLTU1x1mhzxuvRGc+U29ZWgXPJnD8wTCtc3FFXagmBqy+mnyswXpBcXREjMkwD1+yE6XWcjMgxx4KJkVlO5/jijvESltr3d5ztUJYWBnKzCrka9dV5CdSg3R x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AT5PR84MB0289; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:AT5PR84MB0289; BCL:0; PCL:0; RULEID:; SRVR:AT5PR84MB0289; x-forefront-prvs: 0031A0FFAF x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(6602003)(199003)(189002)(8936002)(68736007)(33656002)(9686002)(86362001)(106356001)(2201001)(189998001)(87936001)(106116001)(2950100001)(7736002)(107886002)(77096005)(2900100001)(10400500002)(2501003)(586003)(122556002)(7696003)(7846002)(81166006)(305945005)(81156014)(8676002)(74316002)(5001770100001)(101416001)(3846002)(54356999)(6116002)(50986999)(102836003)(76176999)(5002640100001)(92566002)(66066001)(99286002)(105586002)(3280700002)(2906002)(3660700001)(97736004); DIR:OUT; SFP:1102; SCL:1; SRVR:AT5PR84MB0289; H:AT5PR84MB0291.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: hp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Aug 2016 21:34:08.1149 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: ca7981a2-785a-463d-b82a-3db87dfc3ce6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AT5PR84MB0289 Subject: Re: [PATCH 1/3] ArmPkg/CompilerIntrinsicsLib: replace memcpy and memset with C code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2016 21:34:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable > This replaces the various implementations of memset and memcpy, > including the ARM RTABI ones (__aeabi_mem[set|clr]_[|4|8]) with > a single C implementation for each. The ones we have are either not > very sophisticated (ARM), or they are too sophisticated (memcpy() on > AARCH64, which may perform unaligned accesses) or already coded in > C > (memset on AArch64). Ard, I'm concerned about the performance impact of this change... there's a reas= on for all that complexity and it's to optimize performance. Why does memcpy performance matter? In addition to the overall memcpy stuf= f scattered around C code we have an instance that is particularly sensitiv= e to memcpy performance. For DMA operations when invoking double-buffering= or access to portions of a buffer that is common mapped (i.e. uncached on = non-coherent DMA systems) the impact of a non-optimized memcpy is enormous = compared to the optimized ones because the penalty is amplified by orders o= f magnitude due to uncached memory access latency. So I would ask that before a change like this is brought in that we charact= erize the cached-cached and cached-uncached (and perhaps unaligned cached-c= ached) performance across the implementations. Based on my experience I'm = expecting both cases will take a massive performance hit. >>From your commit message I'm inferring that the problem you're solving is t= o play nice in environments that can't tolerate unaligned access like when = the MMU is off. I get that - and I think a variant of the library that pla= ys nice in these limited cases makes sense. However, I don't think we shou= ld drag down the performance down of the rest of the environment where we s= pend the vast majority of our time executing. Eugene