Hi - I'm having a problem with my USB CD burner that involves spinlocks - in particular, some code that trys to grab a spinlock that's already locked (this on a uni-processor machine). The existing spinlock debug code on intel only checked for unlocking an unlocked spinlock, so I added code to check for locking a locked spinlock as well - it now catches my problem. I'm attaching the code. The basic operation is to add a field (when SPINLOCK_DEBUG is set in include/asm-i386/spinlock.h; no config option) to the spinlock structure that contains the processor ID that set the lock. Then, when we try to grab the lock, check to see if 1) it's already locked and 2) the current processor is the one that holds the lock. I've had to add some hideous code to get the processor ID: #define my_processor_id (((int *)current)[13]) since sched.h includes spinlock.h, so task_struct isn't defined when this file is parsed, so we can't just dereference current to find the processor ID. Any better suggestions would be welcome. The code also adds fields to record the PC and current task_struct when the lock is grabbed, so if somebody comes along later and trys to grab it again, we can figure out who already has it. This information doesn't show up in a oops, but is easily extracted using remote gdb (see my previous post). Try it if you'd like; it's not very complex, but I would like a better solution for getting the processor ID before I make it an "official" submission to Linus. -- -bwb Brent Baccala baccala@freesoft.org ============================================================================== For news from freesoft.org, subscribe to announce@freesoft.org: mailto:announce-request@freesoft.org?subject=subscribe&body=subscribe ==============================================================================