Skip to content

Commit

Permalink
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/roland/infiniband

* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband:
  IPoIB/cm: Optimize stale connection detection
  IB/mthca: Set cleaned CQEs back to HW ownership when cleaning CQ
  IB/mthca: Fix posting >255 recv WRs for Tavor
  RDMA/cma: Add check to validate that cm_id is bound to a device
  RDMA/cma: Fix synchronization with device removal in cma_iw_handler
  RDMA/cma: Simplify device removal handling code
  IB/ehca: Disable scaling code by default, bump version number
  IB/ehca: Beautify sysfs attribute code and fix compiler warnings
  IB/ehca: Remove _irqsave, move #ifdef
  IB/ehca: Fix AQP0/1 QP number
  IB/ehca: Correctly set GRH mask bit in ehca_modify_qp()
  IB/ehca: Serialize hypervisor calls in ehca_register_mr()
  IB/ipath: Shadow the gpio_mask register
  IB/mlx4: Fix uninitialized spinlock for 32-bit archs
  mlx4_core: Remove unused doorbell_lock
  net: Trivial MLX4_DEBUG dependency fix.
  • Loading branch information
Linus Torvalds committed May 15, 2007
2 parents cfbf07f + 7c5b9ef commit de7860c
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 133 deletions.
106 changes: 59 additions & 47 deletions drivers/infiniband/core/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,33 @@ static void cma_deref_id(struct rdma_id_private *id_priv)
complete(&id_priv->comp);
}

static void cma_release_remove(struct rdma_id_private *id_priv)
static int cma_disable_remove(struct rdma_id_private *id_priv,
enum cma_state state)
{
unsigned long flags;
int ret;

spin_lock_irqsave(&id_priv->lock, flags);
if (id_priv->state == state) {
atomic_inc(&id_priv->dev_remove);
ret = 0;
} else
ret = -EINVAL;
spin_unlock_irqrestore(&id_priv->lock, flags);
return ret;
}

static void cma_enable_remove(struct rdma_id_private *id_priv)
{
if (atomic_dec_and_test(&id_priv->dev_remove))
wake_up(&id_priv->wait_remove);
}

static int cma_has_cm_dev(struct rdma_id_private *id_priv)
{
return (id_priv->id.device && id_priv->cm_id.ib);
}

struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,
void *context, enum rdma_port_space ps)
{
Expand Down Expand Up @@ -884,9 +905,8 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
struct rdma_cm_event event;
int ret = 0;

atomic_inc(&id_priv->dev_remove);
if (!cma_comp(id_priv, CMA_CONNECT))
goto out;
if (cma_disable_remove(id_priv, CMA_CONNECT))
return 0;

memset(&event, 0, sizeof event);
switch (ib_event->event) {
Expand Down Expand Up @@ -942,12 +962,12 @@ static int cma_ib_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
/* Destroy the CM ID by returning a non-zero value. */
id_priv->cm_id.ib = NULL;
cma_exch(id_priv, CMA_DESTROYING);
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
rdma_destroy_id(&id_priv->id);
return ret;
}
out:
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
return ret;
}

Expand Down Expand Up @@ -1057,11 +1077,8 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
int offset, ret;

listen_id = cm_id->context;
atomic_inc(&listen_id->dev_remove);
if (!cma_comp(listen_id, CMA_LISTEN)) {
ret = -ECONNABORTED;
goto out;
}
if (cma_disable_remove(listen_id, CMA_LISTEN))
return -ECONNABORTED;

memset(&event, 0, sizeof event);
offset = cma_user_data_offset(listen_id->id.ps);
Expand Down Expand Up @@ -1101,11 +1118,11 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)

release_conn_id:
cma_exch(conn_id, CMA_DESTROYING);
cma_release_remove(conn_id);
cma_enable_remove(conn_id);
rdma_destroy_id(&conn_id->id);

out:
cma_release_remove(listen_id);
cma_enable_remove(listen_id);
return ret;
}

Expand Down Expand Up @@ -1171,9 +1188,10 @@ static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event)
struct sockaddr_in *sin;
int ret = 0;

