From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 28 Jan 2009 19:28:38 +0000 (GMT) Received: from rtp-iport-2.cisco.com ([64.102.122.149]:19568 "EHLO rtp-iport-2.cisco.com") by ftp.linux-mips.org with ESMTP id S21366464AbZA1T2f (ORCPT ); Wed, 28 Jan 2009 19:28:35 +0000 X-IronPort-AV: E=Sophos;i="4.37,339,1231113600"; d="scan'208";a="35134497" Received: from rtp-dkim-2.cisco.com ([64.102.121.159]) by rtp-iport-2.cisco.com with ESMTP; 28 Jan 2009 19:28:14 +0000 Received: from rtp-core-1.cisco.com (rtp-core-1.cisco.com [64.102.124.12]) by rtp-dkim-2.cisco.com (8.12.11/8.12.11) with ESMTP id n0SJSEvu000865 for ; Wed, 28 Jan 2009 14:28:14 -0500 Received: from sausatlsmtp1.sciatl.com (sausatlsmtp1.cisco.com [192.133.217.33]) by rtp-core-1.cisco.com (8.13.8/8.13.8) with ESMTP id n0SJSEsY010672 for ; Wed, 28 Jan 2009 19:28:14 GMT Received: from default.com ([192.133.217.33]) by sausatlsmtp1.sciatl.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 28 Jan 2009 14:28:13 -0500 Received: from sausatlbhs02.corp.sa.net ([192.133.216.42]) by sausatlsmtp1.sciatl.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 28 Jan 2009 14:28:12 -0500 Received: from CUPLXSUNDISM01.corp.sa.net ([64.101.21.60]) by sausatlbhs02.corp.sa.net with Microsoft SMTPSVC(6.0.3790.3959); Wed, 28 Jan 2009 14:28:11 -0500 Message-ID: <4980B1CA.4060505@cisco.com> Date: Wed, 28 Jan 2009 11:28:10 -0800 From: Michael Sundius User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: David Daney CC: linux-mips@linux-mips.org, "VomLehn, David" , msundius@sundius.com Subject: Re: memcpy and prefetch References: <497F9214.1000609@cisco.com> <497F93C1.3090401@caviumnetworks.com> In-Reply-To: <497F93C1.3090401@caviumnetworks.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 28 Jan 2009 19:28:11.0623 (UTC) FILETIME=[8EAB6770:01C9817E] X-ST-MF-Message-Resent: 1/28/2009 14:28 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=2360; t=1233170894; x=1234034894; c=relaxed/simple; s=rtpdkim2001; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=msundius@cisco.com; z=From:=20Michael=20Sundius=20 |Subject:=20Re=3A=20memcpy=20and=20prefetch |Sender:=20 |To:=20David=20Daney=20; bh=nekCxxdYkz1nAM+XWlK/wjU52MOHKmY0ReSjITtALU4=; b=czuZuoBcrUzTXp1pshWU+F38ISVQyrwAxG5ppaN/Cyue3FSIH/K+ejjKBJ y8Fhs8vGZFWwK+Vs9yEaD/2ZPlczTkmdRILtj6+VNfrZMscGXnbsiGvnfjcC 10ko876JYg; Authentication-Results: rtp-dkim-2; header.From=msundius@cisco.com; dkim=pass ( sig from cisco.com/rtpdkim2001 verified; ); Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 21862 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: msundius@cisco.com Precedence: bulk X-list: linux-mips David Daney wrote: > Michael Sundius wrote: >> I know this topic has been written about but so excuse me if I am >> redundant. >> I saw lots of talk in the archives but I don't know if a solution was >> ever arrived >> at. so: >> >> what is the current state of the use of prefetch in memcpy()? it >> seems that >> it is #undef-ed if CONFIG_DMA_COHERENT is not turned on. >> >> is this still because the memcpy does not check to prevent a prefetch of >> addresses beyond the end of the buffer? >> >> If so, what was the reason a solution was abandoned.... >> >> also has anyone out there written a memcopy that does use prefetch >> intelligently (for mips32 that is)? >> > > The Cavium OCTEON port overrides the default memcpy and does use > prefetch. It was recently merged (2.6.29-rc2). Look at octeon-memcpy.S > > I have thought that memcpy could be generated by mm/page.c as > copy_page and clear_page are. > > David Daney David, thanks!!! that's really useful. I have a few questions tho: 1) So you made this function explicitly for the Octeon. and that is because you know the cache-line is 128 bytes long on the octeon? is that right? 2) It seems as though you always prefectch the first cache line.. what happens if the memcopy is less than 1 cache line long? wouldn't you risk prefetching beyond the end of the buffer? 3) why do you only do the "pref 0 offset(src)" and not a prefetch for the destination? 4) on line 244 you check to see if len is less than 128. while on the other checks you check for (offset)+1 why would you not do the prefetch if len was exactly 256 bytes? (or 128 in the case of line 196)? thanks. - - - - - Cisco - - - - - This e-mail and any attachments may contain information which is confidential, proprietary, privileged or otherwise protected by law. The information is solely intended for the named addressee (or a person responsible for delivering it to the addressee). If you are not the intended recipient of this message, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer.