1. 19 7月, 2007 1 次提交
    • R
      IB/mthca: Factor out setting WQE data segment entries · 80885456
      Roland Dreier 提交于
      Factor code to set data segment entries out of the work request
      posting functions into inline functions mthca_set_data_seg() and
      mthca_set_data_seg_inval().  This makes the code more readable and
      also allows the compiler to do a better job -- on x86_64:
      
      add/remove: 0/0 grow/shrink: 0/6 up/down: 0/-69 (-69)
      function                                     old     new   delta
      mthca_arbel_post_srq_recv                    373     369      -4
      mthca_arbel_post_receive                     570     562      -8
      mthca_tavor_post_srq_recv                    520     508     -12
      mthca_tavor_post_send                       1344    1330     -14
      mthca_arbel_post_send                       1481    1467     -14
      mthca_tavor_post_receive                     792     775     -17
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      80885456
  2. 18 7月, 2007 2 次提交
    • R
      IB/mthca: Use uninitialized_var() for f0 · 6d7d080e
      Roland Dreier 提交于
      Commit 9db48926 ("drivers/infiniband/hw/mthca/mthca_qp: kill uninit'd
      var warning") added "= 0" to the declarations of f0 to shut up gcc
      warnings.  However, there's no point in making the code bigger by
      initializing f0 to a random value just to get rid of a warning;
      setting f0 to 0 is no safer than just using uninitialized_var(), which
      documents the situation better and gives smaller code too.  For example, 
      on x86_64:
      
      add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-16 (-16)
      function                                     old     new   delta
      mthca_tavor_post_send                       1352    1344      -8
      mthca_arbel_post_send                       1489    1481      -8
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      6d7d080e
    • J
      drivers/infiniband/hw/mthca/mthca_qp: kill uninit'd var warning · 9db48926
      Jeff Garzik 提交于
      drivers/infiniband/hw/mthca/mthca_qp.c: In function
        ‘mthca_tavor_post_send’:
      drivers/infiniband/hw/mthca/mthca_qp.c:1594: warning: ‘f0’ may be used
        uninitialized in this function
      drivers/infiniband/hw/mthca/mthca_qp.c: In function
        ‘mthca_arbel_post_send’:
      drivers/infiniband/hw/mthca/mthca_qp.c:1949: warning: ‘f0’ may be used
        uninitialized in this function
      
      Initializing 'f0' is not strictly necessary in either case, AFAICS.
      
      I was considering use of uninitialized_var(), but looking at the
      complex flow of control in each function, I feel it is wiser and
      safer to simply zero the var and be certain of ourselves.
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9db48926
  3. 30 5月, 2007 1 次提交
  4. 22 5月, 2007 1 次提交
    • A
      Detach sched.h from mm.h · e8edc6e0
      Alexey Dobriyan 提交于
      First thing mm.h does is including sched.h solely for can_do_mlock() inline
      function which has "current" dereference inside. By dealing with can_do_mlock()
      mm.h can be detached from sched.h which is good. See below, why.
      
      This patch
      a) removes unconditional inclusion of sched.h from mm.h
      b) makes can_do_mlock() normal function in mm/mlock.c
      c) exports can_do_mlock() to not break compilation
      d) adds sched.h inclusions back to files that were getting it indirectly.
      e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
         getting them indirectly
      
      Net result is:
      a) mm.h users would get less code to open, read, preprocess, parse, ... if
         they don't need sched.h
      b) sched.h stops being dependency for significant number of files:
         on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
         after patch it's only 3744 (-8.3%).
      
      Cross-compile tested on
      
      	all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
      	alpha alpha-up
      	arm
      	i386 i386-up i386-defconfig i386-allnoconfig
      	ia64 ia64-up
      	m68k
      	mips
      	parisc parisc-up
      	powerpc powerpc-up
      	s390 s390-up
      	sparc sparc-up
      	sparc64 sparc64-up
      	um-x86_64
      	x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
      
      as well as my two usual configs.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e8edc6e0
  5. 19 5月, 2007 1 次提交
  6. 15 5月, 2007 1 次提交
  7. 01 5月, 2007 1 次提交
  8. 25 4月, 2007 1 次提交
    • R
      IB/mthca: Simplify CQ cleaning in mthca_free_qp() · 30c00986
      Roland Dreier 提交于
      mthca_free_qp() already has local variables to hold the QP's send_cq
      and recv_cq, so we can slightly clean up the calls to mthca_cq_clean()
      by using those local variables instead of expressions like
      to_mcq(qp->ibqp.send_cq).
      
      Also, by cleaning the recv_cq first, we can avoid worrying about
      whether the QP is attached to an SRQ for the second call, because we
      would only clean send_cq if send_cq is not equal to recv_cq, and that
      means send_cq cannot have any receive completions from the QP being
      destroyed.
      
      All this work even improves the generated code a bit:
      
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5 (-5)
      function                                     old     new   delta
      mthca_free_qp                                510     505      -5
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      30c00986
  9. 02 3月, 2007 1 次提交
  10. 17 2月, 2007 1 次提交
  11. 11 2月, 2007 1 次提交
  12. 10 1月, 2007 1 次提交
  13. 09 12月, 2006 1 次提交
    • D
      [PATCH] LOG2: Implement a general integer log2 facility in the kernel · f0d1b0b3
      David Howells 提交于
      This facility provides three entry points:
      
      	ilog2()		Log base 2 of unsigned long
      	ilog2_u32()	Log base 2 of u32
      	ilog2_u64()	Log base 2 of u64
      
      These facilities can either be used inside functions on dynamic data:
      
      	int do_something(long q)
      	{
      		...;
      		y = ilog2(x)
      		...;
      	}
      
      Or can be used to statically initialise global variables with constant values:
      
      	unsigned n = ilog2(27);
      
      When performing static initialisation, the compiler will report "error:
      initializer element is not constant" if asked to take a log of zero or of
      something not reducible to a constant.  They treat negative numbers as
      unsigned.
      
      When not dealing with a constant, they fall back to using fls() which permits
      them to use arch-specific log calculation instructions - such as BSR on
      x86/x86_64 or SCAN on FRV - if available.
      
      [akpm@osdl.org: MMC fix]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Wojtek Kaniewski <wojtekka@toxygen.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      f0d1b0b3
  14. 30 11月, 2006 1 次提交
    • R
      IB/mthca: Fix section mismatches · f4f3d0f0
      Roland Dreier 提交于
      Commit b3b30f5e ("IB/mthca: Recover from catastrophic errors")
      introduced some section mismatch breakage, because the error recovery
      code tears down and reinitializes the device, which calls into lots of
      code originally marked __devinit and __devexit from regular .text.
      
      Fix this by getting rid of these now-incorrect section markers.
      
      Reported by Randy Dunlap <randy.dunlap@oracle.com>.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      f4f3d0f0
  15. 17 10月, 2006 1 次提交
    • A
      IB/mthca: Use mmiowb after doorbell ring · 1f5c23e2
      Arthur Kepner 提交于
      We discovered a problem when running IPoIB applications on multiple
      CPUs on an Altix system. Many messages such as:
      
      ib_mthca 0002:01:00.0: SQ 000014 full (19941644 head, 19941707 tail, 64 max, 0 nreq)
      
      appear in syslog, and the driver wedges up.
      
      Apparently this is because writes to the doorbells from different CPUs
      reach the device out of order. The following patch adds mmiowb() calls
      after doorbell rings to ensure the doorbell writes are ordered.
      Signed-off-by: NArthur Kepner <akepner@sgi.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      1f5c23e2
  16. 23 9月, 2006 4 次提交
  17. 11 8月, 2006 2 次提交
  18. 15 7月, 2006 1 次提交
  19. 05 7月, 2006 1 次提交
    • Z
      [PATCH] mthca: initialize send and receive queue locks separately · a46f9484
      Zach Brown 提交于
      mthca: initialize send and receive queue locks separately
      
      lockdep identifies a lock by the call site of its initialization.  By
      initializing the send and receive queue locks in mthca_wq_init() we confuse
      lockdep.  It warns that that the ordered acquiry of both locks in
      mthca_modify_qp() is recursive acquiry of one lock:
      
        =============================================
        [ INFO: possible recursive locking detected ]
        ---------------------------------------------
        modprobe/1192 is trying to acquire lock:
         (&wq->lock){....}, at: [<f892b4db>] mthca_modify_qp+0x60/0xa7b [ib_mthca]
        but task is already holding lock:
         (&wq->lock){....}, at: [<f892b4ce>] mthca_modify_qp+0x53/0xa7b [ib_mthca]
      
      Initializing the locks separately in mthca_alloc_qp_common() stops the
      warning and will let lockdep enforce proper ordering on paths that acquire
      both locks.
      Signed-off-by: NZach Brown <zach.brown@oracle.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a46f9484
  20. 18 6月, 2006 2 次提交
    • R
      IB/mthca: Make all device methods truly reentrant · c93b6fba
      Roland Dreier 提交于
      Documentation/infiniband/core_locking.txt says:
      
        All of the methods in struct ib_device exported by a low-level
        driver must be fully reentrant.  The low-level driver is required to
        perform all synchronization necessary to maintain consistency, even
        if multiple function calls using the same object are run
        simultaneously.
      
      However, mthca's modify_qp, modify_srq and resize_cq methods are
      currently not reentrant.  Add a mutex to the QP, SRQ and CQ structures
      so that these calls can be properly serialized.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      c93b6fba
    • R
      IB/mthca: Fix memory leak on modify_qp error paths · c9c5d9fe
      Roland Dreier 提交于
      Some error paths after the mthca_alloc_mailbox() call in mthca_modify_qp()
      just do a "return -EINVAL" without freeing the mailbox.  Convert these
      returns to "goto out" to avoid leaking the mailbox storage.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      c9c5d9fe
  21. 19 5月, 2006 1 次提交
  22. 10 5月, 2006 1 次提交
    • R
      IB/mthca: Fix race in reference counting · a3285aa4
      Roland Dreier 提交于
      Fix races in in destroying various objects.  If a destroy routine
      waits for an object to become free by doing
      
      	wait_event(&obj->wait, !atomic_read(&obj->refcount));
      	/* now clean up and destroy the object */
      
      and another place drops a reference to the object by doing
      
      	if (atomic_dec_and_test(&obj->refcount))
      		wake_up(&obj->wait);
      
      then this is susceptible to a race where the wait_event() and final
      freeing of the object occur between the atomic_dec_and_test() and the
      wake_up().  And this is a use-after-free, since wake_up() will be
      called on part of the already-freed object.
      
      Fix this in mthca by replacing the atomic_t refcounts with plain old
      integers protected by a spinlock.  This makes it possible to do the
      decrement of the reference count and the wake_up() so that it appears
      as a single atomic operation to the code waiting on the wait queue.
      
      While touching this code, also simplify mthca_cq_clean(): the CQ being
      cleaned cannot go away, because it still has a QP attached to it.  So
      there's no reason to be paranoid and look up the CQ by number; it's
      perfectly safe to use the pointer that the callers already have.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      a3285aa4
  23. 11 4月, 2006 1 次提交
    • J
      IB: simplify static rate encoding · bf6a9e31
      Jack Morgenstein 提交于
      Push translation of static rate to HCA format into low-level drivers,
      where it belongs.  For static rate encoding, use encoding of rate
      field from IB standard PathRecord, with addition of value 0, for
      backwards compatibility with current usage.  The changes are:
      
       - Add enum ib_rate to midlayer includes.
       - Get rid of static rate translation in IPoIB; just use static rate
         directly from Path and MulticastGroup records.
       - Update mthca driver to translate absolute static rate into the
         format used by hardware.  This also fixes mthca's static rate
         handling for HCAs that are capable of 4X DDR.
      Signed-off-by: NJack Morgenstein <jackm@mellanox.co.il>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      bf6a9e31
  24. 30 3月, 2006 1 次提交
  25. 25 3月, 2006 4 次提交
  26. 21 3月, 2006 6 次提交