Lines Matching +full:lock +full:- +full:less

81  * Locking strategy for high-resolution timing services
88 * To minimize lock contention and cache thrashing we employ the
90 * on an acquisition-counting mutex, described below; readers (common)
91 * execute in parallel with no synchronization at all -- they don't
93 * readers just examine the writer lock's value before and after loading
98 * The writer lock, hres_lock, is a 32-bit integer consisting of an
99 * 8-bit lock and a 24-bit acquisition count. To acquire the lock we
100 * set the lock field with ldstub, which sets the low-order 8 bits to
101 * 0xff; to clear the lock, we increment it, which simultaneously clears
102 * the lock field (0xff --> 0x00) and increments the acquisition count
107 * and after loading the time components they need; if either lock value
108 * contains 0xff in the low-order bits (lock held), or if the lock values
109 * are not equal (lock was acquired and released), a writer intervened
110 * and the reader must try again. If the lock values are equal and the
111 * low-order 8 bits are clear, the timestamp must be valid. We can check
114 * following table of all possible lock states:
117 * ------------ ----- -----------------
132 * This is essential *even on a CPU that does in-order loads* because
135 * lower bit (andn with 1) of the old lock value right away, since this
137 * anyway to perform the lock comparison described above.
139 * (2) Out-of-order loads.
141 * On a CPU that does out-of-order loads we must ensure that the loads
150 * CBE_HIGH_PIL or higher to prevent single-CPU deadlock.
152 * (4) Cross-calls.
154 * If a cross-call happens while one CPU has hres_lock and another is
157 * waiting to be released from the cross-call, and the cross-call can't
159 * disabled. Thus cross-calls must be blocked while holding hres_lock.
178 * NATIVE_TIME_TO_NSEC_SCALE is called with NSEC_SHIFT to convert hi-res
180 * hi-res timestamps are in %stick units. On systems that do not have a
181 * %stick register, hi-res timestamps are in %tick units.
195 * Convert hi-res native time (V9's %tick in our case) into nanoseconds.
198 * without using floating point and without overflowing 64-bit integers.
203 * To avoid floating-point we precompute (R * 2^32) during boot and
207 * To avoid 64-bit overflow when multiplying (tick << 4) by nsec_scale,
208 * we split (tick << 4) into its high and low 32-bit pieces, H and L,
218 * floating point and all intermediate results fit in 64-bit registers.
220 * Note that we require that tick is less than (1 << (64 - NSEC_SHIFT));
222 * is a serious problem; (1 << (64 - NSEC_SHIFT)) nanoseconds is over
223 * thirty-six years). Nonetheless, clients may wish to be aware of this
226 * We provide two versions of this macro: a "full-service" version that
227 * just converts ticks to nanoseconds and a higher-performance version that
230 * we take a fast path if we determine the ticks to be less than 32 bits
234 * Note that in the 32-bit path we don't even bother clearing NPT.
247 brz,a,pt scr2, 6f; /* if clear, 32-bit fast path */\
248 mulx out, scr1, out; /* delay: 32-bit fast path */ \
249 sllx out, shift, out; /* clear NPT and pre-scale */ \
255 ba 7f; /* branch over 32-bit path */ \
258 srlx out, 32 - shift, out; \
267 mov -1, out; \