aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2012-04-30 13:27:26 -0400
committerRoland Dreier <roland@purestorage.com>2012-05-08 14:17:34 -0400
commit3bea57a5fc1762a72fb9ac88b9aa9e48dcbea8bc (patch)
tree8defc3f9068d817f9ed0f0184304695b25f12dbc /drivers/infiniband
parentd48b97b403d23f6df0b990cee652bdf9a52337a3 (diff)
IB/uverbs: Make lockdep output more readable
Add names for our lockdep classes, so instead of having to decipher lockdep output with mysterious names: Chain exists of: key#14 --> key#11 --> key#13 lockdep will give us something nicer: Chain exists of: SRQ-uobj --> PD-uobj --> CQ-uobj Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 4d27e4c3fe34..85231e2bdeef 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -41,13 +41,18 @@
41 41
42#include "uverbs.h" 42#include "uverbs.h"
43 43
44static struct lock_class_key pd_lock_key; 44struct uverbs_lock_class {
45static struct lock_class_key mr_lock_key; 45 struct lock_class_key key;
46static struct lock_class_key cq_lock_key; 46 char name[16];
47static struct lock_class_key qp_lock_key; 47};
48static struct lock_class_key ah_lock_key; 48
49static struct lock_class_key srq_lock_key; 49static struct uverbs_lock_class pd_lock_class = { .name = "PD-uobj" };
50static struct lock_class_key xrcd_lock_key; 50static struct uverbs_lock_class mr_lock_class = { .name = "MR-uobj" };
51static struct uverbs_lock_class cq_lock_class = { .name = "CQ-uobj" };
52static struct uverbs_lock_class qp_lock_class = { .name = "QP-uobj" };
53static struct uverbs_lock_class ah_lock_class = { .name = "AH-uobj" };
54static struct uverbs_lock_class srq_lock_class = { .name = "SRQ-uobj" };
55static struct uverbs_lock_class xrcd_lock_class = { .name = "XRCD-uobj" };
51 56
52#define INIT_UDATA(udata, ibuf, obuf, ilen, olen) \ 57#define INIT_UDATA(udata, ibuf, obuf, ilen, olen) \
53 do { \ 58 do { \
@@ -83,13 +88,13 @@ static struct lock_class_key xrcd_lock_key;
83 */ 88 */
84 89
85static void init_uobj(struct ib_uobject *uobj, u64 user_handle, 90static void init_uobj(struct ib_uobject *uobj, u64 user_handle,
86 struct ib_ucontext *context, struct lock_class_key *key) 91 struct ib_ucontext *context, struct uverbs_lock_class *c)
87{ 92{
88 uobj->user_handle = user_handle; 93 uobj->user_handle = user_handle;
89 uobj->context = context; 94 uobj->context = context;
90 kref_init(&uobj->ref); 95 kref_init(&uobj->ref);
91 init_rwsem(&uobj->mutex); 96 init_rwsem(&uobj->mutex);
92 lockdep_set_class(&uobj->mutex, key); 97 lockdep_set_class_and_name(&uobj->mutex, &c->key, c->name);
93 uobj->live = 0; 98 uobj->live = 0;
94} 99}
95 100
@@ -522,7 +527,7 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file,
522 if (!uobj) 527 if (!uobj)
523 return -ENOMEM; 528 return -ENOMEM;
524 529
525 init_uobj(uobj, 0, file->ucontext, &pd_lock_key); 530 init_uobj(uobj, 0, file->ucontext, &pd_lock_class);
526 down_write(&uobj->mutex); 531 down_write(&uobj->mutex);
527 532
528 pd = file->device->ib_dev->alloc_pd(file->device->ib_dev, 533 pd = file->device->ib_dev->alloc_pd(file->device->ib_dev,
@@ -750,7 +755,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *file,
750 goto err_tree_mutex_unlock; 755 goto err_tree_mutex_unlock;
751 } 756 }
752 757
753 init_uobj(&obj->uobject, 0, file->ucontext, &xrcd_lock_key); 758 init_uobj(&obj->uobject, 0, file->ucontext, &xrcd_lock_class);
754 759
755 down_write(&obj->uobject.mutex); 760 down_write(&obj->uobject.mutex);
756 761
@@ -947,7 +952,7 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
947 if (!uobj) 952 if (!uobj)
948 return -ENOMEM; 953 return -ENOMEM;
949 954
950 init_uobj(uobj, 0, file->ucontext, &mr_lock_key); 955 init_uobj(uobj, 0, file->ucontext, &mr_lock_class);
951 down_write(&uobj->mutex); 956 down_write(&uobj->mutex);
952 957
953 pd = idr_read_pd(cmd.pd_handle, file->ucontext); 958 pd = idr_read_pd(cmd.pd_handle, file->ucontext);
@@ -1115,7 +1120,7 @@ ssize_t ib_uverbs_create_cq(struct ib_uverbs_file *file,
1115 if (!obj) 1120 if (!obj)
1116 return -ENOMEM; 1121 return -ENOMEM;
1117 1122
1118 init_uobj(&obj->uobject, cmd.user_handle, file->ucontext, &cq_lock_key); 1123 init_uobj(&obj->uobject, cmd.user_handle, file->ucontext, &cq_lock_class);
1119 down_write(&obj->uobject.mutex); 1124 down_write(&obj->uobject.mutex);
1120 1125
1121 if (cmd.comp_channel >= 0) { 1126 if (cmd.comp_channel >= 0) {
@@ -1407,7 +1412,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
1407 if (!obj) 1412 if (!obj)
1408 return -ENOMEM; 1413 return -ENOMEM;
1409 1414
1410 init_uobj(&obj->uevent.uobject, cmd.user_handle, file->ucontext, &qp_lock_key); 1415 init_uobj(&obj->uevent.uobject, cmd.user_handle, file->ucontext, &qp_lock_class);
1411 down_write(&obj->uevent.uobject.mutex); 1416 down_write(&obj->uevent.uobject.mutex);
1412 1417
1413 if (cmd.qp_type == IB_QPT_XRC_TGT) { 1418 if (cmd.qp_type == IB_QPT_XRC_TGT) {
@@ -1585,7 +1590,7 @@ ssize_t ib_uverbs_open_qp(struct ib_uverbs_file *file,
1585 if (!obj) 1590 if (!obj)
1586 return -ENOMEM; 1591 return -ENOMEM;
1587 1592
1588 init_uobj(&obj->uevent.uobject, cmd.user_handle, file->ucontext, &qp_lock_key); 1593 init_uobj(&obj->uevent.uobject, cmd.user_handle, file->ucontext, &qp_lock_class);
1589 down_write(&obj->uevent.uobject.mutex); 1594 down_write(&obj->uevent.uobject.mutex);
1590 1595
1591 xrcd = idr_read_xrcd(cmd.pd_handle, file->ucontext, &xrcd_uobj); 1596 xrcd = idr_read_xrcd(cmd.pd_handle, file->ucontext, &xrcd_uobj);
@@ -2272,7 +2277,7 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
2272 if (!uobj) 2277 if (!uobj)
2273 return -ENOMEM; 2278 return -ENOMEM;
2274 2279
2275 init_uobj(uobj, cmd.user_handle, file->ucontext, &ah_lock_key); 2280 init_uobj(uobj, cmd.user_handle, file->ucontext, &ah_lock_class);
2276 down_write(&uobj->mutex); 2281 down_write(&uobj->mutex);
2277 2282
2278 pd = idr_read_pd(cmd.pd_handle, file->ucontext); 2283 pd = idr_read_pd(cmd.pd_handle, file->ucontext);
@@ -2476,7 +2481,7 @@ static int __uverbs_create_xsrq(struct ib_uverbs_file *file,
2476 if (!obj) 2481 if (!obj)
2477 return -ENOMEM; 2482 return -ENOMEM;
2478 2483
2479 init_uobj(&obj->uevent.uobject, cmd->user_handle, file->ucontext, &srq_lock_key); 2484 init_uobj(&obj->uevent.uobject, cmd->user_handle, file->ucontext, &srq_lock_class);
2480 down_write(&obj->uevent.uobject.mutex); 2485 down_write(&obj->uevent.uobject.mutex);
2481 2486
2482 pd = idr_read_pd(cmd->pd_handle, file->ucontext); 2487 pd = idr_read_pd(cmd->pd_handle, file->ucontext);