> - Consider a user that does e.g. create QP, but never calls mmap.
>   Is there some code that will clean out the unclamed mmap object?
>   I couldn't find it, and iwch_dealloc_ucontext does not seem to
>   do anything with it.

BTW: Here is my fix for this.

-----

Clean up pending mmaps on ucontext deallocation.

From: Steve Wise <[EMAIL PROTECTED]>

Free all pending mmap structs when the ucontext is deallocated.

Signed-off-by: Steve Wise <[EMAIL PROTECTED]>
---

 drivers/infiniband/hw/cxgb3/iwch_provider.c |    1 +
 drivers/infiniband/hw/cxgb3/iwch_provider.h |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index db2b0a8..98568ee 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -99,6 +99,7 @@ static int iwch_dealloc_ucontext(struct 
        struct iwch_dev *rhp = to_iwch_dev(context->device);
        struct iwch_ucontext *ucontext = to_iwch_ucontext(context);
        PDBG("%s context %p\n", __FUNCTION__, context);
+       free_mmaps(ucontext);
        cxio_release_ucontext(&rhp->rdev, &ucontext->uctx);
        kfree(ucontext);
        return 0;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.h 
b/drivers/infiniband/hw/cxgb3/iwch_provider.h
index 1ede8a7..c8c07ee 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.h
@@ -199,6 +199,21 @@ struct iwch_mm_entry {
        unsigned len;
 };
 
+static inline void free_mmaps(struct iwch_ucontext *ucontext)
+{
+       struct list_head *pos, *nxt;
+       struct iwch_mm_entry *mm;
+
+       spin_lock(&ucontext->mmap_lock);
+       list_for_each_safe(pos, nxt, &ucontext->mmaps) {
+               mm = list_entry(pos, struct iwch_mm_entry, entry);
+               list_del(&mm->entry);
+               kfree(mm);
+       }
+       spin_unlock(&ucontext->mmap_lock);
+       return;
+}
+
 static inline struct iwch_mm_entry *remove_mmap(struct iwch_ucontext *ucontext,
                                                u64 addr, unsigned len)
 {



_______________________________________________
openib-general mailing list
openib-general@openib.org
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to