1. 26 1月, 2008 1 次提交
    • R
      IB/umad: Simplify and fix locking · 2fe7e6f7
      Roland Dreier 提交于
      In addition to being overly complex, the locking in user_mad.c is
      broken: there were multiple reports of deadlocks and lockdep warnings.
      In particular it seems that a single thread may end up trying to take
      the same rwsem for reading more than once, which is explicitly
      forbidden in the comments in <linux/rwsem.h>.
      
      To solve this, we change the locking to use plain mutexes instead of
      rwsems.  There is one mutex per open file, which protects the contents
      of the struct ib_umad_file, including the array of agents and list of
      queued packets; and there is one mutex per struct ib_umad_port, which
      protects the contents, including the list of open files.  We never
      hold the file mutex across calls to functions like ib_unregister_mad_agent(),
      which can call back into other ib_umad code to queue a packet, and we
      always hold the port mutex as long as we need to make sure that a
      device is not hot-unplugged from under us.
      
      This even makes things nicer for users of the -rt patch, since we
      remove calls to downgrade_write() (which is not implemented in -rt).
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      2fe7e6f7
  2. 10 10月, 2007 2 次提交
    • R
      IB/umad: Fix bit ordering and 32-on-64 problems on big endian systems · a394f83b
      Roland Dreier 提交于
      The declaration of struct ib_user_mad_reg_req.method_mask[] exported
      to userspace was an array of __u32, but the kernel internally treated
      it as a bitmap made up of longs.  This makes a difference for 64-bit
      big-endian kernels, where numbering the bits in an array of__u32 gives:
      
          |31.....0|63....31|95....64|127...96|
      
      while numbering the bits in an array of longs gives:
      
          |63..............0|127............64|
      
      64-bit userspace can handle this by just treating method_mask[] as an
      array of longs, but 32-bit userspace is really stuck: the meaning of
      the bits in method_mask[] depends on whether the kernel is 32-bit or
      64-bit, and there's no sane way for userspace to know that.
      
      Fix this by updating <rdma/ib_user_mad.h> to make it clear that
      method_mask[] is an array of longs, and using a compat_ioctl method to
      convert to an array of 64-bit longs to handle the 32-on-64 problem.
      This fixes the interface description to match existing behavior (so
      working binaries continue to work) in almost all situations, and gives
      consistent semantics in the case of 32-bit userspace that can run on
      either a 32-bit or 64-bit kernel, so that the same binary can work for
      both 32-on-32 and 32-on-64 systems.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      a394f83b
    • R
      IB/umad: Add P_Key index support · 2be8e3ee
      Roland Dreier 提交于
      Add support for setting the P_Key index of sent MADs and getting the
      P_Key index of received MADs.  This requires a change to the layout of
      the ABI structure struct ib_user_mad_hdr, so to avoid breaking
      compatibility, we default to the old (unchanged) ABI and add a new
      ioctl IB_USER_MAD_ENABLE_PKEY that allows applications that are aware
      of the new ABI to opt into using it.
      
      We plan on switching to the new ABI by default in a year or so, and
      this patch adds a warning that is printed when an application uses the
      old ABI, to push people towards converting to the new ABI.
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      Reviewed-by: NSean Hefty <sean.hefty@intel.com>
      Reviewed-by: NHal Rosenstock <hal@xsigo.com>
      2be8e3ee
  3. 03 5月, 2007 1 次提交
    • J
      PCI: Cleanup the includes of <linux/pci.h> · 6473d160
      Jean Delvare 提交于
      I noticed that many source files include <linux/pci.h> while they do
      not appear to need it. Here is an attempt to clean it all up.
      
      In order to find all possibly affected files, I searched for all
      files including <linux/pci.h> but without any other occurence of "pci"
      or "PCI". I removed the include statement from all of these, then I
      compiled an allmodconfig kernel on both i386 and x86_64 and fixed the
      false positives manually.
      
      My tests covered 66% of the affected files, so there could be false
      positives remaining. Untested files are:
      
      arch/alpha/kernel/err_common.c
      arch/alpha/kernel/err_ev6.c
      arch/alpha/kernel/err_ev7.c
      arch/ia64/sn/kernel/huberror.c
      arch/ia64/sn/kernel/xpnet.c
      arch/m68knommu/kernel/dma.c
      arch/mips/lib/iomap.c
      arch/powerpc/platforms/pseries/ras.c
      arch/ppc/8260_io/enet.c
      arch/ppc/8260_io/fcc_enet.c
      arch/ppc/8xx_io/enet.c
      arch/ppc/syslib/ppc4xx_sgdma.c
      arch/sh64/mach-cayman/iomap.c
      arch/xtensa/kernel/xtensa_ksyms.c
      arch/xtensa/platform-iss/setup.c
      drivers/i2c/busses/i2c-at91.c
      drivers/i2c/busses/i2c-mpc.c
      drivers/media/video/saa711x.c
      drivers/misc/hdpuftrs/hdpu_cpustate.c
      drivers/misc/hdpuftrs/hdpu_nexus.c
      drivers/net/au1000_eth.c
      drivers/net/fec_8xx/fec_main.c
      drivers/net/fec_8xx/fec_mii.c
      drivers/net/fs_enet/fs_enet-main.c
      drivers/net/fs_enet/mac-fcc.c
      drivers/net/fs_enet/mac-fec.c
      drivers/net/fs_enet/mac-scc.c
      drivers/net/fs_enet/mii-bitbang.c
      drivers/net/fs_enet/mii-fec.c
      drivers/net/ibm_emac/ibm_emac_core.c
      drivers/net/lasi_82596.c
      drivers/parisc/hppb.c
      drivers/sbus/sbus.c
      drivers/video/g364fb.c
      drivers/video/platinumfb.c
      drivers/video/stifb.c
      drivers/video/valkyriefb.c
      include/asm-arm/arch-ixp4xx/dma.h
      sound/oss/au1550_ac97.c
      
      I would welcome test reports for these files. I am fine with removing
      the untested files from the patch if the general opinion is that these
      changes aren't safe. The tested part would still be nice to have.
      
      Note that this patch depends on another header fixup patch I submitted
      to LKML yesterday:
        [PATCH] scatterlist.h needs types.h
        http://lkml.org/lkml/2007/3/01/141Signed-off-by: NJean Delvare <khali@linux-fr.org>
      Cc: Badari Pulavarty <pbadari@us.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6473d160
  4. 25 4月, 2007 1 次提交
  5. 19 4月, 2007 1 次提交
  6. 13 2月, 2007 1 次提交
  7. 23 9月, 2006 2 次提交
  8. 25 7月, 2006 1 次提交
  9. 30 3月, 2006 1 次提交
  10. 21 3月, 2006 1 次提交
    • J
      IB/umad: Add support for large RMPP transfers · f36e1793
      Jack Morgenstein 提交于
      Add support for sending and receiving large RMPP transfers.  The old
      code supports transfers only as large as a single contiguous kernel
      memory allocation.  This patch uses linked list of memory buffers when
      sending and receiving data to avoid needing contiguous pages for
      larger transfers.
      
        Receive side: copy the arriving MADs in chunks instead of coalescing
        to one large buffer in kernel space.
      
        Send side: split a multipacket MAD buffer to a list of segments,
        (multipacket_list) and send these using a gather list of size 2.
        Also, save pointer to last sent segment, and retrieve requested
        segments by walking list starting at last sent segment. Finally,
        save pointer to last-acked segment.  When retrying, retrieve
        segments for resending relative to this pointer.  When updating last
        ack, start at this pointer.
      Signed-off-by: NJack Morgenstein <jackm@mellanox.co.il>
      Signed-off-by: NSean Hefty <sean.hefty@intel.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      f36e1793
  11. 10 12月, 2005 1 次提交
  12. 29 11月, 2005 1 次提交
  13. 19 11月, 2005 1 次提交
    • R
      IB/umad: make sure write()s have sufficient data · eabc7793
      Roland Dreier 提交于
      Make sure that userspace passes in enough data when sending a MAD.  We
      always copy at least sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR
      bytes from userspace, so anything less is definitely invalid.  Also,
      if the length is less than this limit, it's possible for the second
      copy_from_user() to get a negative length and trigger a BUG().
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      eabc7793
  14. 11 11月, 2005 3 次提交
  15. 07 11月, 2005 1 次提交
  16. 04 11月, 2005 1 次提交
  17. 29 10月, 2005 2 次提交
  18. 28 10月, 2005 2 次提交
  19. 26 10月, 2005 1 次提交
    • S
      [IB] Fix MAD layer DMA mappings to avoid touching data buffer once mapped · 34816ad9
      Sean Hefty 提交于
      The MAD layer was violating the DMA API by touching data buffers used
      for sends after the DMA mapping was done.  This causes problems on
      non-cache-coherent architectures, because the device doing DMA won't
      see updates to the payload buffers that exist only in the CPU cache.
      
      Fix this by having all MAD consumers use ib_create_send_mad() to
      allocate their send buffers, and moving the DMA mapping into the MAD
      layer so it can be done just before calling send (and after any
      modifications of the send buffer by the MAD layer).
      
      Tested on a non-cache-coherent PowerPC 440SPe system.
      Signed-off-by: NSean Hefty <sean.hefty@intel.com>
      Signed-off-by: NRoland Dreier <rolandd@cisco.com>
      34816ad9
  20. 21 10月, 2005 2 次提交
  21. 20 9月, 2005 1 次提交
  22. 27 8月, 2005 3 次提交
  23. 28 7月, 2005 2 次提交
  24. 26 5月, 2005 1 次提交
  25. 17 4月, 2005 2 次提交