memset(&event, 0, sizeof event);
atomic_inc(&id_priv->dev_remove);
if (cma_disable_remove(id_priv, CMA_CONNECT))
return 0;

memset(&event, 0, sizeof event);
switch (iw_event->event) {
case IW_CM_EVENT_CLOSE:
event.event = RDMA_CM_EVENT_DISCONNECTED;
Expand Down Expand Up @@ -1214,12 +1232,12 @@ static int cma_iw_handler(struct iw_cm_id *iw_id, struct iw_cm_event *iw_event)
/* Destroy the CM ID by returning a non-zero value. */
id_priv->cm_id.iw = NULL;
cma_exch(id_priv, CMA_DESTROYING);
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
rdma_destroy_id(&id_priv->id);
return ret;
}

cma_release_remove(id_priv);
cma_enable_remove(id_priv);
return ret;
}

Expand All @@ -1234,11 +1252,8 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
int ret;

listen_id = cm_id->context;
atomic_inc(&listen_id->dev_remove);
if (!cma_comp(listen_id, CMA_LISTEN)) {
ret = -ECONNABORTED;
goto out;
}
if (cma_disable_remove(listen_id, CMA_LISTEN))
return -ECONNABORTED;

/* Create a new RDMA id for the new IW CM ID */
new_cm_id = rdma_create_id(listen_id->id.event_handler,
Expand All @@ -1255,13 +1270,13 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
dev = ip_dev_find(iw_event->local_addr.sin_addr.s_addr);
if (!dev) {
ret = -EADDRNOTAVAIL;
cma_release_remove(conn_id);
cma_enable_remove(conn_id);
rdma_destroy_id(new_cm_id);
goto out;
}
ret = rdma_copy_addr(&conn_id->id.route.addr.dev_addr, dev, NULL);
if (ret) {
cma_release_remove(conn_id);
cma_enable_remove(conn_id);
rdma_destroy_id(new_cm_id);
goto out;
}
Expand All @@ -1270,7 +1285,7 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
ret = cma_acquire_dev(conn_id);
mutex_unlock(&lock);
if (ret) {
cma_release_remove(conn_id);
cma_enable_remove(conn_id);
rdma_destroy_id(new_cm_id);
goto out;
}
Expand All @@ -1293,14 +1308,14 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
/* User wants to destroy the CM ID */
conn_id->cm_id.iw = NULL;
cma_exch(conn_id, CMA_DESTROYING);
cma_release_remove(conn_id);
cma_enable_remove(conn_id);
rdma_destroy_id(&conn_id->id);
}

out:
if (dev)
dev_put(dev);
cma_release_remove(listen_id);
cma_enable_remove(listen_id);
return ret;
}

Expand Down Expand Up @@ -1519,7 +1534,7 @@ static void cma_work_handler(struct work_struct *_work)
destroy = 1;
}
out:
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
cma_deref_id(id_priv);
if (destroy)
rdma_destroy_id(&id_priv->id);
Expand Down Expand Up @@ -1711,13 +1726,13 @@ static void addr_handler(int status, struct sockaddr *src_addr,

if (id_priv->id.event_handler(&id_priv->id, &event)) {
cma_exch(id_priv, CMA_DESTROYING);
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
cma_deref_id(id_priv);
rdma_destroy_id(&id_priv->id);
return;
}
out:
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
cma_deref_id(id_priv);
}

