Date: Wed, 07 May 2003 09:44:12 -0500 From: Greg <greg@codeconcepts.com> To: John Baldwin <jhb@FreeBSD.org> Cc: freebsd-smp@FreeBSD.org Subject: Re: spinlocks and cv_wait() Message-ID: <200305071444.h47EiCvZ096249@gromit.codeconcepts.com> In-Reply-To: Message from John Baldwin <jhb@FreeBSD.org> <XFMail.20030506153256.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> > Because the bottom half is a disk I/O interrupt handler, I presume the > > mutex must be of the MTX_SPIN variety, and therein is the problem. The > > top half acquires the mutex, checks the condition, and then calls cv_wait() > > if the condition is not met. Unfortunately, cv_wait() checks that the > > mutex is of the sleeping variety and trips an assert because it isn't > > (at kern_condvar.c line 240). > > Your first assumption here is wrong. Interrupt handlers run in a (mostly) > top-half context and are allowed to use normal mutexes. MTX_SPIN mutexes > should be avoided when possible. Thanks for the clarification. The mtx_init man page said as much, but I wasn't 100% certain. Of course I had tried MTX_DEF, but then the machine crashed in seemingly unrelated code, so I couldn't be certain which usage was correct. -- The comfort of a knowledge of the rise above the sky above could never parallel the challenge of an acquisition in the here and now
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305071444.h47EiCvZ096249>