1. 05 12月, 2018 1 次提交
  2. 04 12月, 2018 15 次提交
  3. 30 11月, 2018 1 次提交
  4. 27 11月, 2018 8 次提交
  5. 23 11月, 2018 10 次提交
    • P
      RDMA/core: Sync unregistration with netlink commands · 01b67117
      Parav Pandit 提交于
      When the rdma device is getting removed, get resource info can race with
      device removal, as below:
      
            CPU-0                                  CPU-1
          --------                               --------
          rdma_nl_rcv_msg()
             nldev_res_get_cq_dumpit()
                mutex_lock(device_lock);
                get device reference
                mutex_unlock(device_lock);        [..]
                                                  ib_unregister_device()
                                                  /* Valid reference to
                                                   * device->dev exists.
                                                   */
                                                   ib_dealloc_device()
      
                [..]
                provider->fill_res_entry();
      
      Even though device object is not freed, fill_res_entry() can get called on
      device which doesn't have a driver anymore. Kernel core device reference
      count is not sufficient, as this only keeps the structure valid, and
      doesn't guarantee the driver is still loaded.
      
      Similar race can occur with device renaming and device removal, where
      device_rename() tries to rename a unregistered device. While this is fine
      for devices of a class which are not net namespace aware, but it is
      incorrect for net namespace aware class coming in subsequent series.  If a
      class is net namespace aware, then the below [1] call trace is observed in
      above situation.
      
      Therefore, to avoid the race, keep a reference count and let device
      unregistration wait until all netlink users drop the reference.
      
      [1] Call trace:
      kernfs: ns required in 'infiniband' for 'mlx5_0'
      WARNING: CPU: 18 PID: 44270 at fs/kernfs/dir.c:842 kernfs_find_ns+0x104/0x120
      libahci i2c_core mlxfw libata dca [last unloaded: devlink]
      RIP: 0010:kernfs_find_ns+0x104/0x120
      Call Trace:
      kernfs_find_and_get_ns+0x2e/0x50
      sysfs_rename_link_ns+0x40/0xb0
      device_rename+0xb2/0xf0
      ib_device_rename+0xb3/0x100 [ib_core]
      nldev_set_doit+0x165/0x190 [ib_core]
      rdma_nl_rcv_msg+0x249/0x250 [ib_core]
      ? netlink_deliver_tap+0x8f/0x3e0
      rdma_nl_rcv+0xd6/0x120 [ib_core]
      netlink_unicast+0x17c/0x230
      netlink_sendmsg+0x2f0/0x3e0
      sock_sendmsg+0x30/0x40
      __sys_sendto+0xdc/0x160
      
      Fixes: da5c8507 ("RDMA/nldev: add driver-specific resource tracking")
      Signed-off-by: NParav Pandit <parav@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      01b67117
    • P
      RDMA/cma: Move cma module specific functions to cma_priv.h · eeb8df87
      Parav Pandit 提交于
      Currently several rdma_cm module specific functions are declared in
      core_priv.h file. Now that we have cma_priv.h file specific to rdma_cm
      kernel module, move them from core_priv.h to cma_priv.h
      Signed-off-by: NParav Pandit <parav@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      eeb8df87
    • J
      RDMA/uverbs: Check for NULL driver methods for every write call · a140692a
      Jason Gunthorpe 提交于
      Add annotations to the uverbs_api structure indicating which driver
      methods are called by the implementation. If the required method
      is NULL the write API will be not be callable.
      
      This effectively duplicates the cmd_mask system, however it does it by
      expressing invariants required by the core code, not by delegating
      decision making to the driver. This is another step toward eliminating
      cmd_mask.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      a140692a
    • J
      RDMA/uverbs: Make all the method functions in uverbs_cmd static · 1de751ca
      Jason Gunthorpe 提交于
      Now that we use struct uverbs_uapi to link the method functions to the
      dispatcher there is no reason to have them be extern symbols.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      1de751ca
    • J
      RDMA/uverbs: Convert the write interface to use uverbs_api · d120c3c9
      Jason Gunthorpe 提交于
      This organizes the write commands into objects and links them to the
      uverbs_api data structure. The command path is reworked to use uapi
      instead of its internal structures.
      
      The command mask is moved from a runtime check to a registration time
      check in the uapi.
      
      Since the write interface does not have the object ID as part of the
      command, the radix bins are converted into linear lists to support the
      lookup.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      d120c3c9
    • J
      RDMA/verbs: Store the write/write_ex uapi entry points in the uverbs_api · 6884c6c4
      Jason Gunthorpe 提交于
      Bringing all uapi entry points into one place lets us deal with them
      consistently. For instance the write, write_ex and ioctl paths can be
      disabled when an API is not supported by the driver.
      
      This will replace the uverbs_cmd_table static arrays.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      6884c6c4
    • J
      RDMA/uverbs: Require all objects to have a driver destroy function · 0bd01f3d
      Jason Gunthorpe 提交于
      If we can't destroy the object then we certainly shouldn't allow it be
      created or used. Remove it from the uverbs_uapi in this case.
      
      This also disables methods of other objects that have mandatory object
      handle inputs - ie REG_DM_MR is now automatically removed if DM objects
      cannot be created.
      
      Typically drivers not supporting an interface will mark all of the
      supporting functions as NULL, including destroy.
      
      This is intended to automatically eliminate entire corner cases in the API
      that are difficult to test.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      0bd01f3d
    • J
      RDMA/uverbs: Add helpers to mark uapi functions as unsupported · 6829c1c2
      Jason Gunthorpe 提交于
      We have many cases where parts of the uapi are not supported in a driver,
      needs a certain protocol, or whatever. It is best to reflect this directly
      into the struct uverbs_api when it is built so that everything is simply
      blocked off, and future introspection can report a proper supported list.
      
      This is done by adding some additional helpers to the definition list
      language that disable objects based on a 'supported' call back, and a
      helper that disables based on a NULL struct ib_device function pointer.
      
      Disablement is global. For instance, if a driver disables an object then
      everything connected to that object is removed, including core methods.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      6829c1c2
    • J
      RDMA/uverbs: Factor out the add/get pattern into a helper · c27f6aa8
      Jason Gunthorpe 提交于
      The next patch needs another copy of this, provide a simple helper to
      reduce the coding. uapi_add_get_elm() returns an existing entry or adds a
      new one.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      c27f6aa8
    • J
      RDMA/uverbs: Use a linear list to describe the compiled-in uapi · 0cbf432d
      Jason Gunthorpe 提交于
      The 'tree' data structure is very hard to build at compile time, and this
      makes it very limited. The new radix tree based compiler can handle a more
      complex input language that does not require the compiler to perfectly
      group everything into a neat tree structure.
      
      Instead use a simple list to describe to input, where the list elements
      can be of various different 'opcodes' instructing the radix compiler what
      to do. Start out with opcodes chaining to other definition lists and
      chaining to the existing 'tree' definition.
      
      Replace the very top level of the 'object tree' with this list type and
      get rid of struct uverbs_object_tree_def and DECLARE_UVERBS_OBJECT_TREE.
      Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
      0cbf432d
  6. 22 11月, 2018 1 次提交
  7. 13 11月, 2018 1 次提交
  8. 18 10月, 2018 1 次提交
  9. 17 10月, 2018 2 次提交