1. 26 5月, 2012 2 次提交
    • C
      arch/tile: optimize get_user/put_user and friends · 47d632f9
      Chris Metcalf 提交于
      Use direct load/store for the get_user/put_user.
      
      Previously, we would call out to a helper routine that would do the
      appropriate thing and then return, handling the possible exception
      internally.  Now we inline the load or store, along with a "we succeeded"
      indication in a register; if the load or store faults, we write a
      "we failed" indication into the same register and then return to the
      following instruction.  This is more efficient and gives us more compact
      code, as well as being more in line with what other architectures do.
      
      The special futex assembly source file for TILE-Gx also disappears in
      this change; we just use the same inlining idiom there as well, putting
      the appropriate atomic operations directly into futex_atomic_op_inuser()
      (and thus into the FUTEX_WAIT function).
      
      The underlying atomic copy_from_user, copy_to_user functions were
      renamed using the (cryptic) x86 convention as copy_from_user_ll and
      copy_to_user_ll.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      47d632f9
    • C
      arch/tile: support building big-endian kernel · 1efea40d
      Chris Metcalf 提交于
      The toolchain supports big-endian mode now, so add support for building
      the kernel to run big-endian as well.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      1efea40d
  2. 03 4月, 2012 4 次提交
  3. 13 3月, 2012 1 次提交
  4. 04 12月, 2011 1 次提交
  5. 04 11月, 2011 1 次提交
    • C
      arch/tile: avoid exporting a symbol no longer used by gcc · f319d6e2
      Chris Metcalf 提交于
      An earlier Tilera compiler generated calls to an "__ll_mul"
      function for long long multiplication.  Our libgcc supported that
      as an alias for the normal __muldi3 routine, so we made it available
      to kernel modules as well.  However, for a while now the compiler
      has internally been generating only the standard __muldi3 symbol,
      and the version we are giving back to the community does not have
      the __ll_mul alias, so we are removing it from the kernel too.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      f319d6e2
  6. 13 10月, 2011 1 次提交
  7. 27 7月, 2011 1 次提交
  8. 13 5月, 2011 1 次提交
    • C
      arch/tile: finish enabling support for TILE-Gx 64-bit chip · 18aecc2b
      Chris Metcalf 提交于
      This support was partially present in the existing code (look for
      "__tilegx__" ifdefs) but with this change you can build a working
      kernel using the TILE-Gx toolchain and ARCH=tilegx.
      
      Most of these files are new, generally adding a foo_64.c file
      where previously there was just a foo_32.c file.
      
      The ARCH=tilegx directive redirects to arch/tile, not arch/tilegx,
      using the existing SRCARCH mechanism in the top-level Makefile.
      
      Changes to existing files:
      
      - <asm/bitops.h> and <asm/bitops_32.h> changed to factor the
        include of <asm-generic/bitops/non-atomic.h> in the common header.
      
      - <asm/compat.h> and arch/tile/kernel/compat.c changed to remove
        the "const" markers I had put on compat_sys_execve() when trying
        to match some recent similar changes to the non-compat execve.
        It turns out the compat version wasn't "upgraded" to use const.
      
      - <asm/opcode-tile_64.h> and <asm/opcode_constants_64.h> were
        previously included accidentally, with the 32-bit contents.  Now
        they have the proper 64-bit contents.
      
      Finally, I had to hack the existing hacky drivers/input/input-compat.h
      to add yet another "#ifdef" for INPUT_COMPAT_TEST (same as x86_64).
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> [drivers/input]
      18aecc2b
  9. 05 5月, 2011 2 次提交
    • C
      arch/tile: disable GX prefetcher during cache flush · dbb43421
      Chris Metcalf 提交于
      Otherwise, it's possible to end up with the prefetcher pulling
      data into cache that the code believes has been flushed.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      dbb43421
    • C
      arch/tile: allow nonatomic stores to interoperate with fast atomic syscalls · df29ccb6
      Chris Metcalf 提交于
      This semantic was already true for atomic operations within the kernel,
      and this change makes it true for the fast atomic syscalls (__NR_cmpxchg
      and __NR_atomic_update) as well.  Previously, user-space had to use
      the fast atomic syscalls exclusively to update memory, since raw stores
      could lose a race with the atomic update code even when the atomic update
      hadn't actually modified the value.
      
      With this change, we no longer write back the value to memory if it
      hasn't changed.  This allows certain types of idioms in user space to
      work as expected, e.g. "atomic exchange" to acquire a spinlock, followed
      by a raw store of zero to release the lock.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      df29ccb6
  10. 20 3月, 2011 1 次提交
  11. 11 3月, 2011 3 次提交
    • C
      arch/tile: fix deadlock bugs in rwlock implementation · 3c5ead52
      Chris Metcalf 提交于
      The first issue fixed in this patch is that pending rwlock write locks
      could lock out new readers; this could cause a deadlock if a read lock was
      held on cpu 1, a write lock was then attempted on cpu 2 and was pending,
      and cpu 1 was interrupted and attempted to re-acquire a read lock.
      The write lock code was modified to not lock out new readers.
      
      The second issue fixed is that there was a narrow race window where a tns
      instruction had been issued (setting the lock value to "1") and the store
      instruction to reset the lock value correctly had not yet been issued.
      In this case, if an interrupt occurred and the same cpu then tried to
      manipulate the lock, it would find the lock value set to "1" and spin
      forever, assuming some other cpu was partway through updating it.  The fix
      is to enforce an interrupt critical section around the tns/store pair.
      
      In addition, this change now arranges to always validate that after
      a readlock we have not wrapped around the count of readers, which
      is only eight bits.
      
      Since these changes make the rwlock "fast path" code heavier weight,
      I decided to move all the rwlock code all out of line, leaving only the
      conventional spinlock code with fastpath inlines.  Since the read_lock
      and read_trylock implementations ended up very similar, I just expressed
      read_lock in terms of read_trylock.
      
      As part of this change I also eliminate support for the now-obsolete
      tns_atomic mode.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      3c5ead52
    • C
      arch/tile: support 4KB page size as well as 64KB · 76c567fb
      Chris Metcalf 提交于
      The Tilera architecture traditionally supports 64KB page sizes
      to improve TLB utilization and improve performance when the
      hardware is being used primarily to run a single application.
      
      For more generic server scenarios, it can be beneficial to run
      with 4KB page sizes, so this commit allows that to be specified
      (by modifying the arch/tile/include/hv/pagesize.h header).
      
      As part of this change, we also re-worked the PTE management
      slightly so that PTE writes all go through a __set_pte() function
      where we can do some additional validation.  The set_pte_order()
      function was eliminated since the "order" argument wasn't being used.
      
      One bug uncovered was in the PCI DMA code, which wasn't properly
      flushing the specified range.  This was benign with 64KB pages,
      but with 4KB pages we were getting some larger flushes wrong.
      
      The per-cpu memory reservation code also needed updating to
      conform with the newer percpu stuff; before it always chose 64KB,
      and that was always correct, but with 4KB granularity we now have
      to pay closer attention and reserve the amount of memory that will
      be requested when the percpu code starts allocating.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      76c567fb
    • C
      arch/tile: fix some comments and whitespace · 5fb682b0
      Chris Metcalf 提交于
      This is a grab bag of changes with no actual change to generated code.
      This includes whitespace and comment typos, plus a couple of stale
      comments being removed.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      5fb682b0
  12. 02 3月, 2011 5 次提交
  13. 25 11月, 2010 1 次提交
    • C
      arch/tile: fix memchr() not to dereference memory for zero length · 3edabee2
      Chris Metcalf 提交于
      This change fixes a bug that memchr() will read the first word
      of the source even if the length is zero.  Ironically, the code
      was originally written with a test to avoid exactly this problem,
      but to make the code conform to Linux coding standards with all
      declarations preceding all statements, the first load from memory
      was moved up above that test as the initial value for a variable.
      
      The change just moves all the variable declarations to the top
      of the file, with no initializers, so that the test can also be
      at the top of the file.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      3edabee2
  14. 15 11月, 2010 1 次提交
    • C
      arch/tile: fix rwlock so would-be write lockers don't block new readers · 24f3f6b5
      Chris Metcalf 提交于
      This avoids a deadlock in the IGMP code where one core gets a read
      lock, another core starts trying to get a write lock (thus blocking
      new readers), and then the first core tries to recursively re-acquire
      the read lock.
      
      We still try to preserve some degree of balance by giving priority
      to additional write lockers that come along while the lock is held
      for write, so they can all complete quickly and return the lock to
      the readers.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      24f3f6b5
  15. 02 11月, 2010 1 次提交
  16. 16 10月, 2010 1 次提交
    • C
      arch/tile: minor whitespace/naming changes for string support files · 29507663
      Chris Metcalf 提交于
      Our internal process shares memcpy, memset, etc., with libc, and
      we did some minor tweaking as part of moving from uclibc to glibc,
      which is now reflected in the kernel versions of these files.
      
      There are no semantic changes in this commit, just whitespace
      (memcpy_32.S now properly uses tabs), naming (memmove.c instead
      of memmove_32.c, since TILE-Gx shares the file with TILEPro),
      and a couple of other minor tweaks.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      29507663
  17. 15 10月, 2010 1 次提交
  18. 06 10月, 2010 1 次提交
  19. 13 8月, 2010 1 次提交
    • C
      arch/tile: Various cleanups. · c745a8a1
      Chris Metcalf 提交于
      This change rolls up random cleanups not representing any actual bugs.
      
      - Remove a stale CONFIG_ value from the default tile_defconfig
      - Remove unused tns_atomic_xxx() family of methods from <asm/atomic.h>
      - Optimize get_order() using Tile's "clz" instruction
      - Fix a bad hypervisor upcall name (not currently used in Linux anyway)
      - Use __copy_in_user_inatomic() name for consistency, and export it
      - Export some additional hypervisor driver I/O upcalls and some homecache calls
      - Remove the obfuscating MEMCPY_TEST_WH64 support code
      - Other stray comment cleanups, #if 0 removal, etc.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      c745a8a1
  20. 07 7月, 2010 3 次提交
    • C
      arch/tile: Miscellaneous cleanup changes. · 0707ad30
      Chris Metcalf 提交于
      This commit is primarily changes caused by reviewing "sparse"
      and "checkpatch" output on our sources, so is somewhat noisy, since
      things like "printk() -> pr_err()" (or whatever) throughout the
      codebase tend to get tedious to read.  Rather than trying to tease
      apart precisely which things changed due to which type of code
      review, this commit includes various cleanups in the code:
      
      - sparse: Add declarations in headers for globals.
      - sparse: Fix __user annotations.
      - sparse: Using gfp_t consistently instead of int.
      - sparse: removing functions not actually used.
      - checkpatch: Clean up printk() warnings by using pr_info(), etc.;
        also avoid partial-line printks except in bootup code.
        - checkpatch: Use exposed structs rather than typedefs.
        - checkpatch: Change some C99 comments to C89 comments.
      
      In addition, a couple of minor other changes are rolled in
      to this commit:
      
      - Add support for a "raise" instruction to cause SIGFPE, etc., to be raised.
      - Remove some compat code that is unnecessary when we fully eliminate
        some of the deprecated syscalls from the generic syscall ABI.
      - Update the tile_defconfig to reflect current config contents.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      0707ad30
    • C
      arch/tile: Split the icache flush code off to a generic <arch> header. · c78095bd
      Chris Metcalf 提交于
      This code is used in other places in our system than in Linux, so
      to share it we now implement it as an inline function in our low-level
      <arch> headers, and instantiate it in one file in Linux's arch/tile/lib.
      The file is now cacheflush.c and is C code rather than the strangely-named
      and assembler-implemented __invalidate_icache.S.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      c78095bd
    • C
      arch/tile: Fix bug in support for atomic64_xx() ops. · 2db09827
      Chris Metcalf 提交于
      This wasn't properly tested until the perf-event subsystem started
      to get brought up under the tile architecture.
      
      The bug caused bogus atomic64_cmpxchg() values to be returned,
      among other things.
      Signed-off-by: NChris Metcalf <cmetcalf@tilera.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      2db09827
  21. 05 6月, 2010 1 次提交