Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965351AbbENAzk (ORCPT ); Wed, 13 May 2015 20:55:40 -0400 Received: from mail-bn1bon0110.outbound.protection.outlook.com ([157.56.111.110]:37760 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753298AbbENAzh (ORCPT ); Wed, 13 May 2015 20:55:37 -0400 Authentication-Results: c-s.fr; dkim=none (message not signed) header.d=none; Message-ID: <1431564909.3868.162.camel@freescale.com> Subject: Re: [PATCH 3/4] powerpc32: memset(0): use cacheable_memzero From: Scott Wood To: Christophe Leroy CC: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , , , "Joakim Tjernlund" , Kyle Moffett Date: Wed, 13 May 2015 19:55:09 -0500 In-Reply-To: <9010ef9da0b2730af564a138b8d316d48eaf6d43.1431436210.git.christophe.leroy@c-s.fr> References: <9010ef9da0b2730af564a138b8d316d48eaf6d43.1431436210.git.christophe.leroy@c-s.fr> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-IP: [2601:2:5800:3f7:12bf:48ff:fe84:c9a0] X-ClientProxiedBy: BLUPR02CA049.namprd02.prod.outlook.com (25.160.23.167) To BY1PR03MB1482.namprd03.prod.outlook.com (25.162.210.140) X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1482;2:dGyGyROP4tkTuz8whH7OJF/Ts75Zas9FwISgNpHwOYarC9MOVqzt+VnWC8IdDDdJ;2:3Fxc03nM4HkpIFtqRbZjDffcBiYe6CDAozo/m8gT+r3lM559V+KQReDTH5EDse1rhhiQ4eRfaKljEdgp590frx/zI3DgcCbG/a2/JYuNmb2qelGqX3T59/0VdyTBYnb8afvtItahCMnZrdA8BJxjgw==;6:YhAwUSrxPGM+3+qk2PWtEPSpJW7KbshosLfBarnQpi+XsoFG/3vvU/DSqFtkixt0xDd2xcPdbN3eZACYts3vHgqby72Tw1mjQMnz4Iuc6lufwBO45Al4XfHS/A1+kQ2JWDNC2fUjSoU2399ABMdAHWx1efFr0m5w2O5Rb5u/lW7XhoR9HzGA12TFPGeBbEu1/2p1m60TwnLH0mAEaIoQQotuIBfZPg9QqfIpDTpRRWqjfQs9vynI/7HNCHeY8rg1olFxB4x5YXhgVrR98P7vI4WwZeyjK4Knkewvf8llzFu0D8hafdXp04m24TjHbeA9P9PxhrBLToRoKByIgI4BnP85iJ76vF/BJFJW7LOSwsQdVvsO3vowkbeC54prk01mvXqyhZoRUPa8xIlJDkf/sWXpMPY8JPJ5aydB4pLHes8NRDt2muk3XLK3Gr+gbr3V5N1Xu/DEUPKODj3EeLNoozBXEG10Kuy37ZAgZ9twYLlOQSy8RehNNObn175yEGai X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1482; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY1PR03MB1482;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1482; X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1482;3:4z1Htrp/SAnmOrEBbSZy7yh/fXZ+aTsA+39OzuNeVoPbCY2pFT8WJXt0odLgc8dr3E9e7LkWfq+2budTqQAq4oQbe+JDc+WJhDloLBOSNPE5I/s9IXOqLYYtHGjcIXdwZIsaf6zs9ZXpi2ELVHhc+ucf8OuylWIYbWshCboAoXDwPeNa4IiEe7XJYUaYZY644BOmCqgDwMw3T4kbvV6y3jOS26QV+WPsyJ4F6y5/uErWpYTOrg95npbRf7hz2cP4UmqJLo1eCJ/bZUAeKzKAjRPCQNGPTorMOrYfbDc6qYM= X-Forefront-PRVS: 0576145E86 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(377424004)(51704005)(24454002)(23676002)(2950100001)(77096005)(62966003)(77156002)(40100003)(110136002)(33646002)(50466002)(19580405001)(122386002)(5001960100002)(36756003)(92566002)(189998001)(87976001)(50226001)(5820100001)(50986999)(76176999)(47776003)(86362001)(46102003)(42186005)(103116003)(7059030)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR03MB1482;H:[IPv6:2601:2:5800:3f7:12bf:48ff:fe84:c9a0];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1482;9:v5HNkIi0jkm2JEvDjMVVb/SY6K8sOj2j5xKdfycS2SUskau/WtJLGnzYSmncvdbO1ZHe1iBrHr/GrBvJ1sS5bUt/p3p/GdMBLc4nQlpTNcU3BHTKdxJf1dcRLorfBMBWePmquA4bIzKEi88inzCbJBAi4T5qgy5yHC+yTs8TOL5SPGPM2Bxsxza1OdpNgqZvroOt3Sx4v4drLGaVZODgT0w9dpvvMFmTTgSqpWEmJw9MqVjHE9GUDMb0la58m2kAfNew3iMIcHXdpXie86uihdxCWM3wLTEOSpryOGQyeGn11ci1M5Jmmito/SFOm7GbB0NJHvPZXlqznxkGIeAR2uZ3lbIXz8FrOdqX40Ywz38YvsWKtoeOwazHck+R5a4U/IPFh5LQwpGk7IlpRTKmJbu1CvnGMGirUytXVharitCULkGR5uwfm45qQ/jlgoUa6XjKkCf++CzeJeLo+18g8qjTxDvK10SNnWJqJ+Cj29OSOj1ix5LzgpVMi1UGe+kpZTZa4d4yL6a8wpX4bndzgGg0LffijyT+gV2YHDnb9iAy2QTb2yLNUTXWZzT0qs8MQyckLWJeHUGSVJUyeJEQ9fYZ/1egR53MPt0/TUIh1qCE1LikAH6mPUNlhCg1B4N+6nTtkYSZ6kmc9m9cpPd8WGBxAe/HdyyP2YfmOzxyClNVglHstror0H/cbwGdoZTjtFS+TfhZk4RrRwZtz+PFiZUAaXN5y/MPRTh+N0dufoCo3LQwahnhJOi+J1kchD8D25bpOxFxWFaBwy3dSQ2O/PVJZAC4Wi1M7i2Z2hmxizJcq9O+9R0X0/+El/hVVCCDmUfhwIthRwzBzdqTfv7hpA== X-Microsoft-Exchange-Diagnostics: 1;BY1PR03MB1482;3:bazBq3sI0Qa1qIh52tDY/36ZNaWIEo7qIPnh4ZoJ9VFQ3zwMudVBf6MmILcK8mBA+wcXAjPcX/SDk+kp6KVxMcWqduP22dzI/+GdpiWDWYihCvTtervjLIPs/pm2gZthDyCx6GL4bUYD6tevsfYSCA==;10:ijR1iaUWsNUBcapzTIqiSMHGUTLcQKSTYk5f7+0isiuLfjAUtX0mee/7nLmqyVii8J40NEZ6qvPYpL+F9NiFSEWwT5WmasnnG/I3gux65nw=;6:yypZgASNt5TSLE6Q+JutghSFCvDKMqOfzEg/HuWCTN2b6XepJ0I4Tsfq2X+LYVAu X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2015 00:55:33.6756 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1482 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1828 Lines: 58 On Tue, 2015-05-12 at 15:32 +0200, Christophe Leroy wrote: > cacheable_memzero uses dcbz instruction and is more efficient than > memset(0) when the destination is in RAM > > This patch renames memset as generic_memset, and defines memset > as a prolog to cacheable_memzero. This prolog checks if the byte > to set is 0 and if the buffer is in RAM. If not, it falls back to > generic_memcpy() > > Signed-off-by: Christophe Leroy > --- > arch/powerpc/lib/copy_32.S | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S > index cbca76c..d8a9a86 100644 > --- a/arch/powerpc/lib/copy_32.S > +++ b/arch/powerpc/lib/copy_32.S > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > > #define COPY_16_BYTES \ > lwz r7,4(r4); \ > @@ -74,6 +75,18 @@ CACHELINE_MASK = (L1_CACHE_BYTES-1) > * to set them to zero. This requires that the destination > * area is cacheable. -- paulus > */ > +_GLOBAL(memset) > + cmplwi r4,0 > + bne- generic_memset > + cmplwi r5,L1_CACHE_BYTES > + blt- generic_memset > + lis r8,max_pfn@ha > + lwz r8,max_pfn@l(r8) > + tophys (r9,r3) > + srwi r9,r9,PAGE_SHIFT > + cmplw r9,r8 > + bge- generic_memset > + mr r4,r5 max_pfn includes highmem, and tophys only works on normal kernel addresses. If we were to point memset_io, memcpy_toio, etc. at noncacheable versions, are there any other callers left that can reasonably point at uncacheable memory? -Scott -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/