Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbdFTOZe (ORCPT ); Tue, 20 Jun 2017 10:25:34 -0400 Received: from mail-dm3nam03on0079.outbound.protection.outlook.com ([104.47.41.79]:45664 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750993AbdFTOZb (ORCPT ); Tue, 20 Jun 2017 10:25:31 -0400 Authentication-Results: broadcom.com; dkim=none (message not signed) header.d=none;broadcom.com; dmarc=none action=none header.from=caviumnetworks.com; Date: Tue, 20 Jun 2017 17:24:25 +0300 From: Yury Norov To: Florian Fainelli Cc: Florian Fainelli , linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Russell King , Catalin Marinas , Will Deacon , Arnd Bergmann , Greg Kroah-Hartman , open list , "open list:GENERIC INCLUDE/ASM HEADER FILES" , Dave Gerlach , Tony Lindgren , Keerthy J , Alexandre Belloni , linux-omap@vger.kernel.org, Shawn Guo Subject: Re: [PATCH v3 2/4] asm-generic: Provide a fncpy() implementation Message-ID: <20170620142425.7zydhktmf4466bmu@yury-thinkpad> References: <20170617000744.22158-1-f.fainelli@gmail.com> <20170617000744.22158-3-f.fainelli@gmail.com> <20170618235108.peaxdi367jpkt542@yury-thinkpad> <25e87a4c-ecd9-a205-5a25-207a293e0204@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <25e87a4c-ecd9-a205-5a25-207a293e0204@broadcom.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [193.185.223.3] X-ClientProxiedBy: DB6PR0801CA0058.eurprd08.prod.outlook.com (10.169.219.26) To SN1PR0701MB1871.namprd07.prod.outlook.com (10.162.100.21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53a78384-f5d0-4539-a6b9-08d4b7e8330e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500055)(300135000095)(300000501055)(300135300095)(22001)(300000502055)(300135100095)(300000503055)(300135400095)(201703131423075)(201703031133081)(300000504055)(300135200095)(300000505055)(300135600095)(300000506048)(300135500095);SRVR:SN1PR0701MB1871; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1871;3:TPOft+CSecz/nz3XqfqR37854ggEIDrVBLiIwU1Xu3ktC6oVivnn8p6wlNUHXW46HuL57sZNhCthXAL0G+AejMmMi0b5n997Q2qEJrP4si2ClymZbmxs+0Xgv7V9d8fN5BSV8ou6WUre/6EeKJBYisjj/AnM6zk6a7VnmUQvnD2dfM/lHak86KhJkgAfiDyYneuK9TpXswiwT4dwCp9Zzpx9IvrTALt4yAl/ATjY92Svn4kbtL7KFUlrngLXOI8fzPfl7dGRPgy+B1pxx9n1YuWuL8j9hQe5bU9xcYumDyh7fvTwlbRFDg4ExlV14bHlY0pBf8bM9CSv3yT+eazNQDcFeyj9Hg6kFPqFeup/UQMM2shQTn+lH19b20a08msBIOCP4DtcFgulOwAUjjSSpqq1Q8pFiUtgOiiiFkhNbyuKBQs6BEap90/MysS+WZPyUqmFMSxx7d3zwrjIbokWZALxP5ZzQ9WFtD4uZDFSdtPs69x3Huxxfx8xOXjFTivA+dcx6MTo205zL1JbQQLPWfPNfgmAPO5zIaGIY7ymDzGPPmzIcuLHO01R7xW3TjR0g7N8R3tDY/rUMhbaW8a7J8Z3QKu9LroEs6/9dC5k80nbVEuOgwmb84lMBWAPKnHqsxX9jscTaUuNM07sy86XbPoQ2kjRsEaSd58eFeIeu9CNkdvXHq+j049Ao4J3FvgIj+BuRwff54lIXX+v+pbvomEH69Aq3LHdMT/3CzueCJQ= X-MS-TrafficTypeDiagnostic: SN1PR0701MB1871: X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB1871;25:nxYHJDJVQsKtv5wfYG4M2Aa5I/vBXtxYh9Dd155IA+V4AmrJzl/okkdE5byr3aXgyN0QmjiTp6GBr5+P1duklIBwlrgBdwIfveMlk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PMjXit87/RN+ohNINwqLQ8iu10Rm1Evyp6rVl4jZov7RUXTMA5w1jc3faXCVeM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123555025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR0701MB1871;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR0701MB1871; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB1871;4:CqJUOH9qCdhG29+zdIB3ZLfz4biKaY1Ya/fu3Htc?= =?us-ascii?Q?Mnv+7yqqARVROF1e3QOSaSjbI7FH/9G2voK1YvadIt+l++X9ltNoLDSn/ncZ?= =?us-ascii?Q?j8zHb2cISpphUHjRF1HB1ht3f0vPXXOo7P+5MlNuRFgwNh6zEdyOXBnpDDa2?= =?us-ascii?Q?vtGXAWbjnprfOlSZMZ7GFQaVAn2PZV+uexrCoIhiYQfmoq260G1iEMKSft2C?= =?us-ascii?Q?xufiL/chcWuXSfdSD6Z2MNwdQOdB8MWAIq36+2I00SGeAwFcPfRN4s8fggUI?= =?us-ascii?Q?8ZlFCvwNRcZnXSkZYNqrWFj0sQ7CTTNkpU1vqwKI2zyrTYkx5TS+XEI/PiEp?= =?us-ascii?Q?vzWju8p+R02+dIBEkR5zbitJDJlDXTJsaUiP8eWG/jlo67eZLLsJxVAbM1HB?= =?us-ascii?Q?Kc8Km7PhX/5ALeni4EjAYt5qj+DVPNQuxyXdqqY0l4TBcQhtcfex7CZxYNcO?= =?us-ascii?Q?hsa1llTSXHhpa3UdTpO32dVj/M+AznSpFSyVvPwUxTD9Acn3aZTwHOnRysc0?= =?us-ascii?Q?73NYS6fDX7etE9hnGffR2LvoRVv9BE2CZHgp+94TTS6tsHr8dXx5hpv8SXcR?= =?us-ascii?Q?VGY18LT4RrusaC6vunSNQDu6sIfWcyR/SUwYI8GYzxtjsvBkJPlWQTIITN36?= =?us-ascii?Q?H0ZwSTLgrxHJE1QkUSLOmZDkIXxqNaXg20Ez8+ELTPoX0lVZWlPbH2PghJ77?= =?us-ascii?Q?3gz5jjJI1eq9ycb8jzbb3sbkp/CHUjHrMvmSLFOyTaygT6Nv4sd8KPOrEgbW?= =?us-ascii?Q?YopM6zfKKd1DBZ4+WHn1KIGnZiBQJpV35GciNmN4owN3ee1bHOI5EVXc7peH?= =?us-ascii?Q?2B5+aiXh+JTOl/ENwxefltk23ymQPQeB7TyooKF1O1TTU4PY0M3p0Z0NDmrk?= =?us-ascii?Q?n8DfH+3aOKWeQ743wR3hm24DR0b66PVGij0U1r7onupOk6B50h3IcD9+dl7+?= =?us-ascii?Q?Jgcieow0L1UvtLS82ATmDZ4JeRZfD1vSGtBARRu3isWpLqJs6aLwQJlC8pDU?= =?us-ascii?Q?IwZ7skk2q+JRmJ7j5SENvRA/MtNFc7Io518rDwUxLRT2/b6wOYTfcEHn7QJQ?= =?us-ascii?Q?UoMxxOmb4Dn9eLKYG3lQgP3qnpmF2p1XUCnOBfqnKrZU4lroV3OYzQX89C+P?= =?us-ascii?Q?5ZGdAYwoJeWmrCB81chyBrNr4f1OUaDIKa6BwhWFlhuqk3Z03l2Pgw=3D=3D?= X-Forefront-PRVS: 03449D5DD1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(39840400002)(39450400003)(39850400002)(39400400002)(39410400002)(24454002)(377454003)(50466002)(72206003)(229853002)(54906002)(6486002)(9686003)(53936002)(93886004)(305945005)(478600001)(6116002)(66066001)(47776003)(83506001)(4001350100001)(23726003)(1076002)(5660300001)(25786009)(3846002)(53546009)(76176999)(50986999)(54356999)(189998001)(4326008)(33646002)(81166006)(8676002)(76506005)(42186005)(2950100002)(6666003)(42882006)(6916009)(6496005)(110136004)(38730400002)(2906002)(33716001)(6246003)(7416002)(41533002)(2004002)(21314002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR0701MB1871;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB1871;23:zetNz4GjhRo7nlKyzuG1xmRCr9gjnwR1SZekJmT?= =?us-ascii?Q?+ERjhSCrXhgN8SHKYON+q6iHTHQOd2v5kRZ5Tpsw6pVt3yMKcNh1xHX6+pA6?= =?us-ascii?Q?CfY4yhIoUD0Qr1F3n74goBLj6FeGqCE0zRToo/FR9ogR7VATQkeHNB5LgEyT?= =?us-ascii?Q?9lrVlE0622XNAbXtY7FrgLijQZujnkFD5XUgb8JKJfOakDSptzaYkLPNxj9u?= =?us-ascii?Q?nSNhhnJyue+yvkBDoThtCp8s6IuRgJgskXM8+q0SjhmrCCudqhOMUbbwnBlD?= =?us-ascii?Q?dlPZrhvYyJ4plmYD3xGa/bkr7K35V6ADMflLphTx0i7p40LWQM26zIX7TY6r?= =?us-ascii?Q?1sjGe4pcBTychki4v5+Cd4uPSirBB3yG5PNow73xVn1WY/a/ugoE7aQCd+ut?= =?us-ascii?Q?VG0AZZst5OgNUrCsWJHHqiNiYyUwcC67pQPLhC18KXj8oi86w7qRDexbXao3?= =?us-ascii?Q?tVA0cypMJM5jXKI+hEyQsNpWTCWzA+iawzOagVVb4RVvPJIqp+14m854LZvS?= =?us-ascii?Q?IV00umPoN2bIcuoDeZ7N7lJCjcjZMkHN+nToJRKNUCizZ6UkKC3t6Eku0fol?= =?us-ascii?Q?3eDi2IPhfyFhogdBdNdLjWCiSFfXpodehgQ4xyFb9TviVhaQx7nrOH7v5mZV?= =?us-ascii?Q?QyPyszEpf0kyTX2ruadbhrmpQSl+Z8oqXF2ITcTxch6m0ZHfIC+Q9L9I/sCn?= =?us-ascii?Q?q7xAzFQIRQTV/DjCWx7XybX0X2Z4O66CqMHTctVuZ04RZqzbs9dDbHj5ghDH?= =?us-ascii?Q?0USjzL+ThWDUkKcefAdyihCs3PhmF9zCZziIR0pFNXNdA2VNo74qJSwJig3g?= =?us-ascii?Q?RuH6VjTsLGIM/w4fZXBtAlJlRIYDy7Oy+56AkLgqnPRoJ7NYuOOksVoent8Q?= =?us-ascii?Q?FBUWH1ZhEVvi5TDKVNviZJQClQRwez5PWSGCvnq/UlOjRfzO3AZ301vWOlXv?= =?us-ascii?Q?1p8IZL61jzgaIUA1rOT+gMAxgwG953IUOKsEuL5eHX50PhcFQxTYdxPAGIrr?= =?us-ascii?Q?I5pC9haCw3LaPS4x0RE5FFekZLbsIoI0DxXNscvmE9x4bdobk52x+irMtWrS?= =?us-ascii?Q?jylHR3ppTp1esxNyz099rl78n5nDw3Frdo1MxWNN30i7hYMmU6qqOvImpFlQ?= =?us-ascii?Q?+P33qLnmWXcnnTbje3CzGFpKfJ2Bm4Y1kVCBZspphG1MUzevC7SouxLY9FVK?= =?us-ascii?Q?SivdUk6nkI+fp1x5hXkbckKddqpD4BNTebCyU726n9nkmJXM284OL5IdblgV?= =?us-ascii?Q?4MMqVV89WgE7WOPj+yXZQeCS0JsopBndCC1Z9uE3BQhrZl008paF6XUsQmFa?= =?us-ascii?Q?mLZLCaNImlxaZ6Gt7JqP6zI7vGzIP4/IjxMJL2qivF4rI?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB1871;6:uJY5xt2Px+4VeQ82gwrW7p81pX7Xu0rOEco5vOWD?= =?us-ascii?Q?fp91Vt0odam6D2k4/rQpWgbIXPKNjDT5fqjaHK+66GqC2xvhbv9uufGrbJoH?= =?us-ascii?Q?I9qcH3J65orIt98htiOnZOTuqVgSV2ftkj3hxEarmB5gbhS3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veyCqZfDf9iZq9eSUh1zAfBxksVrWHcrjILY2oXKW3IlofCWryu6RrhAuCrgYAoSms1VX6F7HYzyd7b6Ovo+XoysFLvODnS900sR1GEOtwlt54xhIIOrs52tRgQi3fv2A2DkaZPfz1c2sfdroSkZ1fMRwHaFoJ38VLXdr2ADzxEmLttCrgiOdBkAGglQcfB/aiXO+TdqS6t+RNvlClJ6PISJV6qnKqlo6u842EXdnO+kyJ99upNLqDLqmvOFkU0H5fkJWVnRt59pTmfbQ8XelEzgmDoJunYfb/j16ozWDXJj96bfWkDz475cEK4JEIZvZy9LrB/jj7zgcMMNbx4FOMEyXuP6p/HJpXmb6cs/TLOs18+PDEJqa+ts+6Ptfthn6HgzLKVLzN897MWLpm/lh2AbT5pnA55llV6LhwTKYoCUO/WVMGlhXlBB8fHXKi4Fw/Y2HKHPXaVpjIpD43S2ZJuIMUGDTU5JR2ORbsyVhp7YM= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2017 14:24:52.8347 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB1871 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6336 Lines: 171 On Mon, Jun 19, 2017 at 01:58:53PM -0700, Florian Fainelli wrote: > On 06/18/2017 04:51 PM, Yury Norov wrote: > > Hi Florian, > > > > Some questions and thoughts inline. > > > > Yury > > > > On Fri, Jun 16, 2017 at 05:07:42PM -0700, Florian Fainelli wrote: > >> Define a generic fncpy() implementation largely based on the ARM version > >> that requires an 8 bytes alignment for the destination address where to > >> copy this function as well as the function's own address. > >> > >> Signed-off-by: Florian Fainelli > >> --- > >> include/asm-generic/fncpy.h | 93 +++++++++++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 93 insertions(+) > >> create mode 100644 include/asm-generic/fncpy.h > >> > >> diff --git a/include/asm-generic/fncpy.h b/include/asm-generic/fncpy.h > >> new file mode 100644 > >> index 000000000000..ec03b83b8535 > >> --- /dev/null > >> +++ b/include/asm-generic/fncpy.h > >> @@ -0,0 +1,93 @@ > >> +/* > >> + * include/asm-generic/fncpy.h - helper macros for function body copying > >> + * > >> + * Copyright (C) 2011 Linaro Limited > >> + * > >> + * This program is free software; you can redistribute it and/or modify > >> + * it under the terms of the GNU General Public License version 2 as > >> + * published by the Free Software Foundation. > >> + * > >> + * This program is distributed in the hope that it will be useful, > >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of > >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > >> + * GNU General Public License for more details. > >> + * > >> + * You should have received a copy of the GNU General Public License > >> + * along with this program; if not, write to the Free Software > >> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > >> + */ > >> + > >> +/* > >> + * These macros are intended for use when there is a need to copy a low-level > >> + * function body into special memory. > >> + * > >> + * For example, when reconfiguring the SDRAM controller, the code doing the > >> + * reconfiguration may need to run from SRAM. > >> + * > >> + * NOTE: that the copied function body must be entirely self-contained and > >> + * position-independent in order for this to work properly. > >> + * > >> + * NOTE: in order for embedded literals and data to get referenced correctly, > >> + * the alignment of functions must be preserved when copying. To ensure this, > >> + * the source and destination addresses for fncpy() must be aligned to a > >> + * multiple of 8 bytes: you will be get a BUG() if this condition is not met. > >> + * You will typically need a ".align 3" directive in the assembler where the > >> + * function to be copied is defined, and ensure that your allocator for the > >> + * destination buffer returns 8-byte-aligned pointers. > >> + * > >> + * Typical usage example: > >> + * > >> + * extern int f(args); > >> + * extern uint32_t size_of_f; > >> + * int (*copied_f)(args); > >> + * void *sram_buffer; > >> + * > >> + * copied_f = fncpy(sram_buffer, &f, size_of_f); > >> + * > >> + * ... later, call the function: ... > >> + * > >> + * copied_f(args); > >> + * > >> + * The size of the function to be copied can't be determined from C: > >> + * this must be determined by other means, such as adding assmbler directives > >> + * in the file where f is defined. > >> + */ > >> + > >> +#ifndef __ASM_FNCPY_H > >> +#define __ASM_FNCPY_H > >> + > >> +#include > >> +#include > >> + > >> +#include > >> +#include > >> + > >> +/* > >> + * Minimum alignment requirement for the source and destination addresses > >> + * for function copying. > >> + */ > >> +#define FNCPY_ALIGN 8 > > > > From now this is not arm-only, and it's possible that some architectures > > might want to redefine it in their arch/xxx/include/asm/fncpy.h files. > > So it will be easier for them if you'll wrap FNCPY_ALIGN here with #ifdef > > guards. > > > > By the way, compiler already has an information on the proper alignment. > > Maybe it's better to use it as the default value here instead of the > > hardcoded value? > > > > #ifndef FNCPY_ALIGN > > #define FNCPY_ALIGN ({void foo(); __alignof__(&foo);}) > > #endif > > > >> + > >> +#define fncpy(dest_buf, funcp, size) ({ \ > > > > Do you really need to check types inside the macro? If not, you can > > declare it as function, which is better in general, with the memcpy-like > > prototype. > > > >> + uintptr_t __funcp_address; \ > >> + typeof(funcp) __result; \ > >> + \ > >> + asm("" : "=r" (__funcp_address) : "0" (funcp)); \ > >> + \ > >> + /* \ > >> + * Ensure alignment of source and destination addresses. \ > >> + */ \ > >> + BUG_ON((uintptr_t)(dest_buf) & (FNCPY_ALIGN - 1) || \ > > > > People don't like new BUG_ONs. Maybe it's better to use BUILD_BUG_ON() > > at compile time and WARN_ON() at runtime? > > If you have a BUILD_BUG_ON() what's the point of the WARN_ON()? To warn user if bad destination address comes at runtime. > > > >> + (__funcp_address & (FNCPY_ALIGN - 1))); \ > > > > There is IS_ALIGNED() macro for things like this. > > Sure, makes sense. > > > > > And I frankly don't understand the 2nd check. One can imagine the > > situation when someone wants copy the function from the packed blob or > > some intermediate location were the function is unaligned, and it's > > impossible with the current implementation. > > That's a good point, I am not sure if this is historical, or if there is > a reason for that from the ARM/Linux implementation. It sounds unlikely > that the function would be unaligned though considering that you'd have > to refer to the function being copied by its symbolic name, which > assumes it's in the kernel image or a module, and highly probable that > it is also aligned. > > > > >> + \ > >> + memcpy(dest_buf, (void const *)__funcp_address, size); \ > >> + flush_icache_range((unsigned long)(dest_buf), \ > >> + (unsigned long)(dest_buf) + (size)); \ > >> + \ > >> + asm("" : "=r" (__result) \ > >> + : "0" ((uintptr_t)(dest_buf))); \ > >> + \ > >> + __result; \ > >> +}) > >> + > >> +#endif /* !__ASM_FNCPY_H */ > >> -- > >> 2.9.3 > > > -- > Florian