- i386-memcpy-use-as-few-moves-as.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     i386 memcpy: use as few moves as possible for I/O

has been removed from the -mm tree.  Its filename is

     i386-memcpy-use-as-few-moves-as.patch

This patch was probably dropped from -mm because
it has now been merged into a subsystem tree or
into Linus's tree, or because it was folded into
its parent patch in the -mm tree.

------------------------------------------------------
Subject: i386 memcpy: use as few moves as possible for I/O
From: Chuck Ebbert <76306.1226@xxxxxxxxxxxxxx>


Chris Lesiak reported that changes to i386's __memcpy() broke his device
because it can't handle byte moves and the new code uses them for all
trailing bytes when the length is not divisible by four.  The old code
tried to use a 16-bit move and/or a byte move as needed.

H. Peter Anvin:
"There are only a few semantics that make sense: fixed 8, 16, 32, or 64
bits, plus "optimal"; the latter to be used for anything that doesn't
require a specific transfer size.  Logically, an unqualified
"memcpy_to/fromio" should be the optimal size (as few transfers as
possible)"

So add back the old code as __minimal_memcpy and have IO transfers
use that.

Signed-off-by: Chuck Ebbert <76306.1226@xxxxxxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/asm-i386/io.h     |    4 ++--
 include/asm-i386/string.h |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff -puN include/asm-i386/io.h~i386-memcpy-use-as-few-moves-as include/asm-i386/io.h
--- devel/include/asm-i386/io.h~i386-memcpy-use-as-few-moves-as	2006-05-30 18:14:55.000000000 -0700
+++ devel-akpm/include/asm-i386/io.h	2006-05-30 18:14:55.000000000 -0700
@@ -201,11 +201,11 @@ static inline void memset_io(volatile vo
 }
 static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count)
 {
-	__memcpy(dst, (void __force *) src, count);
+	__minimal_memcpy(dst, (void __force *) src, count);
 }
 static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count)
 {
-	__memcpy((void __force *) dst, src, count);
+	__minimal_memcpy((void __force *) dst, src, count);
 }
 
 /*
diff -puN include/asm-i386/string.h~i386-memcpy-use-as-few-moves-as include/asm-i386/string.h
--- devel/include/asm-i386/string.h~i386-memcpy-use-as-few-moves-as	2006-05-30 18:14:55.000000000 -0700
+++ devel-akpm/include/asm-i386/string.h	2006-05-30 18:14:55.000000000 -0700
@@ -219,6 +219,28 @@ return (to);
 }
 
 /*
+ * Do memcpy with as few moves as possible (for transfers to/from IO space.)
+ */
+static inline void * __minimal_memcpy(void * to, const void * from, size_t n)
+{
+int d0, d1, d2;
+__asm__ __volatile__(
+	"rep ; movsl\n\t"
+	"testb $2,%b4\n\t"
+	"jz 1f\n\t"
+	"movsw\n"
+	"1:\n\t"
+	"testb $1,%b4\n\t"
+	"jz 2f\n\t"
+	"movsb\n"
+	"2:"
+	: "=&c" (d0), "=&D" (d1), "=&S" (d2)
+	:"0" (n/4), "q" (n), "1" ((long) to), "2" ((long) from)
+	: "memory");
+return to;
+}
+
+/*
  * This looks ugly, but the compiler can optimize it totally,
  * as the count is constant.
  */
_

Patches currently in -mm which might be from 76306.1226@xxxxxxxxxxxxxx are

i386-let-usermode-execute-the-enter.patch
i386-fix-get_segment_eip-with-vm86.patch
i386-dont-try-kprobes-for-v8086-mode.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux