PERFORCE change 88897 for review
John Baldwin
jhb at FreeBSD.org
Thu Dec 29 11:36:25 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=88897
Change 88897 by jhb at jhb_slimer on 2005/12/29 19:35:53
Support spinlocks in witness_save and witness_restore and turn that
part of msleep_spin() back on.
Affected files ...
.. //depot/projects/smpng/sys/kern/kern_synch.c#95 edit
.. //depot/projects/smpng/sys/kern/subr_witness.c#144 edit
Differences ...
==== //depot/projects/smpng/sys/kern/kern_synch.c#95 (text+ko) ====
@@ -251,9 +251,7 @@
struct thread *td;
struct proc *p;
int rval;
-#if 0
WITNESS_SAVE_DECL(mtx);
-#endif
td = curthread;
p = td->td_proc;
@@ -279,9 +277,7 @@
DROP_GIANT();
mtx_assert(mtx, MA_OWNED | MA_NOTRECURSED);
-#if 0
WITNESS_SAVE(&mtx->mtx_object, mtx);
-#endif
mtx_unlock_spin(mtx);
/*
@@ -323,9 +319,7 @@
#endif
PICKUP_GIANT();
mtx_lock_spin(mtx);
-#if 0
WITNESS_RESTORE(&mtx->mtx_object, mtx);
-#endif
return (rval);
}
==== //depot/projects/smpng/sys/kern/subr_witness.c#144 (text+ko) ====
@@ -1805,15 +1805,20 @@
void
witness_save(struct lock_object *lock, const char **filep, int *linep)
{
+ struct lock_list_entry *lock_list;
struct lock_instance *instance;
KASSERT(!witness_cold, ("%s: witness_cold", __func__));
if (lock->lo_witness == NULL || witness_watch == 0 || panicstr != NULL)
return;
- if ((lock->lo_class->lc_flags & LC_SLEEPLOCK) == 0)
- panic("%s: lock (%s) %s is not a sleep lock", __func__,
- lock->lo_class->lc_name, lock->lo_name);
- instance = find_instance(curthread->td_sleeplocks, lock);
+ if (lock->lo_class->lc_flags & LC_SLEEPLOCK)
+ lock_list = curthread->td_sleeplocks;
+ else {
+ if (witness_skipspin)
+ return;
+ lock_list = PCPU_GET(spinlocks);
+ }
+ instance = find_instance(lock_list, lock);
if (instance == NULL)
panic("%s: lock (%s) %s not locked", __func__,
lock->lo_class->lc_name, lock->lo_name);
@@ -1824,15 +1829,20 @@
void
witness_restore(struct lock_object *lock, const char *file, int line)
{
+ struct lock_list_entry *lock_list;
struct lock_instance *instance;
KASSERT(!witness_cold, ("%s: witness_cold", __func__));
if (lock->lo_witness == NULL || witness_watch == 0 || panicstr != NULL)
return;
- if ((lock->lo_class->lc_flags & LC_SLEEPLOCK) == 0)
- panic("%s: lock (%s) %s is not a sleep lock", __func__,
- lock->lo_class->lc_name, lock->lo_name);
- instance = find_instance(curthread->td_sleeplocks, lock);
+ if (lock->lo_class->lc_flags & LC_SLEEPLOCK)
+ lock_list = curthread->td_sleeplocks;
+ else {
+ if (witness_skipspin)
+ return;
+ lock_list = PCPU_GET(spinlocks);
+ }
+ instance = find_instance(lock_list, lock);
if (instance == NULL)
panic("%s: lock (%s) %s not locked", __func__,
lock->lo_class->lc_name, lock->lo_name);
More information about the p4-projects
mailing list