Please pull infiniband.git
Linus, please pull from
master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git for-linus
This tree is also available from kernel.org mirrors at:
git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband.git for-linus
The changes and patch are:
Roland Dreier:
IB/ipath: Properly terminate PCI ID table
Sean Hefty:
IB: refcount race fixes
drivers/infiniband/core/cm.c | 12 ++++--- drivers/infiniband/core/mad.c | 47 +++++++++++++++------------- drivers/infiniband/core/mad_priv.h | 5 ++- drivers/infiniband/core/mad_rmpp.c | 20 ++++++------ drivers/infiniband/core/ucm.c | 12 ++++--- drivers/infiniband/hw/ipath/ipath_driver.c | 7 ++-- 6 files changed, 55 insertions(+), 48 deletions(-)
drivers/infiniband/core/cm.c +7 -5
@@ -34,6 +34,8 @@* * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $ */ + +#include <linux/completion.h> #include <linux/dma-mapping.h> #include <linux/err.h> #include <linux/idr.h>
@@ -122,7 +124,7 @@ struct cm_id_private {struct rb_node service_node;struct rb_node sidr_id_node;spinlock_t lock;/* Do not acquire inside cm.lock */ -wait_queue_head_t wait; +struct completion comp;atomic_t refcount;struct ib_mad_send_buf *msg;
@@ -159,7 +161,7 @@ static void cm_work_handler(void *data);static inline void cm_deref_id (struct cm_id_private *cm_id_priv) {if (atomic_dec_and_test (&cm_id_priv->refcount)) -wake_up (&cm_id_priv->wait); +complete (&cm_id_priv->comp); } static int cm_alloc_msg(struct cm_id_private *cm_id_priv,
@@ -559,7 +561,7 @@ struct ib_cm_id *ib_create_cm_id(struct goto error;spin_lock_init (&cm_id_priv->lock); -init_waitqueue_head (&cm_id_priv->wait); +init_completion (&cm_id_priv->comp);INIT_LIST_HEAD (&cm_id_priv->work_list);atomic_set (&cm_id_priv->work_count,-1 );atomic_set (&cm_id_priv->refcount,1 );
@@ -724,8 +726,8 @@ retest: }cm_free_id (cm_id->local_id); -atomic_dec (&cm_id_priv->refcount); -wait_event (cm_id_priv->wait, !atomic_read (&cm_id_priv->refcount)); +cm_deref_id (cm_id_priv); +wait_for_completion (&cm_id_priv->comp);while ((work =cm_dequeue_work (cm_id_priv)) !=NULL )cm_free_work (work);if (cm_id_priv->private_data && cm_id_priv->private_data_len)
drivers/infiniband/core/mad.c +25 -22
119 lines not on this page · raw message
drivers/infiniband/core/mad_priv.h +3 -2
@@ -37,6 +37,7 @@#ifndef __IB_MAD_PRIV_H__#define __IB_MAD_PRIV_H__ +#include <linux/completion.h> #include <linux/pci.h> #include <linux/kthread.h> #include <linux/workqueue.h>
@@ -108,7 +109,7 @@ struct ib_mad_agent_private {struct list_head rmpp_list;atomic_t refcount; -wait_queue_head_t wait; +struct completion comp; };struct ib_mad_snoop_private {
@@ -117,7 +118,7 @@ struct ib_mad_snoop_private {int snoop_index;int mad_snoop_flags;atomic_t refcount; -wait_queue_head_t wait; +struct completion comp; };struct ib_mad_send_wr_private {
drivers/infiniband/core/mad_rmpp.c +10 -10
@@ -49,7 +49,7 @@ struct mad_rmpp_recv {struct list_head list;struct work_struct timeout_work;struct work_struct cleanup_work; -wait_queue_head_t wait; +struct completion comp;enum rmpp_state state;spinlock_t lock;atomic_t refcount;
@@ -69,10 +69,16 @@ struct mad_rmpp_recv {u8 method; }; +static inline void deref_rmpp_recv (struct mad_rmpp_recv *rmpp_recv) +{ +if (atomic_dec_and_test (&rmpp_recv->refcount)) +complete (&rmpp_recv->comp); +} +static void destroy_rmpp_recv (struct mad_rmpp_recv *rmpp_recv) { -atomic_dec (&rmpp_recv->refcount); -wait_event (rmpp_recv->wait, !atomic_read (&rmpp_recv->refcount)); +deref_rmpp_recv (rmpp_recv); +wait_for_completion (&rmpp_recv->comp);ib_destroy_ah (rmpp_recv->ah);kfree (rmpp_recv); }
@@ -253,7 +259,7 @@ create_rmpp_recv(struct ib_mad_agent_pri goto error; rmpp_recv->agent = agent; -init_waitqueue_head (&rmpp_recv->wait); +init_completion (&rmpp_recv->comp);INIT_WORK (&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv);INIT_WORK (&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv);spin_lock_init (&rmpp_recv->lock);
@@ -279,12 +285,6 @@ error: kfree(rmpp_recv);return NULL ; } -static inline void deref_rmpp_recv (struct mad_rmpp_recv *rmpp_recv) -{ -if (atomic_dec_and_test (&rmpp_recv->refcount)) -wake_up (&rmpp_recv->wait); -} -static struct mad_rmpp_recv *find_rmpp_recv (struct ib_mad_agent_private *agent,struct ib_mad_recv_wc *mad_recv_wc)
drivers/infiniband/core/ucm.c +7 -5
@@ -32,6 +32,8 @@* * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ */ + +#include <linux/completion.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/module.h>
@@ -72,7 +74,7 @@ struct ib_ucm_file {struct ib_ucm_context {int id; -wait_queue_head_t wait; +struct completion comp;atomic_t ref;int events_reported;
@@ -138,7 +140,7 @@ static struct ib_ucm_context *ib_ucm_ctxstatic void ib_ucm_ctx_put (struct ib_ucm_context *ctx) {if (atomic_dec_and_test (&ctx->ref)) -wake_up (&ctx->wait); +complete (&ctx->comp); }static inline int ib_ucm_new_cm_id (int event)
@@ -178,7 +180,7 @@ static struct ib_ucm_context *ib_ucm_ctxreturn NULL ;atomic_set (&ctx->ref,1 ); -init_waitqueue_head (&ctx->wait); +init_completion (&ctx->comp); ctx->file = file;INIT_LIST_HEAD (&ctx->events);
@@ -586,8 +588,8 @@ static ssize_t ib_ucm_destroy_id(structif (IS_ERR (ctx))return PTR_ERR (ctx); -atomic_dec (&ctx->ref); -wait_event (ctx->wait, !atomic_read (&ctx->ref)); +ib_ucm_ctx_put (ctx); +wait_for_completion (&ctx->comp);/* No new events will be generated after destroying the cm_id. */ ib_destroy_cm_id (ctx->cm_id);
drivers/infiniband/hw/ipath/ipath_driver.c +3 -4
@@ -116,10 +116,9 @@ #define PCI_DEVICE_ID_INFINIPATH_HT 0xd#define PCI_DEVICE_ID_INFINIPATH_PE800 0x10static const struct pci_device_id ipath_pci_tbl[] = { - {PCI_DEVICE (PCI_VENDOR_ID_PATHSCALE , -PCI_DEVICE_ID_INFINIPATH_HT )}, - {PCI_DEVICE (PCI_VENDOR_ID_PATHSCALE , -PCI_DEVICE_ID_INFINIPATH_PE800 )}, + {PCI_DEVICE (PCI_VENDOR_ID_PATHSCALE ,PCI_DEVICE_ID_INFINIPATH_HT ) }, + {PCI_DEVICE (PCI_VENDOR_ID_PATHSCALE ,PCI_DEVICE_ID_INFINIPATH_PE800 ) }, + {0 , } };MODULE_DEVICE_TABLE (pci, ipath_pci_tbl);