[PATCH] ib_umem_release should decrement mm-pinned_vm from ib_umem_get

2014-08-12 Thread Shawn Bohrer
From: Shawn Bohrer sboh...@rgmadvisors.com In debugging an application that receives -ENOMEM from ib_reg_mr() I found that ib_umem_get() can fail because the pinned_vm count has wrapped causing it to always be larger than the lock limit even with RLIMIT_MEMLOCK set to RLIM_INFINITY. The wrapping

[PATCH 4/8] IB/mlx4: use ARRAY_SIZE instead of sizeof/sizeof[0]

2014-08-12 Thread Doug Ledford
From: Fabian Frederick f...@skynet.be use macro definition Cc: Roland Dreier rol...@kernel.org Cc: Sean Hefty sean.he...@intel.com Cc: linux-rdma@vger.kernel.org Signed-off-by: Fabian Frederick f...@skynet.be Signed-off-by: Doug Ledford dledf...@redhat.com --- drivers/infiniband/hw/mlx4/main.c

[PATCH 1/8] RDMA/amso1100: integer overflow in c2_alloc_cq_buf()

2014-08-12 Thread Doug Ledford
From: Dan Carpenter dan.carpen...@oracle.com This is a static checker fix. The static checker says that q_size comes from the user and can be any 32 bit value. The call tree is: -- ib_uverbs_create_cq() -- c2_create_cq() -- c2_init_cq() Signed-off-by: Dan Carpenter

[PATCH 6/8] ib/srpt: Enhance printk output

2014-08-12 Thread Doug Ledford
The ib_srpt module has a metric ton of printks for debugging and warnings and such. And it never prefaces a single one of them with information to allow an admin to know what errant module is spewing garbage all through their dmesg output. Fix that. Signed-off-by: Doug Ledford

[PATCH 5/8] IB/mlx5: use ARRAY_SIZE instead of sizeof/sizeof[0]

2014-08-12 Thread Doug Ledford
From: Fabian Frederick f...@skynet.be use macro definition Cc: Eli Cohen e...@mellanox.com Cc: Roland Dreier rol...@kernel.org Cc: linux-rdma@vger.kernel.org Acked-by: Eli Cohen e...@mellanox.com Signed-off-by: Fabian Frederick f...@skynet.be Signed-off-by: Doug Ledford dledf...@redhat.com ---

[PATCH 7/8] ib/srpt: Handle GID change events

2014-08-12 Thread Doug Ledford
GID change events need a refresh just like LID change events and several others. Handle this the same as the others. Signed-off-by: Doug Ledford dledf...@redhat.com --- drivers/infiniband/ulp/srpt/ib_srpt.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH 4/8] IPoIB: fix mcast_dev_flush/mcast_restart_task race

2014-08-12 Thread Doug Ledford
Our mcast_dev_flush routine and our mcast_restart_task can race against each other. In particular, they both hold the priv-lock while manipulating the rbtree and while removing mcast entries from the multicast_list and while adding entries to the remove_list, but they also both drop their locks

[PATCH 2/8] IPoIB: Make the carrier_on_task race aware

2014-08-12 Thread Doug Ledford
We blindly assume that we can just take the rtnl lock and that will prevent races with downing this interface. Unfortunately, that's not the case. In ipoib_mcast_stop_thread() we will call flush_workqueue() in an attempt to clear out all remaining instances of ipoib_join_task. But, since this

[PATCH 8/8] IPoIB: No longer use flush as a parameter

2014-08-12 Thread Doug Ledford
Various places in the IPoIB code had a deadlock related to flushing the ipoib workqueue. Now that we have per device workqueues and a specific flush workqueue, there is no longer a deadlock issue with flushing the device specific workqueues and we can do so unilaterally. Signed-off-by: Doug

[PATCH 5/8] IPoIB: change init sequence ordering

2014-08-12 Thread Doug Ledford
In preparation for using per device work queues, we need to move the start of the neighbor thread task to after ipoib_ib_dev_init and move the destruction of the neighbor task to before ipoib_ib_dev_cleanup. Otherwise we will end up freeing our workqueue with work possibly still on it.

[PATCH 6/8] IPoIB: Use dedicated workqueues per interface

2014-08-12 Thread Doug Ledford
During my recent work on the rtnl lock deadlock in the IPoIB driver, I saw that even once I fixed the apparent races for a single device, as soon as that device had any children, new races popped up. It turns out that this is because no matter how well we protect against races on a single device,

[PATCH 3/8] IPoIB: fix MCAST_FLAG_BUSY usage

2014-08-12 Thread Doug Ledford
Commit a9c8ba5884 (IPoIB: Fix usage of uninitialized multicast objects) added a new flag MCAST_JOIN_STARTED, but was not very strict in how it was used. We didn't always initialize the completion struct before we set the flag, and we didn't always call complete on the completion struct from all

[PATCH 7/8] IPoIB: Make ipoib_mcast_stop_thread flush the workqueue

2014-08-12 Thread Doug Ledford
We used to pass a flush variable to mcast_stop_thread to indicate if we should flush the workqueue or not. This was due to some code trying to flush a workqueue that it was currently running on which is a no-no. Now that we have per-device work queues, and now that ipoib_mcast_restart_task has

[PATCH 0/8] IPoIB: Fix multiple race conditions

2014-08-12 Thread Doug Ledford
Locking of multicast joins/leaves in the IPoIB layer have been problematic for a while. There have been recent changes to try and make things better, including these changes: bea1e22 IPoIB: Fix use-after-free of multicast object a9c8ba5 IPoIB: Fix usage of uninitialized multicast objects

[PATCH 1/8] IPoIB: Consolidate rtnl_lock tasks in workqueue

2014-08-12 Thread Doug Ledford
Setting the mtu can safely be moved to the carrier_on_task, which keeps us from needing to take the rtnl lock in the join_finish section. Signed-off-by: Doug Ledford dledf...@redhat.com --- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 8 ++-- 1 file changed, 2 insertions(+), 6

Re: [PATCH 6/8] ib/srpt: Enhance printk output

2014-08-12 Thread Roland Dreier
On Tue, Aug 12, 2014 at 4:20 PM, Doug Ledford dledf...@redhat.com wrote: The ib_srpt module has a metric ton of printks for debugging and warnings and such. And it never prefaces a single one of them with information to allow an admin to know what errant module is spewing garbage all through

Re: [PATCH 2/8] IB/srp: Use P_Key cache for P_Key lookups

2014-08-12 Thread Roland Dreier
On Tue, Aug 12, 2014 at 4:20 PM, Doug Ledford dledf...@redhat.com wrote: - ret = ib_find_pkey(target-srp_host-srp_dev-dev, - target-srp_host-port, - be16_to_cpu(target-path.pkey), - attr-pkey_index); + ret