1. 16 Apr, 2008 1 commit
    • Roland Dreier's avatar
      IB/uverbs: Don't store struct file * for event files · 1ae5c187
      Roland Dreier authored
      The file member of struct ib_uverbs_event_file was only used to keep
      track of whether the file had been closed or not.  The only thing we
      ever did with the value was check if it was NULL or not.  Simplify the
      code and get rid of the need to keep track of the struct file * we
      allocate by replacing the file member with an is_closed member.
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  2. 09 Oct, 2007 1 commit
  3. 08 May, 2007 1 commit
    • Roland Dreier's avatar
      IB/uverbs: Export ib_umem_get()/ib_umem_release() to modules · f7c6a7b5
      Roland Dreier authored
      Export ib_umem_get()/ib_umem_release() and put low-level drivers in
      control of when to call ib_umem_get() to pin and DMA map userspace,
      rather than always calling it in ib_uverbs_reg_mr() before calling the
      low-level driver's reg_user_mr method.
      Also move these functions to be in the ib_core module instead of
      ib_uverbs, so that driver modules using them do not depend on
      This has a number of advantages:
       - It is better design from the standpoint of making generic code a
         library that can be used or overridden by device-specific code as
         the details of specific devices dictate.
       - Drivers that do not need to pin userspace memory regions do not
         need to take the performance hit of calling ib_mem_get().  For
         example, although I have not tried to implement it in this patch,
         the ipath driver should be able to avoid pinning memory and just
         use copy_{to,from}_user() to access userspace memory regions.
       - Buffers that need special mapping treatment can be identified by
         the low-level driver.  For example, it may be possible to solve
         some Altix-specific memory ordering issues with mthca CQs in
         userspace by mapping CQ buffers with extra flags.
       - Drivers that need to pin and DMA map userspace memory for things
         other than memory regions can use ib_umem_get() directly, instead
         of hacks using extra parameters to their reg_phys_mr method.  For
         example, the mlx4 driver that is pending being merged needs to pin
         and DMA map QP and CQ buffers, but it does not need to create a
         memory key for these buffers.  So the cleanest solution is for mlx4
         to call ib_umem_get() in the create_qp and create_cq methods.
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  4. 06 May, 2007 1 commit
    • Michael S. Tsirkin's avatar
      IB: Add CQ comp_vector support · f4fd0b22
      Michael S. Tsirkin authored
      Add a num_comp_vectors member to struct ib_device and extend
      ib_create_cq() to pass in a comp_vector parameter -- this parallels
      the userspace libibverbs API.  Update all hardware drivers to set
      num_comp_vectors to 1 and have all ULPs pass 0 for the comp_vector
      value.  Pass the value of num_comp_vectors to userspace rather than
      hard-coding a value of 1.
      We want multiple CQ event vector support (via MSI-X or similar for
      adapters that can generate multiple interrupts), but it's not clear
      how many vectors we want, or how we want to deal with policy issues
      such as how to decide which vector to use or how to set up interrupt
      affinity.  This patch is useful for experimenting, since no core
      changes will be necessary when updating a driver to support multiple
      vectors, and we know that we want to make at least these changes
      Signed-off-by: default avatarMichael S. Tsirkin <mst@dev.mellanox.co.il>
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  5. 12 Feb, 2007 1 commit
  6. 08 Dec, 2006 1 commit
  7. 03 Aug, 2006 1 commit
  8. 23 Jun, 2006 1 commit
    • David Howells's avatar
      [PATCH] VFS: Permit filesystem to override root dentry on mount · 454e2398
      David Howells authored
      Extend the get_sb() filesystem operation to take an extra argument that
      permits the VFS to pass in the target vfsmount that defines the mountpoint.
      The filesystem is then required to manually set the superblock and root dentry
      pointers.  For most filesystems, this should be done with simple_set_mnt()
      which will set the superblock pointer and then set the root dentry to the
      superblock's s_root (as per the old default behaviour).
      The get_sb() op now returns an integer as there's now no need to return the
      superblock pointer.
      This patch permits a superblock to be implicitly shared amongst several mount
      points, such as can be done with NFS to avoid potential inode aliasing.  In
      such a case, simple_set_mnt() would not be called, and instead the mnt_root
      and mnt_sb would be set directly.
      The patch also makes the following changes:
       (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
           pointer argument and return an integer, so most filesystems have to change
           very little.
       (*) If one of the convenience function is not used, then get_sb() should
           normally call simple_set_mnt() to instantiate the vfsmount. This will
           always return 0, and so can be tail-called from get_sb().
       (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
           dcache upon superblock destruction rather than shrink_dcache_anon().
           This is required because the superblock may now have multiple trees that
           aren't actually bound to s_root, but that still need to be cleaned up. The
           currently called functions assume that the whole tree is rooted at s_root,
           and that anonymous dentries are not the roots of trees which results in
           dentries being left unculled.
           However, with the way NFS superblock sharing are currently set to be
           implemented, these assumptions are violated: the root of the filesystem is
           simply a dummy dentry and inode (the real inode for '/' may well be
           inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
           with child trees.
           [*] Anonymous until discovered from another tree.
       (*) The documentation has been adjusted, including the additional bit of
           changing ext2_* into foo_* in the documentation.
      [akpm@osdl.org: convert ipath_fs, do other stuff]
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
  9. 22 Jun, 2006 1 commit
    • Roland Dreier's avatar
      IB/uverbs: Remove unnecessary list_del()s · 9b8efc02
      Roland Dreier authored
      In ib_uverbs_cleanup_ucontext(), when iterating through the lists of
      objects, there's no reason to do list_del() to remove the objects,
      since both the objects and the lists that contain them are about to be
      freed anyway.  Since list_del() is a moderately big inline function,
      getting rid of this extra work saves quite a bit of .text:
      add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-217 (-214)
      function                                     old     new   delta
      ib_uverbs_comp_handler                       225     228      +3
      ib_uverbs_async_handler                      256     255      -1
      ib_uverbs_close                              905     689    -216
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  10. 17 Jun, 2006 1 commit
    • Roland Dreier's avatar
      IB/uverbs: Don't serialize with ib_uverbs_idr_mutex · 9ead190b
      Roland Dreier authored
      Currently, all userspace verbs operations that call into the kernel
      are serialized by ib_uverbs_idr_mutex.  This can be a scalability
      issue for some workloads, especially for devices driven by the ipath
      driver, which needs to call into the kernel even for datapath
      Fix this by adding reference counts to the userspace objects, and then
      converting ib_uverbs_idr_mutex into a spinlock that only protects the
      idrs long enough to take a reference on the object being looked up.
      Because remove operations may fail, we have to do a slightly funky
      two-step deletion, which is described in the comments at the top of
      This also still leaves ib_uverbs_idr_lock as a single lock that is
      possibly subject to contention.  However, the lock hold time will only
      be a single idr operation, so multiple threads should still be able to
      make progress, even if ib_uverbs_idr_lock is being ping-ponged.
      Surprisingly, these changes even shrink the object code:
      add/remove: 23/5 grow/shrink: 4/21 up/down: 633/-693 (-60)
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  11. 20 Mar, 2006 4 commits
  12. 17 Jan, 2006 1 commit
  13. 13 Jan, 2006 1 commit
  14. 29 Nov, 2005 1 commit
  15. 02 Nov, 2005 1 commit
  16. 31 Oct, 2005 1 commit
  17. 28 Oct, 2005 2 commits
  18. 24 Oct, 2005 1 commit
  19. 17 Oct, 2005 5 commits
  20. 26 Sep, 2005 1 commit
    • Roland Dreier's avatar
      [IB] uverbs: Close some exploitable races · 63c47c28
      Roland Dreier authored
      Al Viro pointed out that the current IB userspace verbs interface
      allows userspace to cause mischief by closing file descriptors before
      we're ready, or issuing the same command twice at the same time.  This
      patch closes those races, and fixes other obvious problems such as a
      module reference leak.
      Some other interface bogosities will require an ABI change to fix
      properly, so I'm deferring those fixes until 2.6.15.
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  21. 09 Sep, 2005 1 commit
    • Roland Dreier's avatar
      Make sure that userspace does not retrieve stale asynchronous or · 63aaf647
      Roland Dreier authored
      completion events after destroying a CQ, QP or SRQ.  We do this by
      sweeping the event lists before returning from a destroy calls, and
      then return the number of events already reported before the destroy
      call.  This allows userspace wait until it has processed all events
      for an object returned from the kernel before it frees its context for
      the object.
      The ABI of the destroy CQ, destroy QP and destroy SRQ commands has to
      change to return the event count, so bump the ABI version from 1 to 2.
      The userspace libibverbs library has already been updated to handle
      both the old and new ABI versions.
      Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
  22. 26 Aug, 2005 3 commits
  23. 27 Jul, 2005 1 commit
  24. 07 Jul, 2005 1 commit