FreeBSD/sys/kern/subr_witness.c
/*
 * This is a bit risky at best.  We call this function when we have timed
 * out acquiring a spin lock, and we assume that the other CPU is stuck
 * with this lock held.  So, we go groveling around in the other CPU's
 * per-cpu data to try to find the lock instance for this spin lock to
 * see when it was last acquired.
 */
This is a bit risky at best.  We call this function when we have timed
out acquiring a spin lock, and we assume that the other CPU is stuck
with this lock held.  So, we go groveling around in the other CPU's
per-cpu data to try to find the lock instance for this spin lock to
see when it was last acquired.
This is a bit risky at best . We call this function when we have timed out acquiring a spin lock and we assume that the other CPU is stuck with this lock held . So we go groveling around in the other CPU ' s per - cpu data to try to find the lock instance for this spin lock to see when it was last acquired .
void
witness_display_spinlock(struct lock_object *lock, struct thread *owner,
    int (*prnt)(const char *fmt, ...))
{
	struct lock_instance *instance;
	struct pcpu *pc;
	if (owner->td_critnest == 0 || owner->td_oncpu == NOCPU)
		return;
	pc = pcpu_find(owner->td_oncpu);
	instance = find_instance(pc->pc_spinlocks, lock);
	if (instance != NULL)
		witness_list_lock(instance, prnt);
}
void witness_display_spinlock ( struct lock_object * lock , struct thread * owner , int ( * prnt ) ( const char * fmt , ... ) ) { struct lock_instance * instance ; struct pcpu * pc ; if ( owner -> td_critnest == 0 || owner -> td_oncpu == NOCPU ) return ; pc = pcpu_find ( owner -> td_oncpu ) ; instance = find_instance ( pc -> pc_spinlocks , lock ) ; if ( instance != NULL ) witness_list_lock ( instance , prnt ) ; }
This is a bit risky at best.
This is a bit risky at best .