IB/qib: Convert opcode counters to per-context
This fix changes the opcode relative counters for receive to per context. Profiling has shown that when mulitple contexts are being used there is a lot of cache activity associated with these counters. The code formerly kept these counters per port, but only provided the interface to read per HCA. This patch converts the read of counters to per HCA and adds the debugfs hooks to be able to read the file as a sequence of opcodes. Reviewed-by: Dean Luick <dean.luick@intel.com> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:

committed by
Roland Dreier

parent
85caafe307
commit
ddb8876589
@@ -46,6 +46,10 @@
|
||||
#include "qib.h"
|
||||
#include "qib_common.h"
|
||||
#include "qib_mad.h"
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
#include "qib_debugfs.h"
|
||||
#include "qib_verbs.h"
|
||||
#endif
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) QIB_DRV_NAME ": " fmt
|
||||
@@ -188,7 +192,18 @@ struct qib_ctxtdata *qib_create_ctxtdata(struct qib_pportdata *ppd, u32 ctxt,
|
||||
rcd->cnt = 1;
|
||||
rcd->ctxt = ctxt;
|
||||
dd->rcd[ctxt] = rcd;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
if (ctxt < dd->first_user_ctxt) { /* N/A for PSM contexts */
|
||||
rcd->opstats = kzalloc_node(sizeof(*rcd->opstats),
|
||||
GFP_KERNEL, node_id);
|
||||
if (!rcd->opstats) {
|
||||
kfree(rcd);
|
||||
qib_dev_err(dd,
|
||||
"Unable to allocate per ctxt stats buffer\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
dd->f_init_ctxt(rcd);
|
||||
|
||||
/*
|
||||
@@ -959,6 +974,10 @@ void qib_free_ctxtdata(struct qib_devdata *dd, struct qib_ctxtdata *rcd)
|
||||
vfree(rcd->subctxt_uregbase);
|
||||
vfree(rcd->subctxt_rcvegrbuf);
|
||||
vfree(rcd->subctxt_rcvhdr_base);
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
kfree(rcd->opstats);
|
||||
rcd->opstats = NULL;
|
||||
#endif
|
||||
kfree(rcd);
|
||||
}
|
||||
|
||||
@@ -1048,7 +1067,6 @@ done:
|
||||
dd->f_set_armlaunch(dd, 1);
|
||||
}
|
||||
|
||||
|
||||
void qib_free_devdata(struct qib_devdata *dd)
|
||||
{
|
||||
unsigned long flags;
|
||||
@@ -1058,6 +1076,9 @@ void qib_free_devdata(struct qib_devdata *dd)
|
||||
list_del(&dd->list);
|
||||
spin_unlock_irqrestore(&qib_devs_lock, flags);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
qib_dbg_ibdev_exit(&dd->verbs_dev);
|
||||
#endif
|
||||
ib_dealloc_device(&dd->verbs_dev.ibdev);
|
||||
}
|
||||
|
||||
@@ -1081,6 +1102,10 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
|
||||
goto bail;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
qib_dbg_ibdev_init(&dd->verbs_dev);
|
||||
#endif
|
||||
|
||||
idr_preload(GFP_KERNEL);
|
||||
spin_lock_irqsave(&qib_devs_lock, flags);
|
||||
|
||||
@@ -1096,6 +1121,9 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra)
|
||||
if (ret < 0) {
|
||||
qib_early_err(&pdev->dev,
|
||||
"Could not allocate unit ID: error %d\n", -ret);
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
qib_dbg_ibdev_exit(&dd->verbs_dev);
|
||||
#endif
|
||||
ib_dealloc_device(&dd->verbs_dev.ibdev);
|
||||
dd = ERR_PTR(ret);
|
||||
goto bail;
|
||||
@@ -1222,6 +1250,9 @@ static int __init qlogic_ib_init(void)
|
||||
|
||||
#ifdef CONFIG_INFINIBAND_QIB_DCA
|
||||
dca_register_notify(&dca_notifier);
|
||||
#endif
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
qib_dbg_init();
|
||||
#endif
|
||||
ret = pci_register_driver(&qib_driver);
|
||||
if (ret < 0) {
|
||||
@@ -1237,6 +1268,9 @@ static int __init qlogic_ib_init(void)
|
||||
bail_dev:
|
||||
#ifdef CONFIG_INFINIBAND_QIB_DCA
|
||||
dca_unregister_notify(&dca_notifier);
|
||||
#endif
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
qib_dbg_exit();
|
||||
#endif
|
||||
idr_destroy(&qib_unit_table);
|
||||
qib_dev_cleanup();
|
||||
@@ -1263,6 +1297,9 @@ static void __exit qlogic_ib_cleanup(void)
|
||||
dca_unregister_notify(&dca_notifier);
|
||||
#endif
|
||||
pci_unregister_driver(&qib_driver);
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
qib_dbg_exit();
|
||||
#endif
|
||||
|
||||
qib_cpulist_count = 0;
|
||||
kfree(qib_cpulist);
|
||||
|
Reference in New Issue
Block a user