search for: _q_locked_pending_mask

Displaying 20 results from an estimated 79 matches for "_q_locked_pending_mask".

2014 Jun 17
3
[PATCH 04/11] qspinlock: Extract out the exchange of tail code word
...PU_MASK) > + > #define _Q_LOCKED_VAL (1U << _Q_LOCKED_OFFSET) > #define _Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) > > --- a/kernel/locking/qspinlock.c > +++ b/kernel/locking/qspinlock.c > @@ -86,6 +86,31 @@ static inline struct mcs_spinlock *decod > #define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) > > /** > + * xchg_tail - Put in the new queue tail code word & retrieve previous one > + * @lock : Pointer to queue spinlock structure > + * @tail : The new queue tail code word > + * Return: The previous queue tail code word > + * &gt...
2014 Jun 17
3
[PATCH 04/11] qspinlock: Extract out the exchange of tail code word
...PU_MASK) > + > #define _Q_LOCKED_VAL (1U << _Q_LOCKED_OFFSET) > #define _Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) > > --- a/kernel/locking/qspinlock.c > +++ b/kernel/locking/qspinlock.c > @@ -86,6 +86,31 @@ static inline struct mcs_spinlock *decod > #define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) > > /** > + * xchg_tail - Put in the new queue tail code word & retrieve previous one > + * @lock : Pointer to queue spinlock structure > + * @tail : The new queue tail code word > + * Return: The previous queue tail code word > + * &gt...
2014 Jun 18
0
[PATCH 04/11] qspinlock: Extract out the exchange of tail code word
...) function which can be optimized in a >> later patch. > > And also adds a third try on acquiring the lock. That I think should > be a seperate patch. It doesn't really add a new try, the old code is: - for (;;) { - new = _Q_LOCKED_VAL; - if (val) - new = tail | (val & _Q_LOCKED_PENDING_MASK); - - old = atomic_cmpxchg(&lock->val, val, new); - if (old == val) - break; - - val = old; - } /* - * we won the trylock; forget about queueing. */ - if (new == _Q_LOCKED_VAL) - goto release; The trylock happens if the "if (val)" hits the else branch. What the pat...
2014 Jun 15
0
[PATCH 04/11] qspinlock: Extract out the exchange of tail code word
...TAIL_MASK (_Q_TAIL_IDX_MASK | _Q_TAIL_CPU_MASK) + #define _Q_LOCKED_VAL (1U << _Q_LOCKED_OFFSET) #define _Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -86,6 +86,31 @@ static inline struct mcs_spinlock *decod #define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) /** + * xchg_tail - Put in the new queue tail code word & retrieve previous one + * @lock : Pointer to queue spinlock structure + * @tail : The new queue tail code word + * Return: The previous queue tail code word + * + * xchg(lock, tail) + * + * p,*,* -&g...
2014 Apr 17
0
[PATCH v9 04/19] qspinlock: Extract out the exchange of tail code word
..._Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c index d35362a..fcf06cb 100644 --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -86,6 +86,34 @@ static inline struct mcs_spinlock *decode_tail(u32 tail) #define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) /** + * xchg_tail - Put in the new queue tail code word & retrieve previous one + * @lock : Pointer to queue spinlock structure + * @tail : The new queue tail code word + * @pval : Pointer to current value of the queue spinlock 32-bit word + * Return: The p...
2014 Jun 15
0
[PATCH 03/11] qspinlock: Add pending bit
...FSET) +#define _Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) #endif /* __ASM_GENERIC_QSPINLOCK_TYPES_H */ --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -83,24 +83,28 @@ static inline struct mcs_spinlock *decod return per_cpu_ptr(&mcs_nodes[idx], cpu); } +#define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) + /** * queue_spin_lock_slowpath - acquire the queue spinlock * @lock: Pointer to queue spinlock structure * @val: Current value of the queue spinlock 32-bit word * - * (queue tail, lock bit) - * - * fast : slow...
2014 Apr 17
0
[PATCH v9 03/19] qspinlock: Add pending bit
...--git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c index b97a1ad..d35362a 100644 --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -83,23 +83,93 @@ static inline struct mcs_spinlock *decode_tail(u32 tail) return per_cpu_ptr(&mcs_nodes[idx], cpu); } +#define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) + +/** + * trylock_pending - try to acquire queue spinlock using the pending bit + * @lock : Pointer to queue spinlock structure + * @pval : Pointer to value of the queue spinlock 32-bit word + * Return: 1 if lock acquired, 0 otherwise + */ +static inline int tryl...
2014 Apr 17
2
[PATCH v9 06/19] qspinlock: prolong the stay in the pending bit path
...> for (;;) { > /* > - * If we observe any contention; queue. > + * If we observe that the queue is not empty, > + * return and be queued. > */ > - if (val & ~_Q_LOCKED_MASK) > + if (val & _Q_TAIL_MASK) > return 0; > > + if ((val & _Q_LOCKED_PENDING_MASK) == > + (_Q_LOCKED_VAL|_Q_PENDING_VAL)) { > + /* > + * If both the lock and pending bits are set, we wait > + * a while to see if that either bit will be cleared. > + * If that is no change, we return and be queued. > + */ > + if (!retry) > + return 0...
2014 Apr 17
2
[PATCH v9 06/19] qspinlock: prolong the stay in the pending bit path
...> for (;;) { > /* > - * If we observe any contention; queue. > + * If we observe that the queue is not empty, > + * return and be queued. > */ > - if (val & ~_Q_LOCKED_MASK) > + if (val & _Q_TAIL_MASK) > return 0; > > + if ((val & _Q_LOCKED_PENDING_MASK) == > + (_Q_LOCKED_VAL|_Q_PENDING_VAL)) { > + /* > + * If both the lock and pending bits are set, we wait > + * a while to see if that either bit will be cleared. > + * If that is no change, we return and be queued. > + */ > + if (!retry) > + return 0...
2014 May 07
0
[PATCH v10 03/19] qspinlock: Add pending bit
...--git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c index b97a1ad..6467bfc 100644 --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -83,23 +83,97 @@ static inline struct mcs_spinlock *decode_tail(u32 tail) return per_cpu_ptr(&mcs_nodes[idx], cpu); } +#define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) + +/** + * trylock_pending - try to acquire queue spinlock using the pending bit + * @lock : Pointer to queue spinlock structure + * @pval : Pointer to value of the queue spinlock 32-bit word + * Return: 1 if lock acquired, 0 otherwise + */ +static inline int tryl...
2015 Mar 16
0
[PATCH 3/9] qspinlock: Add pending bit
...FSET) +#define _Q_PENDING_VAL (1U << _Q_PENDING_OFFSET) #endif /* __ASM_GENERIC_QSPINLOCK_TYPES_H */ --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -94,24 +94,28 @@ static inline struct mcs_spinlock *decod return per_cpu_ptr(&mcs_nodes[idx], cpu); } +#define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) + /** * queue_spin_lock_slowpath - acquire the queue spinlock * @lock: Pointer to queue spinlock structure * @val: Current value of the queue spinlock 32-bit word * - * (queue tail, lock value) - * - * fast : slow...
2014 Apr 18
0
[PATCH v9 06/19] qspinlock: prolong the stay in the pending bit path
...; - * If we observe any contention; queue. >> + * If we observe that the queue is not empty, >> + * return and be queued. >> */ >> - if (val& ~_Q_LOCKED_MASK) >> + if (val& _Q_TAIL_MASK) >> return 0; >> >> + if ((val& _Q_LOCKED_PENDING_MASK) == >> + (_Q_LOCKED_VAL|_Q_PENDING_VAL)) { >> + /* >> + * If both the lock and pending bits are set, we wait >> + * a while to see if that either bit will be cleared. >> + * If that is no change, we return and be queued. >> + */ >> + if...
2014 Jun 15
28
[PATCH 00/11] qspinlock with paravirt support
Since Waiman seems incapable of doing simple things; here's my take on the paravirt crap. The first few patches are taken from Waiman's latest series, but the virt support is completely new. Its primary aim is to not mess up the native code. I've not stress tested it, but the virt and paravirt (kvm) cases boot on simple smp guests. I've not done Xen, but the patch should be
2014 Jun 15
28
[PATCH 00/11] qspinlock with paravirt support
Since Waiman seems incapable of doing simple things; here's my take on the paravirt crap. The first few patches are taken from Waiman's latest series, but the virt support is completely new. Its primary aim is to not mess up the native code. I've not stress tested it, but the virt and paravirt (kvm) cases boot on simple smp guests. I've not done Xen, but the patch should be
2014 Jun 16
4
[PATCH 10/11] qspinlock: Paravirt support
...> +void __pv_wait_head(struct qspinlock *lock) > +{ > + unsigned int count; > + struct pv_node *pn; > + int val, old, new; > + > + for (;;) { > + count = SPIN_THRESHOLD; > + > + do { > + val = smp_load_acquire(&lock->val.counter); > + if (!(val& _Q_LOCKED_PENDING_MASK)) > + return; > + } while (--count); > + > + do { > + pn = pv_decode_tail(atomic_read(&lock->val)); > + > + while (pn->head == INVALID_HEAD) > + cpu_relax(); > + > + pn->head = smp_processor_id(); > + > + } while (pn != pv_decode_tail(...
2014 Jun 16
4
[PATCH 10/11] qspinlock: Paravirt support
...> +void __pv_wait_head(struct qspinlock *lock) > +{ > + unsigned int count; > + struct pv_node *pn; > + int val, old, new; > + > + for (;;) { > + count = SPIN_THRESHOLD; > + > + do { > + val = smp_load_acquire(&lock->val.counter); > + if (!(val& _Q_LOCKED_PENDING_MASK)) > + return; > + } while (--count); > + > + do { > + pn = pv_decode_tail(atomic_read(&lock->val)); > + > + while (pn->head == INVALID_HEAD) > + cpu_relax(); > + > + pn->head = smp_processor_id(); > + > + } while (pn != pv_decode_tail(...
2014 Nov 03
0
[PATCH v13 09/11] pvqspinlock, x86: Add para-virtualization support
..._wait_node(old, node) && (old & _Q_TAIL_MASK)) { > prev = decode_tail(old); > ACCESS_ONCE(prev->next) = node; > @@ -369,9 +409,11 @@ queue: > * > * *,x,y -> *,0,0 > */ > - while ((val = smp_load_acquire(&lock->val.counter)) & > - _Q_LOCKED_PENDING_MASK) > + val = pv_wait_head(lock, node); > + while (val & _Q_LOCKED_PENDING_MASK) { > cpu_relax(); > + val = smp_load_acquire(&lock->val.counter); > + } > > /* > * claim the lock: Please make the pv_*() calls return void and reduce to NOPs. This keeps the...
2014 Jun 17
5
[PATCH 03/11] qspinlock: Add pending bit
...Q_PENDING_OFFSET) > > #endif /* __ASM_GENERIC_QSPINLOCK_TYPES_H */ > --- a/kernel/locking/qspinlock.c > +++ b/kernel/locking/qspinlock.c > @@ -83,24 +83,28 @@ static inline struct mcs_spinlock *decod > return per_cpu_ptr(&mcs_nodes[idx], cpu); > } > > +#define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) > + > /** > * queue_spin_lock_slowpath - acquire the queue spinlock > * @lock: Pointer to queue spinlock structure > * @val: Current value of the queue spinlock 32-bit word > * > - * (queue tail, lock bit) > - * > - *...
2014 Jun 17
5
[PATCH 03/11] qspinlock: Add pending bit
...Q_PENDING_OFFSET) > > #endif /* __ASM_GENERIC_QSPINLOCK_TYPES_H */ > --- a/kernel/locking/qspinlock.c > +++ b/kernel/locking/qspinlock.c > @@ -83,24 +83,28 @@ static inline struct mcs_spinlock *decod > return per_cpu_ptr(&mcs_nodes[idx], cpu); > } > > +#define _Q_LOCKED_PENDING_MASK (_Q_LOCKED_MASK | _Q_PENDING_MASK) > + > /** > * queue_spin_lock_slowpath - acquire the queue spinlock > * @lock: Pointer to queue spinlock structure > * @val: Current value of the queue spinlock 32-bit word > * > - * (queue tail, lock bit) > - * > - *...
2014 Apr 17
0
[PATCH v9 06/19] qspinlock: prolong the stay in the pending bit path
...ylock_pending(struct qspinlock *lock, u32 *pval) */ for (;;) { /* - * If we observe any contention; queue. + * If we observe that the queue is not empty, + * return and be queued. */ - if (val & ~_Q_LOCKED_MASK) + if (val & _Q_TAIL_MASK) return 0; + if ((val & _Q_LOCKED_PENDING_MASK) == + (_Q_LOCKED_VAL|_Q_PENDING_VAL)) { + /* + * If both the lock and pending bits are set, we wait + * a while to see if that either bit will be cleared. + * If that is no change, we return and be queued. + */ + if (!retry) + return 0; + retry--; + cpu_relax(); + cpu_...