1. 12 Mar, 2009 5 commits
    • Darren Hart's avatar
      futex: unlock before returning -EFAULT · e8f6386c
      Darren Hart authored
      Impact: rt-mutex failure case fix
      
      futex_lock_pi can potentially return -EFAULT with the rt_mutex
      held.  This seems like the wrong thing to do as userspace should
      assume -EFAULT means the lock was not taken.  Even if it could
      figure this out, we'd be leaving the pi_state->owner in an
      inconsistent state.  This patch unlocks the rt_mutex prior to
      returning -EFAULT to userspace.
      
      Build and boot tested on a 4 way Intel x86_64 workstation.
      Passes basic pthread_mutex and PI tests out of
      ltp/testcases/realtime.
      Signed-off-by: default avatarDarren Hart <dvhltc@us.ibm.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <20090312075606.9856.88729.stgit@Aeon>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e8f6386c
    • Darren Hart's avatar
      futex: use current->time_slack_ns for rt tasks too · 16f4993f
      Darren Hart authored
      RT tasks should set their timer slack to 0 on their own.  This
      patch removes the 'if (rt_task()) slack = 0;' block in
      futex_wait.
      
      Build and boot tested on a 4 way Intel x86_64 workstation.
      Passes basic pthread_mutex and PI tests out of
      ltp/testcases/realtime.
      Signed-off-by: default avatarDarren Hart <dvhltc@us.ibm.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      LKML-Reference: <20090312075559.9856.28822.stgit@Aeon>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      16f4993f
    • Darren Hart's avatar
      futex: add double_unlock_hb() · 5eb3dc62
      Darren Hart authored
      Impact: cleanup
      
      The futex code uses double_lock_hb() which locks the hb->lock's
      in pointer value order.  There is no parallel unlock routine,
      and the code unlocks them in name order, ignoring pointer value.
      
      This patch adds double_unlock_hb() to refactor the duplicated
      code segments.
      
      Build and boot tested on a 4 way Intel x86_64 workstation.
      Passes basic pthread_mutex and PI tests out of
      ltp/testcases/realtime.
      Signed-off-by: default avatarDarren Hart <dvhltc@us.ibm.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <20090312075552.9856.48021.stgit@Aeon>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5eb3dc62
    • Darren Hart's avatar
      futex: additional (get|put)_futex_key() fixes · de87fcc1
      Darren Hart authored
      Impact: fix races
      
      futex_requeue and futex_lock_pi still had some bad
      (get|put)_futex_key() usage. This patch adds the missing
      put_futex_keys() and corrects a goto in futex_lock_pi() to avoid
      a double get.
      
      Build and boot tested on a 4 way Intel x86_64 workstation.
      Passes basic pthread_mutex and PI tests out of
      ltp/testcases/realtime.
      Signed-off-by: default avatarDarren Hart <dvhltc@us.ibm.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <20090312075545.9856.75152.stgit@Aeon>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      de87fcc1
    • Darren Hart's avatar
      futex: update futex commentary · b2d0994b
      Darren Hart authored
      Impact: cleanup
      
      The futex_hash_bucket can be a bit confusing when first looking
      at the code as it is a shared queue (and futex_q isn't a queue
      at all, but rather an element on the queue).
      
      The mmap_sem is no longer held outside of the
      futex_handle_fault() routine, yet numerous comments refer to it.
      The fshared argument is no an integer.  I left some of these
      comments along as they are simply removed in future patches.
      
      Some of the commentary refering to futexes by virtual page
      mappings was not very clear, and completely accurate (as for
      shared futexes both the page and the offset are used to
      determine the key).  For the purposes of the function
      description, just referring to "the futex" seems sufficient.
      
      With hashed futexes we now access the page after the hash-bucket
      is locked, and not only after it is enqueued.
      Signed-off-by: default avatarDarren Hart <dvhltc@us.ibm.com>
      Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      LKML-Reference: <20090312075537.9856.29954.stgit@Aeon>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b2d0994b
  2. 11 Mar, 2009 13 commits
  3. 10 Mar, 2009 22 commits