1. 05 5月, 2017 5 次提交
  2. 21 4月, 2017 3 次提交
  3. 06 4月, 2017 1 次提交
  4. 19 2月, 2017 1 次提交
  5. 12 12月, 2016 1 次提交
  6. 16 11月, 2016 1 次提交
  7. 02 10月, 2016 2 次提交
  8. 03 9月, 2016 1 次提交
  9. 03 8月, 2016 16 次提交
  10. 07 6月, 2016 2 次提交
  11. 26 5月, 2016 3 次提交
  12. 29 4月, 2016 4 次提交
    • S
      IB/hfi1: Check P_KEY for all sent packets from user mode · e38d1e4f
      Sebastian Sanchez 提交于
      Add the P_KEY check for user-context mechanism for
      both PIO and SDMA. For PIO, the
      SendCtxtCheckEnable.DisallowKDETHPackets is set by
      default. When the P_KEY is set,
      SendCtxtCheckEnable.DisallowKDETHPackets is cleared.
      For SDMA, a software check was included. This change
      requires user processes to set the P_KEY before sending
      any packets, otherwise, the sent packet will fail. The
      original submission didn't have this check but it's
      required.
      Reviewed-by: NDean Luick <dean.luick@intel.com>
      Reviewed-by: NDennis Dalessandro <dennis.dalessandro@intel.com>
      Reviewed-by: NMikto Haralanov <mitko.haralanov@intel.com>
      Signed-off-by: NSebastian Sanchez <sebastian.sanchez@intel.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      e38d1e4f
    • M
      IB/hfi1: Fix buffer cache races which may cause corruption · e88c9271
      Mitko Haralanov 提交于
      There are two possible causes for node/memory corruption both
      of which are related to the cache eviction algorithm. One way
      to cause corruption is due to the asynchronous nature of the
      MMU invalidation and the locking used when invalidating node.
      
      The MMU invalidation routine would temporarily release the
      RB tree lock to avoid a deadlock. However, this would allow
      the eviction function to take the lock resulting in the removal
      of cache nodes.
      
      If the node being removed by the eviction code is the same as
      the node being invalidated, the result is use after free.
      
      The same is true in the other direction due to the temporary
      release of the eviction list lock in the eviction loop.
      
      Another corner case exists when dealing with the SDMA buffer
      cache that could cause memory corruption of kernel memory.
      The most common way, in which this corruption exhibits itself
      is a linked list node corruption. In that case, the kernel will
      complain that a node with poisoned pointers is being removed.
      The fact that the pointers are already poisoned means that the
      node has already been removed from the list.
      
      To root cause of this corruption was a mishandling of the
      eviction list maintained by the driver. In order for this
      to happen four conditions need to be satisfied:
      
         1. A node describing a user buffer already exists in the
            interval RB tree,
         2. The beginning of the current user buffer matches that
            node but is bigger. This will cause the node to be
            extended.
         3. The amount of cached buffers is close or at the limit
            of the buffer cache size.
         4. The node has dropped close to the end of the eviction
            list. This will cause the node to be considered for
            eviction.
      
      If all of the above conditions have been satisfied, it is
      possible for the eviction algorithm to evict the current node,
      which will free the node without the driver knowing.
      
      To solve both issues described above:
         - the locking around the MMU invalidation loop and cache
           eviction loop has been improved so locks are not released in
           the loop body,
         - a new RB function is introduced which will "atomically" find
           and remove the matching node from the RB tree, preventing the
           MMU invalidation loop from touching it, and
         - the node being extended by the pin_vector_pages() function is
           removed from the eviction list prior to calling the eviction
           function.
      Reviewed-by: NDean Luick <dean.luick@intel.com>
      Signed-off-by: NMitko Haralanov <mitko.haralanov@intel.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      e88c9271
    • M
      IB/hfi1: Extract and reinsert MMU RB node on lookup · f53af85e
      Mitko Haralanov 提交于
      The page pinning function, which also maintains the pin cache,
      behaves one of two ways when an exact buffer match is not found:
        1. If no node is not found (a buffer with the same starting address
           is not found in the cache), a new node is created, the buffer
           pages are pinned, and the node is inserted into the RB tree, or
        2. If a node is found but the buffer in that node is a subset of
           the new user buffer, the node is extended with the new buffer
           pages.
      
      Both modes of operation require (re-)insertion into the interval RB
      tree.
      
      When the node being inserted is a new node, the operations are pretty
      simple. However, when the node is already existing and is being
      extended, special care must be taken.
      
      First, we want to guard against an asynchronous attempt to
      delete the node by the MMU invalidation notifier. The simplest way to
      do this is to remove the node from the RB tree, preventing the search
      algorithm from finding it.
      
      Second, the node needs to be re-inserted so it lands in the proper place
      in the tree and the tree is correctly re-balanced. This also requires
      the node to be removed from the RB tree.
      
      This commit adds the hfi1_mmu_rb_extract() function, which will search
      for a node in the interval RB tree matching an address and length and
      remove it from the RB tree if found. This allows for both of the above
      special cases be handled in a single step.
      Reviewed-by: NDean Luick <dean.luick@intel.com>
      Signed-off-by: NMitko Haralanov <mitko.haralanov@intel.com>
      Signed-off-by: NDennis Dalessandro <dennis.dalessandro@intel.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      f53af85e
    • M
      IB/hfi1: Correctly compute node interval · de79093b
      Mitko Haralanov 提交于
      The computation of the interval of an interval RB node
      was incorrect leading to data corruption due to the RB
      search algorithm not properly finding the all RB nodes
      in an MMU invalidation interval.
      
      The problem stemmed from the fact that the beginning
      address of the node's range was being aligned to a page
      boundary. For certain buffer sizes, this would lead to
      a end address calculation that was off by 1 page.
      
      An important aspect of keeping the RB same is also
      updating the node's range in the case it's being extended.
      Reviewed-by: NDean Luick <dean.luick@intel.com>
      Signed-off-by: NMitko Haralanov <mitko.haralanov@intel.com>
      Signed-off-by: NDoug Ledford <dledford@redhat.com>
      de79093b