From nobody@FreeBSD.org  Fri Sep 11 13:42:48 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 69699106568F
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Sep 2009 13:42:48 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 582288FC16
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Sep 2009 13:42:48 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n8BDgmUY059871
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Sep 2009 13:42:48 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n8BDglKn059869;
	Fri, 11 Sep 2009 13:42:47 GMT
	(envelope-from nobody)
Message-Id: <200909111342.n8BDglKn059869@www.freebsd.org>
Date: Fri, 11 Sep 2009 13:42:47 GMT
From: Ray Kinsella <ray.kinsella@intel.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH] Patch for bswap64 operation on IA
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         138737
>Category:       i386
>Synopsis:       [endian] [patch] Patch for bswap64(9) operation on IA [vendor]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 11 13:50:03 UTC 2009
>Closed-Date:    
>Last-Modified:  Wed Feb 27 05:17:20 UTC 2013
>Originator:     Ray Kinsella
>Release:        FreeBSD 8.0 Current
>Organization:
Intel Corporation
>Environment:
FreeBSD  8.0-CURRENT-200905 FreeBSD 8.0-CURRENT-200905 #1: Tue Aug 25 14:24:22 UTC 2009     root@:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
As part of a recent development project at Intel we encountered a
performance problem with the bswap64 kernel function. To resolve the
issue, we rewrote the function for Intel(r) Architecture using assembly
code only. This great improved the performance of the operation. 

The attached uuencoded file contains a tarball called "bswap64_patch.tar.gz".
Enclosed in the tarball is a README with a more comprehensive set of
instructions, along with:-

1. A patch to the kernel to replace the bswap64 operation with an assembly
   version. This patch covers swapping both constant and variable 64 bit
   buffers.
2. A preformance test program, to show the differential between the current
   code and proposed new code.
3. A unit test kernel module, to ensure after patching the bswap64 function
   is still working correctly.

Thanks

Ray Kinsella

>How-To-Repeat:
The enclosed tarball contains a user space program called "PerformanceTest".
This program compares the performance of the original bswap64 to the proposed
new version of the code. 
>Fix:
The enclosed tarball contains a file called "endian.patch".  Applying this
patch and rebuilding the kernel will resolve the performance issue. 

The enclosed tarball contains a Kernel module called the "KernelTestModule".
This module will unit test the newly built Kernel to ensure the bswap64
operation works correctly.

Patch attached with submission follows:

begin 644 bswap64_patch
M'XL(``I:JDH``^U:>W/;-A+OO^"GV"B3#F7+$DF]'#O.C6L[K:=VG+&3NT[;
M#(<B(9ECBM3PX4=\_NZW"_`I4793.\FU%28/$5@L%KL_+'8!C*(K:S;HF3,K
MML\[WWV1HFG:L*_!=]J@.S#H_WY/TW6@^JR`KAM]H]?O&0,-L'%HZ-]!_\N(
M4RU)%%LABO)8/ND\\O__(F54L3_W'=?RV^+CZ<8@^_>6V[^O#;MD_UYO.!AV
M!SK:OV>0_1]MDS]2_N'V7UM;@^@FZKC=S4'']6TO<7@*`S,(W4G[G+U/..PF
M$S#ZH&M;^A#_@*%I+Y6-C8UE?>>Z=;?ZFUL]779;JQ;ZAJ'1TK4^B&^`YPX?
MNSX'TQS=Q-PDB)JN'YN75JA>-^%W)#%-?AUS/W(#WS1!O8603]PHYB&V)$C;
M-<P8?_X".X!=MD4?H&Y6-`6U(6`/+[0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5NT?.2]/&)_!QG;TZ$J\R9M[)JF2O7
MF5R4^\Q>FKG85PH$U'FU;6I?,DH!B,-=@D)5J8]%0[:J"TC(0#4#A,`#/`"'
M/P4(&C55N?[QL8C0_P`B6`&)W;/CSP.%O@@*QN9=W-R\'7<\YB%?G#;*(;WD
M(JYQ$C4S$YE,:>=?\D`JD__%"Y![/S:5PF6-]JA*_G=__O\DU_\/O?_5]$'^
M_L/H]0RZ_^M^]?S_'_K^=V]O9V+;RMZ;H]T?SS#7/C$0G!3`;$'-X8^B.'R4
M3+:`*!0F>U&*/H&-_UB>AWWIH:J_A8B;UC+XUO-=E559E559E559E559E559
5E559E559E57YIY7_`2XN'GT`4```
`
end


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->bde 
Responsible-Changed-By: remko 
Responsible-Changed-When: Wed Mar 30 06:07:07 UTC 2011 
Responsible-Changed-Why:  
hi Bruce, might I lure you into looking into this? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138737 
Responsible-Changed-From-To: bde->freebsd-ports-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Feb 24 22:32:41 UTC 2013 
Responsible-Changed-Why:  
bde has not commented on this one in quite some time, so it's time to 
turn it back over to the pool.  While here, note that it is a vendor patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=138737 

From: Mark Linimon <linimon@lonesome.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: i386/138737: [endian] [patch] Patch for bswap64(9) operation
 on IA [vendor]
Date: Tue, 26 Feb 2013 18:16:11 -0600

 ----- Forwarded message from Bruce Evans <brde@optusnet.com.au> -----
 
 Date: Mon, 25 Feb 2013 19:09:43 +1100 (EST)
 From: Bruce Evans <brde@optusnet.com.au>
 To: linimon@FreeBSD.org
 cc: freebsd-ports-bugs@FreeBSD.org
 Subject: Re: i386/138737: [endian] [patch] Patch for bswap64(9) operation on
 	IA [vendor]
 
 On Sun, 24 Feb 2013 linimon@FreeBSD.org wrote:
 
 > Old Synopsis: [endian] [patch] Patch for bswap64(9) operation on IA
 > New Synopsis: [endian] [patch] Patch for bswap64(9) operation on IA [vendor]
 > 
 > Responsible-Changed-From-To: bde->freebsd-ports-bugs
 > Responsible-Changed-By: linimon
 > Responsible-Changed-When: Sun Feb 24 22:32:41 UTC 2013
 > Responsible-Changed-Why:
 > bde has not commented on this one in quite some time, so it's time to
 > turn it back over to the pool.  While here, note that it is a vendor patch.
 > 
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=138737
 
 tijl committed a more refined version.
 
 This seems to be misclassified in ports, so I never noticed it before
 but I seem to remember replying to mail about the original patch.  Maybe
 that wasn't in a PR.
 
 Bruce
 
 
 ----- End forwarded message -----

From: Mark Linimon <linimon@lonesome.com>
To: Bruce Evans <brde@optusnet.com.au>
Cc: linimon@FreeBSD.org, bug-followup@FreeBSD.org
Subject: Re: i386/138737: [endian] [patch] Patch for bswap64(9) operation
 on IA [vendor]
Date: Tue, 26 Feb 2013 18:15:52 -0600

 On Mon, Feb 25, 2013 at 07:09:43PM +1100, Bruce Evans wrote:
 > This seems to be misclassified in ports
 
 Actually it wasn't, it was in i386: but my fingers insisted on the wrong
 reassignment.
 
 In any case it's OBE now.  Thanks.
 
 mcl
>Unformatted:
