cxgb3/iw_cxgb3: doorbell overflow avoidance and recovery.
Subsystems (3)
PATCH 1/1 cxgb3/iw_cxgb3: doorbell overflow avoidance and recovery.
T3 hardware doorbell fifo overflows can cause application stalls due to lost doorbell ring events. This has been seen when running large NP IMB alltoall MPI jobs. The T3 hardware supports an xon/xoff type control mechanism to help avoid overflowing the hw db fifo.
This patch utilizes these interrupts to disable rdma qp db rings when we near an overflow condition, and then turn them back on (and ring all the active qp dbs) when when the db fifo emptys out. In addition if an db ring is dropped by the hardware, the code will now recover.
Design:
cxgb3:
- enable these DB interrupts
- in the intr handler, schedule work tasks to call the ULPs event handlers with the new events.
- ring all the qset txqs when an overflow is detected.
iw_cxgb3:
- disable db ringing on all active qps when we get the DB_FULL event
- enable db ringing on all active qps and ring all active dbs when we get the DB_EMPTY event
- On DB_DROP event:
- disable db rings in the event handler
- delay-schedule a work task which rings and enables the dbs on all active qps.
- in post_send and post_recv logic, don't ring the db if its disabled.
---
drivers/infiniband/hw/cxgb3/cxio_wr.h | 17 +++++++ drivers/infiniband/hw/cxgb3/iwch.c | 79 +++++++++++++++++++++++++++++++-- drivers/infiniband/hw/cxgb3/iwch.h | 2 + drivers/infiniband/hw/cxgb3/iwch_qp.c | 9 +++- drivers/net/cxgb3/adapter.h | 5 ++ drivers/net/cxgb3/cxgb3_main.c | 57 +++++++++++++++++++++++- drivers/net/cxgb3/cxgb3_offload.h | 5 ++ drivers/net/cxgb3/regs.h | 16 +++++++ drivers/net/cxgb3/sge.c | 15 +++++- drivers/net/cxgb3/t3_hw.c | 5 ++ 10 files changed, 196 insertions(+), 14 deletions(-)
drivers/infiniband/hw/cxgb3/cxio_wr.h +16 -1
@@ -730,7 +730,22 @@ struct t3_cq {static inline void cxio_set_wq_in_error (struct t3_wq *wq) { - wq->queue->wq_in_err.err =1 ; + wq->queue->wq_in_err.err |=1 ; +} + +static inline void cxio_disable_wq_db (struct t3_wq *wq) +{ + wq->queue->wq_in_err.err |=2 ; +} + +static inline void cxio_enable_wq_db (struct t3_wq *wq) +{ + wq->queue->wq_in_err.err &= ~2 ; +} + +static inline int cxio_wq_db_enabled (struct t3_wq *wq) +{ +return !(wq->queue->wq_in_err.err &2 ); }static inline struct t3_cqe *cxio_next_hw_cqe (struct t3_cq *cq)
drivers/infiniband/hw/cxgb3/iwch.c +75 -4
121 lines not on this page · raw message
drivers/infiniband/hw/cxgb3/iwch.h +2 -0
@@ -36,6 +36,7 @@#include <linux/list.h> #include <linux/spinlock.h> #include <linux/idr.h> +#include <linux/workqueue.h> #include <rdma/ib_verbs.h>
@@ -110,6 +111,7 @@ struct iwch_dev {struct idr mmidr;spinlock_t lock;struct list_head entry; +struct delayed_work db_drop_task; };static inline struct iwch_dev *to_iwch_dev (struct ib_device *ibdev)
drivers/infiniband/hw/cxgb3/iwch_qp.c +6 -3
@@ -452,7 +452,8 @@ int iwch_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, ++(qhp->wq.sq_wptr); }spin_unlock_irqrestore (&qhp->lock, flag); -ring_doorbell (qhp->wq.doorbell, qhp->wq.qpid); +if (cxio_wq_db_enabled (&qhp->wq)) +ring_doorbell (qhp->wq.doorbell, qhp->wq.qpid); out:if (err)
@@ -514,7 +515,8 @@ int iwch_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, num_wrs--; }spin_unlock_irqrestore (&qhp->lock, flag); -ring_doorbell (qhp->wq.doorbell, qhp->wq.qpid); +if (cxio_wq_db_enabled (&qhp->wq)) +ring_doorbell (qhp->wq.doorbell, qhp->wq.qpid); out:if (err)
@@ -597,7 +599,8 @@ int iwch_bind_mw(struct ib_qp *qp, ++(qhp->wq.sq_wptr);spin_unlock_irqrestore (&qhp->lock, flag); -ring_doorbell (qhp->wq.doorbell, qhp->wq.qpid); +if (cxio_wq_db_enabled (&qhp->wq)) +ring_doorbell (qhp->wq.doorbell, qhp->wq.qpid);return err; }
drivers/net/cxgb3/adapter.h +5 -0
@@ -263,6 +263,10 @@ struct adapter {struct work_struct ext_intr_handler_task;struct work_struct fatal_error_handler_task;struct work_struct link_fault_handler_task; + +struct work_struct db_full_task; +struct work_struct db_empty_task; +struct work_struct db_drop_task;struct dentry *debugfs_root;
@@ -335,6 +339,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,int t3_get_desc (const struct sge_qset *qs,unsigned int qnum,unsigned int idx,unsigned char *data);irqreturn_t t3_sge_intr_msix (int irq,void *cookie); +extern struct workqueue_struct *cxgb3_wq;int t3_get_edc_fw (struct cphy *phy,int edc_idx,int size);
drivers/net/cxgb3/cxgb3_main.c +56 -1
87 lines not on this page · raw message
drivers/net/cxgb3/cxgb3_offload.h +4 -1
@@ -73,7 +73,10 @@ enum {OFFLOAD_STATUS_UP ,OFFLOAD_STATUS_DOWN ,OFFLOAD_PORT_DOWN , -OFFLOAD_PORT_UP +OFFLOAD_PORT_UP , +OFFLOAD_DB_FULL , +OFFLOAD_DB_EMPTY , +OFFLOAD_DB_DROP }; struct cxgb3_client {
drivers/net/cxgb3/regs.h +16 -0
@@ -254,6 +254,22 @@#define V_LOPIODRBDROPERR (x) ((x) << S_LOPIODRBDROPERR)#define F_LOPIODRBDROPERR V_LOPIODRBDROPERR(1U) +#define S_HIPRIORITYDBFULL 7 +#define V_HIPRIORITYDBFULL (x) ((x) << S_HIPRIORITYDBFULL) +#define F_HIPRIORITYDBFULL V_HIPRIORITYDBFULL(1U) + +#define S_HIPRIORITYDBEMPTY 6 +#define V_HIPRIORITYDBEMPTY (x) ((x) << S_HIPRIORITYDBEMPTY) +#define F_HIPRIORITYDBEMPTY V_HIPRIORITYDBEMPTY(1U) + +#define S_LOPRIORITYDBFULL 5 +#define V_LOPRIORITYDBFULL (x) ((x) << S_LOPRIORITYDBFULL) +#define F_LOPRIORITYDBFULL V_LOPRIORITYDBFULL(1U) + +#define S_LOPRIORITYDBEMPTY 4 +#define V_LOPRIORITYDBEMPTY (x) ((x) << S_LOPRIORITYDBEMPTY) +#define F_LOPRIORITYDBEMPTY V_LOPRIORITYDBEMPTY(1U) +#define S_RSPQDISABLED 3#define V_RSPQDISABLED (x) ((x) << S_RSPQDISABLED)#define F_RSPQDISABLED V_RSPQDISABLED(1U)
drivers/net/cxgb3/sge.c +12 -3
@@ -42,6 +42,7 @@#include "sge_defs.h" #include "t3_cpl.h" #include "firmware_exports.h" +#include "cxgb3_offload.h" #define USE_GTS 0
@@ -2828,9 +2829,17 @@ void t3_sge_err_intr_handler(struct adapter *adapter) "(0x%x)\n", (v >> S_RSPQ0DISABLED) & 0xff); } -if (status & (F_HIPIODRBDROPERR |F_LOPIODRBDROPERR )) -CH_ALERT (adapter,"SGE dropped %s priority doorbell\n" , - status &F_HIPIODRBDROPERR ?"high" :"lo" ); +if (status & (F_HIPIODRBDROPERR |F_LOPIODRBDROPERR )) { +queue_work (cxgb3_wq, &adapter->db_drop_task); + } + +if (status & (F_HIPRIORITYDBFULL |F_LOPRIORITYDBFULL )) { +queue_work (cxgb3_wq, &adapter->db_full_task); + } + +if (status & (F_HIPRIORITYDBEMPTY |F_LOPRIORITYDBEMPTY )) { +queue_work (cxgb3_wq, &adapter->db_empty_task); + }t3_write_reg (adapter,A_SG_INT_CAUSE , status);if (status &SGE_FATALERR )
drivers/net/cxgb3/t3_hw.c +4 -1
@@ -1432,7 +1432,10 @@ static int t3_handle_intr_status(struct adapter *adapter, unsigned int reg, F_IRPARITYERROR | V_ITPARITYERROR(M_ITPARITYERROR) | \ V_FLPARITYERROR(M_FLPARITYERROR) | F_LODRBPARITYERROR | \ F_HIDRBPARITYERROR | F_LORCQPARITYERROR | \ - F_HIRCQPARITYERROR) + F_HIRCQPARITYERROR | F_LOPRIORITYDBFULL | \ + F_HIPRIORITYDBFULL | F_LOPRIORITYDBEMPTY | \ + F_HIPRIORITYDBEMPTY | F_HIPIODRBDROPERR | \ + F_LOPIODRBDROPERR)#define MC5_INTR_MASK (F_PARITYERR | F_ACTRGNFULL | F_UNKNOWNCMD | \ F_REQQPARERR | F_DISPQPARERR | F_DELACTEMPTY | \ F_NFASRCHFAIL)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Looks reasonable at first reading. I can take this through my tree, assuming it's OK with you, Divy?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Roland Dreier
Looks reasonable at first reading. I can take this through my tree, assuming it's OK with you, Divy?
Hi Roland,
it is okay with me.
Cheers,
Divy
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html