Date: Sat, 13 Sep 2008 17:17:04 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 149717 for review Message-ID: <200809131717.m8DHH4Dl039197@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149717 Change 149717 by hselasky@hselasky_laptop001 on 2008/09/13 17:16:08 Integrate some files because the problems I've tried to fix have been fixed. And the fixes are not inter compatible. That means you will get a panic with the P4 USB kernel unless you have this change included, after my last IFC. Affected files ... .. //depot/projects/usb/src/sys/kern/kern_condvar.c#9 integrate .. //depot/projects/usb/src/sys/kern/kern_synch.c#12 integrate .. //depot/projects/usb/src/sys/kern/subr_bus.c#12 integrate .. //depot/projects/usb/src/sys/sys/mutex.h#9 integrate Differences ... ==== //depot/projects/usb/src/sys/kern/kern_condvar.c#9 (text+ko) ==== @@ -124,7 +124,7 @@ sleepq_lock(cvp); cvp->cv_waiters++; - DROP_GIANT(lock); + DROP_GIANT(); sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR, 0); if (lock != &Giant.lock_object) { @@ -183,7 +183,7 @@ sleepq_lock(cvp); cvp->cv_waiters++; - DROP_GIANT(lock); + DROP_GIANT(); sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR, 0); if (class->lc_flags & LC_SLEEPABLE) @@ -241,7 +241,7 @@ sleepq_lock(cvp); cvp->cv_waiters++; - DROP_GIANT(lock); + DROP_GIANT(); sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR | SLEEPQ_INTERRUPTIBLE, 0); @@ -306,7 +306,7 @@ sleepq_lock(cvp); cvp->cv_waiters++; - DROP_GIANT(lock); + DROP_GIANT(); sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR, 0); sleepq_set_timeout(cvp, timo); @@ -374,7 +374,7 @@ sleepq_lock(cvp); cvp->cv_waiters++; - DROP_GIANT(lock); + DROP_GIANT(); sleepq_add(cvp, lock, cvp->cv_description, SLEEPQ_CONDVAR | SLEEPQ_INTERRUPTIBLE, 0); ==== //depot/projects/usb/src/sys/kern/kern_synch.c#12 (text+ko) ==== @@ -181,7 +181,7 @@ CTR5(KTR_PROC, "sleep: thread %ld (pid %ld, %s) on %s (%p)", td->td_tid, p->p_pid, td->td_name, wmesg, ident); - DROP_GIANT(lock); + DROP_GIANT(); if (lock != NULL && lock != &Giant.lock_object && !(class->lc_flags & LC_SLEEPABLE)) { WITNESS_SAVE(lock, lock_witness); ==== //depot/projects/usb/src/sys/kern/subr_bus.c#12 (text+ko) ==== ==== //depot/projects/usb/src/sys/sys/mutex.h#9 (text+ko) ==== @@ -366,44 +366,17 @@ * * Note that DROP_GIANT*() needs to be paired with PICKUP_GIANT() * The #ifndef is to allow lint-like tools to redefine DROP_GIANT. - * - * Note that by default DROP_GIANT takes no argument. Optionally you - * can specify an argument which explicitly has the name "lock" and - * type "struct lock_object *". If this "lock" pointer is equal to - * "&Giant", the DROP_GIANT macro will not do the final drop on the - * Giant mutex, but expects the calling code to do so. This feature is - * used by condition variables to allow sleeping on Giant. The - * condition variable code will then do the final drop! */ #ifndef DROP_GIANT -#define DROP_GIANT(arg) DROP_GIANT_SUB_##arg(arg) -#define DROP_GIANT_SUB_lock(arg) DROP_GIANT_SUB(arg) /* "lock" argument */ -#define DROP_GIANT_SUB_(arg) DROP_GIANT_SUB(NULL) /* no argument */ -#define DROP_GIANT_SUB(lock) \ +#define DROP_GIANT() \ do { \ - unsigned int _giantcnt; \ + int _giantcnt = 0; \ WITNESS_SAVE_DECL(Giant); \ \ if (mtx_owned(&Giant)) { \ - unsigned int _giantn; \ - if (((void *)(lock)) == ((void *)&Giant)) { \ - /* special case */ \ - _giantn = Giant.mtx_recurse; \ - } else { \ - /* default case */ \ - _giantn = Giant.mtx_recurse + 1; \ - } \ - if (_giantn != 0) { \ - WITNESS_SAVE(&Giant.lock_object, Giant); \ - _giantcnt = _giantn; \ - do { \ - mtx_unlock(&Giant); \ - } while (--_giantn); \ - } else { \ - _giantcnt = 0; \ - } \ - } else { \ - _giantcnt = 0; \ + WITNESS_SAVE(&Giant.lock_object, Giant); \ + for (_giantcnt = 0; mtx_owned(&Giant); _giantcnt++) \ + mtx_unlock(&Giant); \ } #define PICKUP_GIANT() \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809131717.m8DHH4Dl039197>