Hi Boris,
On 24/02/17 16:15, Boris Ostrovsky wrote:
Looking at
void _spin_lock(spinlock_t *lock)
{
spinlock_tickets_t tickets = SPINLOCK_TICKET_INC;
LOCK_PROFILE_VAR;
check_lock(&lock->debug);
tickets.head_tail = arch_fetch_and_add(&lock->tickets.head_tail,
tickets.head_tail);
while ( tickets.tail != observe_head(&lock->tickets) )
{
LOCK_PROFILE_BLOCK;
arch_lock_relax();
}
LOCK_PROFILE_GOT;
preempt_disable();
arch_lock_acquire_barrier();
}
If the lock is dropped during LOCK_PROFILE_BLOCK, isn't there a chance
that we are never woken up from arch_lock_relax()? (This would only be
an issue on ARM which IIUIC sleeps there).
The function arch_lock_signal will broadcast the event to all the
processors and each of them will record the event. This event will be
only cleared by a WFE (the implementation of arch_lock_acquire_barrier).
This means that if the event was happening during LOCK_PROFILE_BLOCK,
the processor will not go to sleep and try again.
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel