1. 11 7月, 2008 1 次提交
    • J
      x86: fix compile error in current tip.git · 27cb0a75
      Jeremy Fitzhardinge 提交于
      Gas 2.15 complains about 32-bit registers being used in lea.
      
        AS      arch/x86/lib/copy_user_64.o
      /local/scratch-2/jeremy/hg/xen/paravirt/linux/arch/x86/lib/copy_user_64.S: Assembler messages:
      /local/scratch-2/jeremy/hg/xen/paravirt/linux/arch/x86/lib/copy_user_64.S:188: Error: `(%edx,%ecx,8)' is not a valid 64 bit base/index expression
      /local/scratch-2/jeremy/hg/xen/paravirt/linux/arch/x86/lib/copy_user_64.S:257: Error: `(%edx,%ecx,8)' is not a valid 64 bit base/index expression
        AS      arch/x86/lib/copy_user_nocache_64.o
      /local/scratch-2/jeremy/hg/xen/paravirt/linux/arch/x86/lib/copy_user_nocache_64.S: Assembler messages:
      /local/scratch-2/jeremy/hg/xen/paravirt/linux/arch/x86/lib/copy_user_nocache_64.S:107: Error: `(%edx,%ecx,8)' is not a valid 64 bit base/index expression
      Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
      Cc: Vitaly Mayatskikh <v.mayatskih@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      27cb0a75
  2. 09 7月, 2008 1 次提交
  3. 18 6月, 2008 1 次提交
    • L
      x86-64: Fix "bytes left to copy" return value for copy_from_user() · 42a886af
      Linus Torvalds 提交于
      Most users by far do not care about the exact return value (they only
      really care about whether the copy succeeded in its entirety or not),
      but a few special core routines actually care deeply about exactly how
      many bytes were copied from user space.
      
      And the unrolled versions of the x86-64 user copy routines would
      sometimes report that it had copied more bytes than it actually had.
      
      Very few uses actually have partial copies to begin with, but to make
      this bug even harder to trigger, most x86 CPU's use the "rep string"
      instructions for normal user copies, and that version didn't have this
      issue.
      
      To make it even harder to hit, the one user of this that really cared
      about the return value (and used the uncached version of the copy that
      doesn't use the "rep string" instructions) was the generic write
      routine, which pre-populated its source, once more hiding the problem by
      avoiding the exception case that triggers the bug.
      
      In other words, very special thanks to Bron Gondwana who not only
      triggered this, but created a test-program to show it, and bisected the
      behavior down to commit 08291429 ("mm:
      fix pagecache write deadlocks") which changed the access pattern just
      enough that you can now trigger it with 'writev()' with multiple
      iovec's.
      
      That commit itself was not the cause of the bug, it just allowed all the
      stars to align just right that you could trigger the problem.
      
      [ Side note: this is just the minimal fix to make the copy routines
        (with __copy_from_user_inatomic_nocache as the particular version that
        was involved in showing this) have the right return values.
      
        We really should improve on the exceptional case further - to make the
        copy do a byte-accurate copy up to the exact page limit that causes it
        to fail.  As it is, the callers have to do extra work to handle the
        limit case gracefully. ]
      Reported-by: NBron Gondwana <brong@fastmail.fm>
      Cc: Nick Piggin <npiggin@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      
       (which didn't have this problem), and since
      most users that do the carethis was very hard to trigger, but
      42a886af
  4. 13 10月, 2007 1 次提交
    • N
      x86: fence oostores on 64-bit · df1bdc06
      Nick Piggin 提交于
      movnt* instructions are not strongly ordered with respect to other stores,
      so if we are to assume stores are strongly ordered in the rest of the 64
      bit code, we must fence these off (see similar examples in 32 bit code).
      
      [ The AMD memory ordering document seems to say that nontemporal stores can
        also pass earlier regular stores, so maybe we need sfences _before_
        movnt* everywhere too? ]
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      df1bdc06
  5. 11 10月, 2007 2 次提交
  6. 13 2月, 2007 1 次提交
    • A
      [PATCH] x86-64: Add __copy_from_user_nocache · 0812a579
      Andi Kleen 提交于
      This does user copies in fs write() into the page cache with write combining.
      This pushes the destination out of the CPU's cache, but allows higher bandwidth
      in some case.
      
      The theory is that the page cache data is usually not touched by the
      CPU again and it's better to not pollute the cache with it. Also it is a little
      faster.
      Signed-off-by: NAndi Kleen <ak@suse.de>
      0812a579