From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Mitko Haralanov
<mitko.haralanov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Dean Luick <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 06/16] IB/hfi1: Notify remove MMU/RB callback of calling context
Date: Tue, 08 Mar 2016 11:14:48 -0800 [thread overview]
Message-ID: <20160308191447.30542.76805.stgit@scvm10.sc.intel.com> (raw)
In-Reply-To: <20160308191210.30542.91885.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
From: Mitko Haralanov <mitko.haralanov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Tell the remove MMU/RB callback if it's being called as
part of a memory invalidation or not. This can be important
in preventing a deadlock if the remove callback attempts to
take the map_sem semaphore because the kernel's MMU
invalidation functions have already taken it.
Reviewed-by: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Dean Luick <dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Mitko Haralanov <mitko.haralanov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Jubin John <jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/infiniband/hw/hfi1/mmu_rb.c | 10 +++++-----
drivers/infiniband/hw/hfi1/mmu_rb.h | 2 +-
drivers/infiniband/hw/hfi1/user_exp_rcv.c | 9 +++++----
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/hw/hfi1/mmu_rb.c b/drivers/infiniband/hw/hfi1/mmu_rb.c
index a3515d7..29d6d3e 100644
--- a/drivers/infiniband/hw/hfi1/mmu_rb.c
+++ b/drivers/infiniband/hw/hfi1/mmu_rb.c
@@ -122,7 +122,7 @@ void hfi1_mmu_rb_unregister(struct rb_root *root)
rbnode = rb_entry(node, struct mmu_rb_node, node);
rb_erase(node, root);
if (handler->ops->remove)
- handler->ops->remove(root, rbnode);
+ handler->ops->remove(root, rbnode, false);
}
}
@@ -196,12 +196,12 @@ static struct mmu_rb_node *__mmu_rb_search(struct mmu_rb_handler *handler,
}
static void __mmu_rb_remove(struct mmu_rb_handler *handler,
- struct mmu_rb_node *node)
+ struct mmu_rb_node *node, bool arg)
{
/* Validity of handler and node pointers has been checked by caller. */
rb_erase(&node->node, handler->root);
if (handler->ops->remove)
- handler->ops->remove(handler->root, node);
+ handler->ops->remove(handler->root, node, arg);
}
struct mmu_rb_node *hfi1_mmu_rb_search(struct rb_root *root, unsigned long addr,
@@ -230,7 +230,7 @@ void hfi1_mmu_rb_remove(struct rb_root *root, struct mmu_rb_node *node)
return;
spin_lock_irqsave(&handler->lock, flags);
- __mmu_rb_remove(handler, node);
+ __mmu_rb_remove(handler, node, false);
spin_unlock_irqrestore(&handler->lock, flags);
}
@@ -299,7 +299,7 @@ static void mmu_notifier_mem_invalidate(struct mmu_notifier *mn,
naddr = node->addr;
nlen = node->len;
if (handler->ops->invalidate(root, node))
- __mmu_rb_remove(handler, node);
+ __mmu_rb_remove(handler, node, true);
/*
* The next address to be looked up is computed based
diff --git a/drivers/infiniband/hw/hfi1/mmu_rb.h b/drivers/infiniband/hw/hfi1/mmu_rb.h
index 9fe1076..fdd9787 100644
--- a/drivers/infiniband/hw/hfi1/mmu_rb.h
+++ b/drivers/infiniband/hw/hfi1/mmu_rb.h
@@ -59,7 +59,7 @@ struct mmu_rb_ops {
int (*compare)(struct mmu_rb_node *, unsigned long,
unsigned long);
int (*insert)(struct rb_root *, struct mmu_rb_node *);
- void (*remove)(struct rb_root *, struct mmu_rb_node *);
+ void (*remove)(struct rb_root *, struct mmu_rb_node *, bool);
int (*invalidate)(struct rb_root *, struct mmu_rb_node *);
};
diff --git a/drivers/infiniband/hw/hfi1/user_exp_rcv.c b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
index b0b193f..1d971c0 100644
--- a/drivers/infiniband/hw/hfi1/user_exp_rcv.c
+++ b/drivers/infiniband/hw/hfi1/user_exp_rcv.c
@@ -89,7 +89,7 @@ static int set_rcvarray_entry(struct file *, unsigned long, u32,
static inline int mmu_addr_cmp(struct mmu_rb_node *, unsigned long,
unsigned long);
static int mmu_rb_insert(struct rb_root *, struct mmu_rb_node *);
-static void mmu_rb_remove(struct rb_root *, struct mmu_rb_node *);
+static void mmu_rb_remove(struct rb_root *, struct mmu_rb_node *, bool);
static int mmu_rb_invalidate(struct rb_root *, struct mmu_rb_node *);
static int program_rcvarray(struct file *, unsigned long, struct tid_group *,
struct tid_pageset *, unsigned, u16, struct page **,
@@ -897,7 +897,7 @@ static int unprogram_rcvarray(struct file *fp, u32 tidinfo,
if (!node || node->rcventry != (uctxt->expected_base + rcventry))
return -EBADF;
if (HFI1_CAP_IS_USET(TID_UNMAP))
- mmu_rb_remove(&fd->tid_rb_root, &node->mmu);
+ mmu_rb_remove(&fd->tid_rb_root, &node->mmu, false);
else
hfi1_mmu_rb_remove(&fd->tid_rb_root, &node->mmu);
@@ -962,7 +962,7 @@ static void unlock_exp_tids(struct hfi1_ctxtdata *uctxt,
continue;
if (HFI1_CAP_IS_USET(TID_UNMAP))
mmu_rb_remove(&fd->tid_rb_root,
- &node->mmu);
+ &node->mmu, false);
else
hfi1_mmu_rb_remove(&fd->tid_rb_root,
&node->mmu);
@@ -1039,7 +1039,8 @@ static int mmu_rb_insert(struct rb_root *root, struct mmu_rb_node *node)
return 0;
}
-static void mmu_rb_remove(struct rb_root *root, struct mmu_rb_node *node)
+static void mmu_rb_remove(struct rb_root *root, struct mmu_rb_node *node,
+ bool notifier)
{
struct hfi1_filedata *fdata =
container_of(root, struct hfi1_filedata, tid_rb_root);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-03-08 19:14 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 19:14 [PATCH 00/16] IB/hfi1: Add a page pinning cache for PSM sdma Dennis Dalessandro
[not found] ` <20160308191210.30542.91885.stgit-9QXIwq+3FY+1XWohqUldA0EOCMrvLtNR@public.gmane.org>
2016-03-08 19:14 ` [PATCH 01/16] IB/hfi1: Re-factor MMU notification code Dennis Dalessandro
2016-03-08 19:14 ` [PATCH 02/16] IB/hfi1: Allow MMU function execution in IRQ context Dennis Dalessandro
2016-03-08 19:14 ` [PATCH 03/16] IB/hfi1: Prevent NULL pointer dereference Dennis Dalessandro
2016-03-08 19:14 ` [PATCH 04/16] IB/hfi1: Allow remove MMU callbacks to free nodes Dennis Dalessandro
2016-03-08 19:14 ` [PATCH 05/16] IB/hfi1: Remove the use of add/remove RB function pointers Dennis Dalessandro
2016-03-08 19:14 ` Dennis Dalessandro [this message]
2016-03-08 19:14 ` [PATCH 07/16] IB/hfi1: Use interval RB trees Dennis Dalessandro
2016-03-08 19:14 ` [PATCH 08/16] IB/hfi1: Add MMU tracing Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 09/16] IB/hfi1: Remove compare callback Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 10/16] IB/hfi1: Add filter callback Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 11/16] IB/hfi1: Adjust last address values for intervals Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 12/16] IB/hfi1: Implement SDMA-side buffer caching Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 13/16] IB/hfi1: Add pin query function Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 14/16] IB/hfi1: Specify mm when releasing pages Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 15/16] IB/hfi1: Switch to using the pin query function Dennis Dalessandro
2016-03-08 19:15 ` [PATCH 16/16] IB/hfi1: Add SDMA cache eviction algorithm Dennis Dalessandro
2016-03-08 20:56 ` [PATCH 00/16] IB/hfi1: Add a page pinning cache for PSM sdma Or Gerlitz
[not found] ` <CAJ3xEMj8gz6Xw1bqA677fC8=U2ktLQ6b4W20SeNrztN7u6UKZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-09 0:21 ` Dennis Dalessandro
[not found] ` <20160309002157.GA20105-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-09 5:07 ` Leon Romanovsky
[not found] ` <20160309050731.GM13396-2ukJVAZIZ/Y@public.gmane.org>
2016-03-09 19:21 ` Dennis Dalessandro
[not found] ` <20160309192109.GB15031-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-10 4:56 ` Leon Romanovsky
[not found] ` <20160310045609.GC1977-2ukJVAZIZ/Y@public.gmane.org>
2016-03-14 7:09 ` Leon Romanovsky
[not found] ` <20160314070951.GB26456-2ukJVAZIZ/Y@public.gmane.org>
2016-03-14 12:01 ` Dennis Dalessandro
[not found] ` <20160314120152.GA30838-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-14 12:27 ` Leon Romanovsky
2016-03-14 21:19 ` Or Gerlitz
[not found] ` <CAJ3xEMiSgXFT46r0Y7DZGr3mpJFSLrtYrMdz+DbCXDozbMYZRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-15 1:20 ` Dennis Dalessandro
[not found] ` <20160315012049.GA30055-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-15 7:03 ` Or Gerlitz
[not found] ` <CAJ3xEMhToYOBMo_nNi2fFpTexUmUqb3zBX7zWWYjCDfPWpWn-w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-15 19:37 ` Dennis Dalessandro
[not found] ` <20160315193731.GA20662-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-16 15:53 ` Or Gerlitz
[not found] ` <CAJ3xEMjWxdwM0wQR85_-wHpPhYSWz1W0T8H_nDjnp2JS7G29Qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-16 17:23 ` Dennis Dalessandro
[not found] ` <20160316172309.GB26530-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-03-22 7:33 ` Or Gerlitz
[not found] ` <CAJ3xEMg5OPBT63=VV4EKnZUWSHGatDRL0n7O4iBVrN9bMUw5dg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-22 11:46 ` Dennis Dalessandro
2016-03-10 7:11 ` Or Gerlitz
2016-03-09 14:47 ` Or Gerlitz
[not found] ` <CAJ3xEMhcs-6vDzsNk9nJKoNxTWnfaUtDmNHhLp1EPyerjnw2Xg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-09 15:19 ` Dennis Dalessandro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160308191447.30542.76805.stgit@scvm10.sc.intel.com \
--to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=dean.luick-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jubin.john-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mitko.haralanov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).