1. 28 5月, 2015 2 次提交
  2. 24 2月, 2015 1 次提交
  3. 19 9月, 2014 1 次提交
  4. 24 7月, 2014 2 次提交
    • M
      seqcount: Add raw_write_seqcount_latch() · 9b0fd802
      Mathieu Desnoyers 提交于
      For NMI safe access to clock monotonic we use the seqcount LSB as
      index of a timekeeper array. The update sequence looks like this:
      
            smp_wmb();      <- prior stores to a[1]
            seq++;
            smp_wmb();      <- seq increment before update of a[0]
            update(a[0]);
            smp_wmb();      <- update of a[0]
            seq++;
            smp_wmb();      <- seq increment before update of a[1]
            update(a[1]);
      
      To avoid open coded barriers, provide a helper function.
      
      [ tglx: Split out of a combo patch against the first implementation of
        	the NMI safe accessor ]
      Signed-off-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      9b0fd802
    • T
      seqcount: Provide raw_read_seqcount() · 0ea5a520
      Thomas Gleixner 提交于
      raw_read_seqcount opens a read critical section of the given seqcount
      without any lockdep checking and without checking or masking the
      LSB. Calling code is responsible for handling that.
      
      Preparatory patch to provide a NMI safe clock monotonic accessor
      function.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      0ea5a520
  5. 19 6月, 2014 1 次提交
    • T
      lockdep: Revert lockdep check in raw_seqcount_begin() · 22fdcf02
      Trond Myklebust 提交于
      This commit reverts the addition of lockdep checking to raw_seqcount_begin
      for the following reasons:
      
       1) It violates the naming convention that raw_* functions should not
          do lockdep checks (a convention that is also followed by the other
          raw_*_seqcount_begin functions).
      
       2) raw_seqcount_begin does not spin, so it can only be part of an ABBA
          deadlock in very special circumstances (for instance if a lock
          is held across the entire raw_seqcount_begin()+read_seqcount_retry()
          loop while also being taken inside the write_seqcount protected area).
      
       3) It is causing false positives with some existing callers, and there
          is no non-lockdep alternative for those callers to use.
      
      None of the three existing callers (__d_lookup_rcu, netdev_get_name, and
      the NFS state code) appear to use the function in a manner that is ABBA
      deadlock prone.
      
      Fixes: 1ca7d67c: seqcount: Add lockdep functionality to seqcount/seqlock
      Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Waiman Long <Waiman.Long@hp.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/CAHQdGtRR6SvEhXiqWo24hoUh9AU9cL82Z8Z-d8-7u951F_d+5g@mail.gmail.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      22fdcf02
  6. 12 1月, 2014 1 次提交
  7. 16 11月, 2013 1 次提交
  8. 06 11月, 2013 1 次提交
  9. 13 9月, 2013 1 次提交
    • W
      seqlock: Add a new locking reader type · 1370e97b
      Waiman Long 提交于
      The sequence lock (seqlock) was originally designed for the cases where
      the readers do not need to block the writers by making the readers retry
      the read operation when the data change.
      
      Since then, the use cases have been expanded to include situations where
      a thread does not need to change the data (effectively a reader) at all
      but have to take the writer lock because it can't tolerate changes to
      the protected structure.  Some examples are the d_path() function and
      the getcwd() syscall in fs/dcache.c where the functions take the writer
      lock on rename_lock even though they don't need to change anything in
      the protected data structure at all.  This is inefficient as a reader is
      now blocking other sequence number reading readers from moving forward
      by pretending to be a writer.
      
      This patch tries to eliminate this inefficiency by introducing a new
      type of locking reader to the seqlock locking mechanism.  This new
      locking reader will try to take an exclusive lock preventing other
      writers and locking readers from going forward.  However, it won't
      affect the progress of the other sequence number reading readers as the
      sequence number won't be changed.
      Signed-off-by: NWaiman Long <Waiman.Long@hp.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1370e97b
  10. 19 2月, 2013 2 次提交
  11. 05 5月, 2012 2 次提交
    • L
      seqlock: add 'raw_seqcount_begin()' function · 4f988f15
      Linus Torvalds 提交于
      The normal read_seqcount_begin() function will wait for any current
      writers to exit their critical region by looping until the sequence
      count is even.
      
      That "wait for sequence count to stabilize" is the right thing to do if
      the read-locker will just retry the whole operation on contention: no
      point in doing a potentially expensive reader sequence if we know at the
      beginning that we'll just end up re-doing it all.
      
      HOWEVER.  Some users don't actually retry the operation, but instead
      will abort and do the operation with proper locking.  So the sequence
      count case may be the optimistic quick case, but in the presense of
      writers you may want to do full locking in order to guarantee forward
      progress.  The prime example of this would be the RCU name lookup.
      
      And in that case, you may well be better off without the "retry early",
      and are in a rush to instead get to the failure handling.  Thus this
      "raw" interface that just returns the sequence number without testing it
      - it just forces the low bit to zero so that read_seqcount_retry() will
      always fail such a "active concurrent writer" scenario.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4f988f15
    • L
      Fix __read_seqcount_begin() to use ACCESS_ONCE for sequence value read · 2f624278
      Linus Torvalds 提交于
      We really need to use a ACCESS_ONCE() on the sequence value read in
      __read_seqcount_begin(), because otherwise the compiler might end up
      reloading the value in between the test and the return of it.  As a
      result, it might end up returning an odd value (which means that a write
      is in progress).
      
      If the reader is then fast enough that that odd value is still the
      current one when the read_seqcount_retry() is done, we might end up with
      a "successful" read sequence, even despite the concurrent write being
      active.
      
      In practice this probably never really happens - there just isn't
      anything else going on around the read of the sequence count, and the
      common case is that we end up having a read barrier immediately
      afterwards.
      
      So the code sequence in which gcc might decide to reaload from memory is
      small, and there's no reason to believe it would ever actually do the
      reload.  But if the compiler ever were to decide to do so, it would be
      incredibly annoying to debug.  Let's just make sure.
      
      Cc: stable@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2f624278
  12. 12 6月, 2011 1 次提交
  13. 24 5月, 2011 1 次提交
  14. 12 5月, 2011 1 次提交
    • M
      seqlock: Don't smp_rmb in seqlock reader spin loop · 5db1256a
      Milton Miller 提交于
      Move the smp_rmb after cpu_relax loop in read_seqlock and add
      ACCESS_ONCE to make sure the test and return are consistent.
      
      A multi-threaded core in the lab didn't like the update
      from 2.6.35 to 2.6.36, to the point it would hang during
      boot when multiple threads were active.  Bisection showed
      af5ab277 (clockevents:
      Remove the per cpu tick skew) as the culprit and it is
      supported with stack traces showing xtime_lock waits including
      tick_do_update_jiffies64 and/or update_vsyscall.
      
      Experimentation showed the combination of cpu_relax and smp_rmb
      was significantly slowing the progress of other threads sharing
      the core, and this patch is effective in avoiding the hang.
      
      A theory is the rmb is affecting the whole core while the
      cpu_relax is causing a resource rebalance flush, together they
      cause an interfernce cadance that is unbroken when the seqlock
      reader has interrupts disabled.
      
      At first I was confused why the refactor in
      3c22cd57 (kernel: optimise
      seqlock) didn't affect this patch application, but after some
      study that affected seqcount not seqlock. The new seqcount was
      not factored back into the seqlock.  I defer that the future.
      
      While the removal of the timer interrupt offset created
      contention for the xtime lock while a cpu does the
      additonal work to update the system clock, the seqlock
      implementation with the tight rmb spin loop goes back much
      further, and is just waiting for the right trigger.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMilton Miller <miltonm@bga.com>
      Cc: <linuxppc-dev@lists.ozlabs.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: NEric Dumazet <eric.dumazet@gmail.com>
      Link: http://lkml.kernel.org/r/%3Cseqlock-rmb%40mdm.bga.com%3ESigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      5db1256a
  15. 07 1月, 2011 1 次提交
    • N
      kernel: optimise seqlock · 3c22cd57
      Nick Piggin 提交于
      Add branch annotations for seqlock read fastpath, and introduce
      __read_seqcount_begin and __read_seqcount_end functions, that can avoid the
      smp_rmb() if used carefully. These will be used by store-free path walking
      algorithm performance is critical and seqlocks are in use.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      3c22cd57
  16. 25 4月, 2008 1 次提交
    • I
      seqlock: livelock fix · 88a411c0
      Ingo Molnar 提交于
      Thomas Gleixner debugged a particularly ugly seqlock related livelock:
      do not process the seq-read section if we know it beforehand that the
      test at the end of the section will fail ...
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      88a411c0
  17. 28 4月, 2007 1 次提交
  18. 18 2月, 2007 1 次提交
  19. 13 12月, 2006 1 次提交
    • I
      [PATCH] lockdep: fix seqlock_init() · 99a3eb38
      Ingo Molnar 提交于
      seqlock_init() needs to use spin_lock_init() for dynamic locks, so that
      lockdep is notified about the presence of a new lock.
      
      (this is a fallout of the recent networking merge, which started using
      the so-far unused seqlock_init() API.)
      
      This fix solves the following lockdep-internal warning on current -git:
      
       INFO: trying to register non-static key.
       the code is fine but needs lockdep annotation.
       turning off the locking correctness validator.
           __lock_acquire+0x10c/0x9f9
           lock_acquire+0x56/0x72
           _spin_lock+0x35/0x42
           neigh_destroy+0x9d/0x12e
           neigh_periodic_timer+0x10a/0x15c
           run_timer_softirq+0x126/0x18e
           __do_softirq+0x6b/0xe6
           do_softirq+0x64/0xd2
           ksoftirqd+0x82/0x138
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      99a3eb38
  20. 04 7月, 2006 1 次提交
  21. 26 4月, 2006 1 次提交
  22. 11 4月, 2006 1 次提交
  23. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4