Expand Down Expand Up @@ -2042,11 +2057,10 @@ static int cma_sidr_rep_handler(struct ib_cm_id *cm_id,
struct ib_cm_sidr_rep_event_param *rep = &ib_event->param.sidr_rep_rcvd;
int ret = 0;

memset(&event, 0, sizeof event);
atomic_inc(&id_priv->dev_remove);
if (!cma_comp(id_priv, CMA_CONNECT))
goto out;
if (cma_disable_remove(id_priv, CMA_CONNECT))
return 0;

memset(&event, 0, sizeof event);
switch (ib_event->event) {
case IB_CM_SIDR_REQ_ERROR:
event.event = RDMA_CM_EVENT_UNREACHABLE;
Expand Down Expand Up @@ -2084,12 +2098,12 @@ static int cma_sidr_rep_handler(struct ib_cm_id *cm_id,
/* Destroy the CM ID by returning a non-zero value. */
id_priv->cm_id.ib = NULL;
cma_exch(id_priv, CMA_DESTROYING);
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
rdma_destroy_id(&id_priv->id);
return ret;
}
out:
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
return ret;
}

Expand Down Expand Up @@ -2413,7 +2427,7 @@ int rdma_notify(struct rdma_cm_id *id, enum ib_event_type event)
int ret;

id_priv = container_of(id, struct rdma_id_private, id);
if (!cma_comp(id_priv, CMA_CONNECT))
if (!cma_has_cm_dev(id_priv))
return -EINVAL;

switch (id->device->node_type) {
Expand All @@ -2435,7 +2449,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
int ret;

id_priv = container_of(id, struct rdma_id_private, id);
if (!cma_comp(id_priv, CMA_CONNECT))
if (!cma_has_cm_dev(id_priv))
return -EINVAL;

switch (rdma_node_get_transport(id->device->node_type)) {
Expand Down Expand Up @@ -2466,8 +2480,7 @@ int rdma_disconnect(struct rdma_cm_id *id)
int ret;

id_priv = container_of(id, struct rdma_id_private, id);
if (!cma_comp(id_priv, CMA_CONNECT) &&
!cma_comp(id_priv, CMA_DISCONNECT))
if (!cma_has_cm_dev(id_priv))
return -EINVAL;

switch (rdma_node_get_transport(id->device->node_type)) {
Expand Down Expand Up @@ -2499,10 +2512,9 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast)
int ret;

id_priv = mc->id_priv;
atomic_inc(&id_priv->dev_remove);
if (!cma_comp(id_priv, CMA_ADDR_BOUND) &&
!cma_comp(id_priv, CMA_ADDR_RESOLVED))
goto out;
if (cma_disable_remove(id_priv, CMA_ADDR_BOUND) &&
cma_disable_remove(id_priv, CMA_ADDR_RESOLVED))
return 0;

if (!status && id_priv->id.qp)
status = ib_attach_mcast(id_priv->id.qp, &multicast->rec.mgid,
Expand All @@ -2524,12 +2536,12 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast)
ret = id_priv->id.event_handler(&id_priv->id, &event);
if (ret) {
cma_exch(id_priv, CMA_DESTROYING);
cma_release_remove(id_priv);
cma_enable_remove(id_priv);
rdma_destroy_id(&id_priv->id);
return 0;
}
out:
cma_release_remove(id_priv);

cma_enable_remove(id_priv);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/hw/ehca/ehca_classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ void ehca_cleanup_mrmw_cache(void);

extern spinlock_t ehca_qp_idr_lock;
extern spinlock_t ehca_cq_idr_lock;
extern spinlock_t hcall_lock;
extern struct idr ehca_qp_idr;
extern struct idr ehca_cq_idr;

Expand Down
7 changes: 3 additions & 4 deletions drivers/infiniband/hw/ehca/ehca_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,11 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
else {
struct ehca_cq *cq = eq->eqe_cache[i].cq;
comp_event_callback(cq);
spin_lock_irqsave(&ehca_cq_idr_lock, flags);
spin_lock(&ehca_cq_idr_lock);
cq->nr_events--;
if (!cq->nr_events)
wake_up(&cq->wait_completion);
spin_unlock_irqrestore(&ehca_cq_idr_lock,
flags);
spin_unlock(&ehca_cq_idr_lock);
}
} else {
ehca_dbg(&shca->ib_device, "Got non completion event");
Expand Down Expand Up @@ -711,6 +710,7 @@ static void destroy_comp_task(struct ehca_comp_pool *pool,
kthread_stop(task);
}

#ifdef CONFIG_HOTPLUG_CPU
static void take_over_work(struct ehca_comp_pool *pool,
int cpu)
{
Expand All @@ -735,7 +735,6 @@ static void take_over_work(struct ehca_comp_pool *pool,

}

#ifdef CONFIG_HOTPLUG_CPU
static int comp_pool_callback(struct notifier_block *nfb,
unsigned long action,
void *hcpu)
Expand Down
Loading

0 comments on commit de7860c

Please sign in to comment.