i386/138737: [PATCH] Patch for bswap64 operation on IA

Ray Kinsella ray.kinsella at intel.com
Fri Sep 11 13:50:03 UTC 2009


>Number:         138737
>Category:       i386
>Synopsis:       [PATCH] Patch for bswap64 operation on IA
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>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:
>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 at L%KL_+'8!C*(K:S;HF3,K
MML\[WWV1HFG:L*_!=]J at .S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_%$Q<X*$3G98>EV?\DMKQ7U]NCTS0D%6UM@'>B`RM6[@"@44[R.R:_[G
MV=N%(%08FI"ATOP)KSZZR%+Y\X#RQPSM[=(('9%`E]RAM`#I'OUQNN3(&0B<
M-O-\M;H,<"["*V0Y=K:.,P9R8E`:%]B/H35:@G2:4(>\?JI[5H/I;<K/25M(
MR^2>+UXO!&$L#M&N4&DI'T8`*EF_V+13UYT:C`SW*L556X0P6",].4LS72AE
M_B([Q&;RQW?2)5>!5!EGSK*P9WFV>'LS_\RG:IP49QKAK,Q]HP1HY%[@2I6@
M:JIJ]BMGT81.*>Q+YUGX.&&EW)F1-Q5NT?.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:
>Unformatted:


More information about the freebsd-i386 mailing list