summaryrefslogtreecommitdiffstats
path: root/include/linux/seqlock.h
diff options
context:
space:
mode:
authorThomas Gleixner2014-07-16 23:05:20 +0200
committerJohn Stultz2014-07-24 00:01:54 +0200
commit0ea5a520f73ca31abc4c10b6d5bc14a884a0641b (patch)
tree8d97283712062b622411281cd5bb7f19e9447689 /include/linux/seqlock.h
parenttimekeeping: Use tk_read_base as argument for timekeeping_get_ns() (diff)
downloadkernel-qcow2-linux-0ea5a520f73ca31abc4c10b6d5bc14a884a0641b.tar.gz
kernel-qcow2-linux-0ea5a520f73ca31abc4c10b6d5bc14a884a0641b.tar.xz
kernel-qcow2-linux-0ea5a520f73ca31abc4c10b6d5bc14a884a0641b.zip
seqcount: Provide raw_read_seqcount()
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: Thomas 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: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/seqlock.h')
-rw-r--r--include/linux/seqlock.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 535f158977b9..dcc64b9bfc41 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -117,6 +117,22 @@ repeat:
}
/**
+ * raw_read_seqcount - Read the raw seqcount
+ * @s: pointer to seqcount_t
+ * Returns: count to be passed to read_seqcount_retry
+ *
+ * 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.
+ */
+static inline unsigned raw_read_seqcount(const seqcount_t *s)
+{
+ unsigned ret = ACCESS_ONCE(s->sequence);
+ smp_rmb();
+ return ret;
+}
+
+/**
* raw_read_seqcount_begin - start seq-read critical section w/o lockdep
* @s: pointer to seqcount_t
* Returns: count to be passed to read_seqcount_retry