1. 13 2月, 2007 5 次提交
  2. 11 2月, 2007 2 次提交
    • D
      IB/mthca: Work around gcc bug on sparc64 · 6bdd61d8
      David Howells 提交于
      For some reason gcc-3.4.5 on sparc64 does:
      
       WARNING: "____ilog2_NaN" [drivers/infiniband/hw/mthca/ib_mthca.ko] undefined!
      
      Points to note:
      
       (1) The asm volatile flush/flushw are just markers for viewing what comes out
           in the assembly; removing them has no effect on the result.
      
       (2) Changing almost anything else in dwh__mthca_arbel_init_srq_context() or
           dwh__mthca_alloc_srq() causes the problem to go away.
      
      The compiler command line issued by the kernel build is:
      
      /opt/crosstool/gcc-3.4.5-glibc-2.3.6/sparc64-unknown-linux-gnu/bin/sparc64-unknown-linux-gnu-gcc -fno-strict-aliasing -fno-common -Os -m64 -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wa,--undeclared-regs -pg -fno-omit-frame-pointer -fno-optimize-sibling-calls -fasynchronous-unwind-tables -g  -c -o drivers/infiniband/hw/mthca/.tmp_mthca_srq.o drivers/infiniband/hw/mthca/mthca_srq.c
      
      This can be reduced to this whilst still retaining the problem:
      
      /opt/crosstool/gcc-3.4.5-glibc-2.3.6/sparc64-unknown-linux-gnu/bin/sparc64-unknown-linux-gnu-gcc -m64 -c -o drivers/infiniband/hw/mthca/mthca_srq.o drivers/infiniband/hw/mthca/mthca_srq.c -Os
      
      Removing -Os or changing it to -O or -O0 thru -O6 gets rid of the problem.
      
      This patch to the kernel code fixes the problem:
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      6bdd61d8
    • R
      IB/mthca: Use correct structure size in call to memset() · 99d4f22e
      Roland Dreier 提交于
      When clearing the ib_ah_attr parameter in to_ib_ah_attr(), use sizeof
      *ib_ah_attr instead of sizeof *path.
      
      Pointed out by Jack Morgenstein <jackm@mellanox.co.il>.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      99d4f22e
  3. 05 2月, 2007 1 次提交
    • M
      IB: Return qp pointer as part of ib_wc · 062dbb69
      Michael S. Tsirkin 提交于
      struct ib_wc currently only includes the local QP number: this matches
      the IB spec, but seems mostly useless. The following patch replaces
      this with the pointer to qp itself, and updates all low level drivers
      and all users.
      
      This has the following advantages:
      - Ability to get a per-qp context through wc->qp->qp_context
      - Existing drivers already have the qp pointer ready in poll cq, so
        this change actually saves a tiny bit (extra memory read) on data path
        (for ehca it would actually be expensive to find the QP pointer when
        polling a CQ, but ehca does not support SRQ so we can leave wc->qp as
        NULL for ehca)
      - Users that need the QP number can still get it through wc->qp->qp_num
      
      Use case:
      
      In IPoIB connected mode code, I have a common CQ shared by multiple
      QPs.  To track connection usage, I need a way to get at some per-QP
      context upon the completion, and I would like to avoid allocating
      context object per work request just to stick a QP pointer into it.
      With this code, I can just use wc->qp->qp_context.
      Signed-off-by: NMichael S. Tsirkin <mst@mellanox.co.il>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      062dbb69
  4. 10 1月, 2007 1 次提交
  5. 08 1月, 2007 1 次提交
  6. 05 1月, 2007 1 次提交
    • M
      IB/mthca: Fix off-by-one in FMR handling on memfree · 46707e96
      Michael S. Tsirkin 提交于
      mthca_table_find() will return the wrong address when the table entry
      being searched for is exactly at the beginning of a sglist entry
      (other than the first), because it uses >= when it should use >.
      
      Example: assume we have 2 entries in scatterlist, 4K each, offset is
      4K.  The current code will return first entry + 4K when we really want
      the second entry.
      
      In particular this means mapping an FMR on a memfree HCA may end up
      writing the page table into the wrong place, leading to memory
      corruption and also causing the HCA to use an incorrect address
      translation table.
      Signed-off-by: NMichael S. Tsirkin <mst@mellanox.co.il>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      46707e96
  7. 31 12月, 2006 1 次提交
  8. 16 12月, 2006 2 次提交
  9. 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
  10. 08 12月, 2006 1 次提交
  11. 30 11月, 2006 3 次提交
  12. 22 11月, 2006 1 次提交
  13. 01 11月, 2006 1 次提交
  14. 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
  15. 11 10月, 2006 2 次提交
  16. 05 10月, 2006 1 次提交
    • D
      IRQ: Maintain regs pointer globally rather than passing to IRQ handlers · 7d12e780
      David Howells 提交于
      Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
      of passing regs around manually through all ~1800 interrupt handlers in the
      Linux kernel.
      
      The regs pointer is used in few places, but it potentially costs both stack
      space and code to pass it around.  On the FRV arch, removing the regs parameter
      from all the genirq function results in a 20% speed up of the IRQ exit path
      (ie: from leaving timer_interrupt() to leaving do_IRQ()).
      
      Where appropriate, an arch may override the generic storage facility and do
      something different with the variable.  On FRV, for instance, the address is
      maintained in GR28 at all times inside the kernel as part of general exception
      handling.
      
      Having looked over the code, it appears that the parameter may be handed down
      through up to twenty or so layers of functions.  Consider a USB character
      device attached to a USB hub, attached to a USB controller that posts its
      interrupts through a cascaded auxiliary interrupt controller.  A character
      device driver may want to pass regs to the sysrq handler through the input
      layer which adds another few layers of parameter passing.
      
      I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
      main part of the code on FRV and i386, though I can't test most of the drivers.
      I've also done partial conversion for powerpc and MIPS - these at least compile
      with minimal configurations.
      
      This will affect all archs.  Mostly the changes should be relatively easy.
      Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
      
      	struct pt_regs *old_regs = set_irq_regs(regs);
      
      And put the old one back at the end:
      
      	set_irq_regs(old_regs);
      
      Don't pass regs through to generic_handle_irq() or __do_IRQ().
      
      In timer_interrupt(), this sort of change will be necessary:
      
      	-	update_process_times(user_mode(regs));
      	-	profile_tick(CPU_PROFILING, regs);
      	+	update_process_times(user_mode(get_irq_regs()));
      	+	profile_tick(CPU_PROFILING);
      
      I'd like to move update_process_times()'s use of get_irq_regs() into itself,
      except that i386, alone of the archs, uses something other than user_mode().
      
      Some notes on the interrupt handling in the drivers:
      
       (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
           the input_dev struct.
      
       (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
           something different depending on whether it's been supplied with a regs
           pointer or not.
      
       (*) Various IRQ handler function pointers have been moved to type
           irq_handler_t.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
      7d12e780
  17. 23 9月, 2006 11 次提交
  18. 01 9月, 2006 1 次提交
    • R
      IB/mthca: Use IRQ safe locks to protect allocation bitmaps · 5a4e6dcc
      Roland Dreier 提交于
      It is supposed to be OK to call mthca_create_ah() and mthca_destroy_ah()
      from any context.  However, for mem-full HCAs, these functions use the
      mthca_alloc() and mthca_free() bitmap helpers, and those helpers use
      non-IRQ-safe spin_lock() internally.  Lockdep correctly warns that
      this could lead to a deadlock.  Fix this by changing mthca_alloc() and
      mthca_free() to use spin_lock_irqsave().
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      5a4e6dcc
  19. 24 8月, 2006 1 次提交
  20. 19 8月, 2006 1 次提交
    • R
      IB/mthca: No userspace SRQs if HCA doesn't have SRQ support · 5beba532
      Roland Dreier 提交于
      Leave all SRQ methods out of the device's uverbs_cmd_mask if the
      device doesn't have SRQ support (because of ancient firmware) so that
      we don't allow userspace to call the driver's create_srq method.  This
      fixes a userspace-triggerable oops caused by ib_uverbs_create_srq()
      following the device's ->create_srq function pointer, which will be
      NULL if the device doesn't support SRQs.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      5beba532
  21. 11 8月, 2006 1 次提交
    • R
      IB/mthca: Fix potential AB-BA deadlock with CQ locks · a19aa5c5
      Roland Dreier 提交于
      When destroying a QP, mthca locks both the QP's send CQ and receive
      CQ.  However, the following scenario is perfectly valid:
      
          QP_a: send_cq == CQ_x, recv_cq == CQ_y
          QP_b: send_cq == CQ_y, recv_cq == CQ_x
      
      The old mthca code simply locked send_cq and then recv_cq, which in
      this case could lead to an AB-BA deadlock if QP_a and QP_b were
      destroyed simultaneously.
      
      We can fix this by changing the locking code to lock the CQ with the
      lower CQ number first, which will create a consistent lock ordering.
      Also, the second CQ is locked with spin_lock_nested() to tell lockdep
      that we know what we're doing with the lock nesting.
      
      This bug was found by lockdep.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      a19aa5c5