04 Aug, 2016
1 commit
03 Aug, 2016
39 commits
-
The original code used a LRU list to evict nodes which were least
recently used. For correctness the evict code was moved under the
handler->lock, now add back the LRU list.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
During an unexpected shutdown, references to tid_rb_node were NULL'ed out
without properly being released.Fix this by calling clear_tid_node in the mmu notifier remove callback
rather than after these callbacks are called.Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
The reworked mmu_rb interface allows the unused mm argument to be removed.
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
The ops->remove() callback was called by hfi1_mmu_unregister() with a
NULL mm argument while holding a spinlock. In the case of sdma_rb_remove()
this caused it to pass current->mm to hfi1_release_user_pages()This had 2 problems. First this would attempt to acquire the mmap_sem
under a spin lock. Second the use of current->mm is not always guaranteed
to be the proper mm when the fd is being closed.Rather than depend on this implicit behavior we move all calls to
ops->remove outside of the spinlock. This also allows the correct
mm to be used in the remove callback without fear of deadlock.Because the MMU notifier is not guaranteed to hold mm->mmap_sem, but
usually does, we must delay all remove callbacks until out of the notifier,
when the callbacks can take the mmap_sem if they need to.Code comments were added to clarify what the expectations are for the
users of the mmu rb tree.Suggested-by: Jim Foraker
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Use the new cache evict operation in the SDMA code. This allows the cache
to properly coordinate evicts and removes, preventing any race. With this
change, the separate list, lock, and race flag are not needed.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Allow users to clear nodes from the rb tree based on their evict callback.
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Per file descriptor TID caching actions depend on a global that can
change midway through the lifetime of that file descriptor.Make the use of caching consistent for the life of the file descriptor
by using the presence of the cache handler to decide when to use the cache
functions.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
The objects which use cache handling should reference their own handler
object not the internal data structure it uses to track the nodes.Have the "users" of the mmu notifier code pass opaque objects which can
then be properly used in the mmu callbacks depending on the owners needs.This patch has the additional benefit that operations no longer require a
look up in a list to find the handlers.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
The hfi1 driver registers a mmu_notifier callback when /dev/hfi1_* is
opened, and unregisters it when the device is closed. The driver
incorrectly assumes that the close will always happen from the same
context as the open. In particular, closes due to SIGKILL or OOM killer
activity may happen from a different context. In these cases, the wrong
mm is passed to mmu_notifier_unregister(), which causes improper reference
counting for the victim mm, and eventual memory corruption.Preserve the mm for all open file descriptors and use this mm rather than
current->mm for memory operations for the lifetime of that fd. Note: this
patch leaves 1 use of current->mm in place. This use is removed in a
follow on patch because other functional changes were required prior to
that use being removed.If registration fails, there is no reason to keep the handler object
around. Free the handler object rather than add it to the list to
prevent any mmu_notifier operations, including unregister, when
registration fails.Suggested-by: Jim Foraker
Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
The user SDMA in-use claim bit is in the structure that gets zeroed out
once the claim is made. Move the request in-use flag into its own bit
array and use that for atomic claims. This cleans up the claim code and
removes any race possibility.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
If input validation fails, properly free the request before returning.
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
If unable to insert node into the RB tree cache, node will be freed
before returning from the function. Null out iovec's pointer to node
so iovec does not try to free it later.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Save the current capability state at user context creation
time. Report this saved value for all shared contexts.Also get rid of unnecessary hfi1_get_base_kinfo function.
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
If a context has not been assigned or assignment failed, pq may be NULL.
Move the unregister within the protection of the null check.Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Clarify the names of the TID mmu functions.
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Checking if the rb tree is empty is redundant with the while loop which is
emptying the rb tree.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Rearrange the file open call in prep for new changes.
Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
For bool parameters "false" should be used
Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
subctxt is not used, just remove it.
Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
__mmu_rb_remove was called in only 1 place which was a very simple
call site. Combine this function into its caller.Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Remove, insert, and invalidate are always provided. No
need to test.Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
This makes it more clear what these functions are
operating on.Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Parameter names to function declarations make it more clear
what those parameters do.Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
These are no longer needed.
Reviewed-by: Ira Weiny
Signed-off-by: Dean Luick
Signed-off-by: Doug Ledford -
Brackets should be on the next line of a function
Reviewed-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Expand the serial number space by using more bits
from the GUID.Reviewed-by: Jubin John
Signed-off-by: Dean Luick
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
The driver pads non-double word multiple message sizes but it doesn't
account for this padding when the packet length is calculated. Also, the
data length is miscalculated for message sizes less than 4 bytes due to
the bit representation in LRH. And there's a check for non-double word
multiple message sizes that prevents these messages from being sent.
This patch fixes length miscalculations and enables the functionality to
send non-double word multiple message sizes.Reviewed-by: Harish Chegondi
Signed-off-by: Sebastian Sanchez
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
The use of the specific opcode test is redundant since
all ack entry users correctly manipulate the mr pointer
to selectively trigger the reference clearing.The overly specific test hinders the use of implementation
specific operations.The change needs to get rid of the union to insure that
an atomic value is not seen as an MR pointer.Reviewed-by: Ashutosh Dixit
Signed-off-by: Mike Marciniszyn
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Checking the return value of the memory allocation call in
init_pervl_scs() was missed. Recently the kmalloc() was changed to
kzalloc() which identified the problem.While fixing this issue 2 other bugs were noticed. First, the array
being allocated is accessed in the nomem path which can be reached before
it is allocated. Second, kernel_send_context was not released on error.
Fix both of these by creating a more common memory unwind label structure.Fixes: 35f6befc8441 ("staging/rdma/hfi1: Add qp to send context mapping for PIO")
Reported-by: Leon Romanovsky
Reviewed-by: Mike Marciniszyn
Signed-off-by: Dennis Dalessandro
Signed-off-by: Ira Weiny
Signed-off-by: Doug Ledford -
Instead of copying the actual GRH of type struct ib_grh, existing code
copies the struct ib_global_route into the sge. This patch fixes that
and constructs the actual GRH from ib_global_route and copies the GRH
into the sge.Reviewed-by: Dennis Dalessandro
Reviewed-by: Dean Luick
Reviewed-by: Ira Weiny
Signed-off-by: Dasaratharaman Chandramouli
Signed-off-by: Don Hiatt
Signed-off-by: Dennis Dalessandro
Signed-off-by: Doug Ledford -
The interface is used to compute the 5-bit SC field from the
LRH and the RHF bits. Modify code to use the interface instead.Reviewed-by: Dennis Dalessandro
Signed-off-by: Dasaratharaman Chandramouli
Signed-off-by: Don Hiatt
Signed-off-by: Dennis Dalessandro
Signed-off-by: Doug Ledford -
Cleanup hfi1_ud_rcv to not have to look at the packet
header fields multiple times. The fields are looked up
once and used throughout the function. Also fix sc
computation when validating MAD packets.Reviewed-by: Dennis Dalessandro
Reviewed-by: Dean Luick
Reviewed-by: Ira Weiny
Signed-off-by: Dasaratharaman Chandramouli
Signed-off-by: Don Hiatt
Signed-off-by: Dennis Dalessandro
Signed-off-by: Doug Ledford -
hfi1_pio_header should really be called hfi1_sdma_header
as it is only used for sdma transmits.Reviewed-by: Dennis Dalessandro
Reviewed-by: Dean Luick
Reviewed-by: Ira Weiny
Signed-off-by: Don Hiatt
Signed-off-by: Dasaratharaman Chandramouli
Signed-off-by: Dennis Dalessandro
Signed-off-by: Doug Ledford -
struct ahg_ib_header has no header specific information.
Rename it to struct hfi1_ahg_infoReviewed-by: Dennis Dalessandro
Reviewed-by: Dean Luick
Signed-off-by: Dasaratharaman Chandramouli
Signed-off-by: Don Hiatt
Signed-off-by: Dennis Dalessandro
Signed-off-by: Doug Ledford -
sde and hfi1_ib_header are not used anymore.
Reviewed-by: Dennis Dalessandro
Reviewed-by: Dean Luick
Reviewed-by: Ira Weiny
Signed-off-by: Dasaratharaman Chandramouli
Signed-off-by: Don Hiatt
Signed-off-by: Dennis Dalessandro
Signed-off-by: Doug Ledford