Fix SMP support on cdu535 cdrom driver
PATCH 1/1 Fix SMP support on cdu535 cdrom driver
Hi,
Patch against 2.6-test4.
I'm not sure this is the right fix, since my knowledge on cdrom
drivers tends to /dev/zero...but, here we go:
Replace cli/sti on sony_sleep with wait_queue, using a device
spinlock to lock 'enable_interrupts' and the queueing stuff.
Compile fine, but I don't have the hardware.
Feedback is welcome, since I'm pretty sure I did something wrong.. :)
Thanks,
Felipe
drivers/cdrom/sonycd535.c +16 -3
@@ -36,6 +36,10 @@* module_init & module_exit. * Torben Mathiasen <[email protected]> * +* September 2003 - Fix SMP support by removing cli/sti calls. +* Using spinlocks with a wait_queue instead +* Felipe Damasio <[email protected]> +* * Things to do: * - handle errors and status better, put everything into a single word * - use interrupts (code mostly there, but a big hole still missing)
@@ -219,6 +223,9 @@static unsigned short data_reg;static spinlock_t sonycd535_lock =SPIN_LOCK_UNLOCKED ;/* queue lock */ + +static spinlock_t cdu535_lock =SPIN_LOCK_UNLOCKED ;/* Device lock */ +static struct request_queue *sonycd535_queue;static int initialized;/* Has the drive been initialized? */
@@ -340,10 +347,16 @@if (sony535_irq_used <=0 ) {/* poll */ yield (); }else {/* Interrupt driven */ -cli (); +DEFINE_WAIT (wait); + +spin_lock_irq (&cdu535_lock);enable_interrupts (); -interruptible_sleep_on (&cdu535_irq_wait); -sti (); +prepare_to_wait (&cdu535_irq_wait, &wait,TASK_INTERRUPTIBLE ); +spin_unlock_irq (&cdu535_lock); +schedule (); +spin_lock_irq (&cdu535_lock); +finish_wait (&cdu535_irq_wait, &wait); +spin_unlock_irq (&cdu535_lock); } }
Quoted 9 lines · Felipe W Damasio
Hi,
Patch against 2.6-test4.
I'm not sure this is the right fix, since my knowledge on cdrom
drivers tends to/dev/zero...but, here we go:Replace cli/sti on
sony_sleepwithwait_queue, using a device
spinlock to lock 'enable_interrupts' and the queueing stuff.
Which it based from workqueue::flush_workqueue, but I don't know if
the same algorithm applies to this block driver.
Could someone with more experience on block drivers review this?
Thanks.
Felipe