public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix SMP support in cdu535 cdrom driver
@ 2003-10-08 19:24 Felipe W Damasio
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe W Damasio @ 2003-10-08 19:24 UTC (permalink / raw)
  To: axboe; +Cc: willy, linux-kernel, Kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

	Hi Jens,

	Patch against 2.6.0-test6.

	Even though cdu535 is polled, not interrupt driven, Matthew pointed 
out[1] that is a good idea to fix SMP support on that bit, so that 
people who wants to fix cdu31a don't get that wrong.

	Move prepare_to_wait before enable_interrupts, so that if we enter 
the interrupt handler (after enable_interrupts) on a different CPU 
that's executing sony_sleep's poll version, "wait" is already on the 
irq_wait list, which I think fixes the race that Matthew pointed out, 
doesn't it?

	CC'ing kernel-janitors since it also replaces yield for 
schedule_timeout[2], as Matthew suggested.

	Please consider applying.

	Thanks,

Felipe

[1] http://marc.theaimsgroup.com/?l=linux-kernel&m=106322465303649&w=2

[2] 
http://lists.osdl.org/pipermail/kernel-janitors/2003-October/000173.html

[-- Attachment #2: sonycd535-yield.patch --]
[-- Type: text/plain, Size: 639 bytes --]

--- linux-2.6.0-test6/drivers/cdrom/sonycd535.c.orig	2003-10-08 14:42:43.000000000 -0300
+++ linux-2.6.0-test6/drivers/cdrom/sonycd535.c	2003-10-08 16:00:09.000000000 -0300
@@ -342,13 +342,14 @@
 sony_sleep(void)
 {
 	if (sony535_irq_used <= 0) {	/* poll */
-		yield();
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule_timeout(1);
 	} else {	/* Interrupt driven */
 		DEFINE_WAIT(wait);
-		
+
 		spin_lock_irq(&sonycd535_lock);
-		enable_interrupts();
 		prepare_to_wait(&cdu535_irq_wait, &wait, TASK_INTERRUPTIBLE);
+		enable_interrupts();
 		spin_unlock_irq(&sonycd535_lock);
 		schedule();
 		finish_wait(&cdu535_irq_wait, &wait);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] fix SMP support in cdu535 cdrom driver
@ 2003-10-08 19:25 Felipe W Damasio
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe W Damasio @ 2003-10-08 19:25 UTC (permalink / raw)
  To: axboe; +Cc: willy, linux-kernel, Kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

	Hi Jens,

	Patch against 2.6.0-test6.

	Even though cdu535 is polled, not interrupt driven, Matthew pointed 
out[1] that is a good idea to fix SMP support on that bit, so that 
people who wants to fix cdu31a don't get that wrong.

	Move prepare_to_wait before enable_interrupts, so that if we enter 
the interrupt handler (after enable_interrupts) on a different CPU 
that's executing sony_sleep's poll version, "wait" is already on the 
irq_wait list, which I think fixes the race that Matthew pointed out, 
doesn't it?

	CC'ing kernel-janitors since it also replaces yield for
schedule_timeout[2], as Matthew suggested.

	Please consider applying.

	Thanks,

Felipe

[1]http://marc.theaimsgroup.com/?l=linux-kernel&m=106322465303649&w=2

[2]http://lists.osdl.org/pipermail/kernel-janitors/2003-October/000173.html


[-- Attachment #2: sonycd535-yield.patch --]
[-- Type: text/plain, Size: 640 bytes --]

--- linux-2.6.0-test6/drivers/cdrom/sonycd535.c.orig	2003-10-08 14:42:43.000000000 -0300
+++ linux-2.6.0-test6/drivers/cdrom/sonycd535.c	2003-10-08 16:00:09.000000000 -0300
@@ -342,13 +342,14 @@
 sony_sleep(void)
 {
 	if (sony535_irq_used <= 0) {	/* poll */
-		yield();
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule_timeout(1);
 	} else {	/* Interrupt driven */
 		DEFINE_WAIT(wait);
-		
+
 		spin_lock_irq(&sonycd535_lock);
-		enable_interrupts();
 		prepare_to_wait(&cdu535_irq_wait, &wait, TASK_INTERRUPTIBLE);
+		enable_interrupts();
 		spin_unlock_irq(&sonycd535_lock);
 		schedule();
 		finish_wait(&cdu535_irq_wait, &wait);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-08 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-08 19:25 [PATCH] fix SMP support in cdu535 cdrom driver Felipe W Damasio
  -- strict thread matches above, loose matches on Subject: below --
2003-10-08 19:24 Felipe W Damasio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox