linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ide__sti usage
@ 2002-07-07 10:54 Zwane Mwaikambo
  2002-07-07 17:13 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 3+ messages in thread
From: Zwane Mwaikambo @ 2002-07-07 10:54 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Martin Dalecki, Linux Kernel

Hi Bart, Martin
	I'm seeing a number of deadlocks, most of them due to ide__sti 
enabling interrupts in a critical section which needs to be protected 
against interrupts too.

Another dangerous scenario is the following, from here the usage of 
ide__sti becomes questionable.

queue_commands() {
	ide__sti();
	start_request();
}
...
start_request() {
	spin_unlock_irq();
	frob_ide();
	spin_lock_irq();
}

and also;

if (ch->unmask)
	ide__sti();	/* local CPU only */

/* service this interrupt, may set handler for next interrupt */
startstop = handler(drive, drive->rq);
spin_lock_irq(ch->lock);

If someone can explain to me what ide__sti really is trying to achieve 
i'd greatly appreciate it.

Regards,
	Zwane Mwaikambo

-- 
function.linuxpower.ca


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

* Re: ide__sti usage
  2002-07-07 10:54 ide__sti usage Zwane Mwaikambo
@ 2002-07-07 17:13 ` Bartlomiej Zolnierkiewicz
  2002-07-07 18:35   ` Zwane Mwaikambo
  0 siblings, 1 reply; 3+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2002-07-07 17:13 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Bartlomiej Zolnierkiewicz, Martin Dalecki, Linux Kernel


On Sun, 7 Jul 2002, Zwane Mwaikambo wrote:

> Hi Bart, Martin
> 	I'm seeing a number of deadlocks, most of them due to ide__sti
> enabling interrupts in a critical section which needs to be protected
> against interrupts too.

I'm seeing blue sky ;-)
Which IDE patch?

> Another dangerous scenario is the following, from here the usage of
> ide__sti becomes questionable.
>
> queue_commands() {
> 	ide__sti();
> 	start_request();
> }
> ...
> start_request() {
> 	spin_unlock_irq();
> 	frob_ide();

Whats that?

> 	spin_lock_irq();
> }
>
> and also;
>
> if (ch->unmask)
> 	ide__sti();	/* local CPU only */
>
> /* service this interrupt, may set handler for next interrupt */
> startstop = handler(drive, drive->rq);
> spin_lock_irq(ch->lock);
>
> If someone can explain to me what ide__sti really is trying to achieve
> i'd greatly appreciate it.

ide_sti() its just __sti() (except atari).
Note that ide_do_request() is called under spin_lock_irqsave(ch->lock,
flags). We have to unlock or we will get deadlock - imagine we are holding
lock and we get irq (shared irq, unexpected one) and we try to lock in
ata_irq_request() -> deadlock.

Also for most code in start_request() we dont need lock, we need it only
for calling block layer helpers, changing/reading IDE_BUSY bit and
ch->handler, timer and drive->rq.

Also we cannot disable interrupts, because we wont know when drive is
interrupting us, missed irqs.

Please also read my previous mails to Alex...

Regards
--
Bartlomiej

> Regards,
> 	Zwane Mwaikambo
>
> --
> function.linuxpower.ca
>


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

* Re: ide__sti usage
  2002-07-07 17:13 ` Bartlomiej Zolnierkiewicz
@ 2002-07-07 18:35   ` Zwane Mwaikambo
  0 siblings, 0 replies; 3+ messages in thread
From: Zwane Mwaikambo @ 2002-07-07 18:35 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz; +Cc: Martin Dalecki, Linux Kernel

On Sun, 7 Jul 2002, Bartlomiej Zolnierkiewicz wrote:

> Also for most code in start_request() we dont need lock, we need it only
> for calling block layer helpers, changing/reading IDE_BUSY bit and
> ch->handler, timer and drive->rq.
> 
> Also we cannot disable interrupts, because we wont know when drive is
> interrupting us, missed irqs.

Thanks that explains quite a bit.

Cheers,
	Zwane Mwaikambo

-- 
function.linuxpower.ca


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

end of thread, other threads:[~2002-07-07 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-07 10:54 ide__sti usage Zwane Mwaikambo
2002-07-07 17:13 ` Bartlomiej Zolnierkiewicz
2002-07-07 18:35   ` Zwane Mwaikambo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).