Skip to contentSkip to conversation

cli/sti removal from linux-2.5.29/drivers/ide?

DISCUSSION Adam J. Richter 2 participants 2 messages Jul 29, 2002 – Jul 30, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines
Quoted 3 lines

With this change, I believe I can remove all of the
cli()...restore_flags() pairs from the channel->tuneproc functions of each IDE driver. I have also removed what appear to be some

Some tuning locks are needed because an interrupt during the magic tuning sequence will break stuff

	Let me make sure I understand your statement properly.

	Under my patch, ch->tuneproc is called with interrupts disabled and

ch->lock held, except when when channel_probe in drivers/ide/probe.c is initially trying to detect IDE hardware. The IO ports are already reserved at that time, so nothing else should poke at those registers, but interrupts are enabled.

If I understand you correctly, you are saying that an
interrupt that does something completely unrelated can screw up the ch->tuneproc function, even though the effect is just to introduce a delay and cause a bunch of unrelated system bus activity. Is this really true? Is it some kind of timing sensitivity?

Anyhow, if it is a problem, then it should be sufficient for
me to bracket the ch->tuneproc call in channel_probe with local_irq_save()...local_irq_restore(). Nothing else will actually touch the IO ports at that stage (they have been reserved, but the IDE devices have not been registered, so nothing will try to access them).

That said, I think all the "lock group" logic in drivers/ide
may be useless, and it would be pretty straightforward to delete all that code, have ata_channel->lock be a lock rather than a pointer to one, and have it be initialized before that first call to ch->tuneproc, in which case we could just have interrupts off and ch->lock held in all cases when ch->tuneproc is called. I did not want to do this in my patch, because I wanted to keep my patch as small as possible, but perhaps it would be worth doing now just to simplify the rules for calling ch->tuneproc.

Quoted 8 lines

g is ready, program the new timings

Review

Quoted 4 lines
(quoted diff) +1 -1
 	 */
-	spin_lock(&cmd640_lock, flags);
+	spin_lock_irqsave(&cmd640_lock, flags);
 	/*

For the CMD640 please see the patch I posted. It has to use pci_lock and it needs other 2.4 fixes forward porting which I did

I had looked at it. It looked mostly indepenent of what I was
doing, I thought that perhaps Martin [M: do you prefer Marcin?] might have already integrated it and it would just cause confusion for me to merge the patch in, but I would be happy to include your cmd640 changes in my patch.

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +2 -2
-	save_flags(flags);
-	cli();	/* all CPUs (there should only be one CPU with this chipset) */
+	local_irq_save(flags); /* There should only be one CPU with this
+				  chipset. */

Not needed that I can see. It also wants to use the proper master/mwi functions. I've got a diff for this I can post.

Now that you've made me learn what "memory write invalidate enable"
PCI transactions are, yes, please post or send me your diff. If you think I should try to integrate. Martin, if you have a strong preference on whether you want this stuff as a series of small diffs or if its OK to merge them into a one diff, please let me know.

Adam J. Richter     __     ______________   575 Oroville Road
[email protected]     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America

"Free Software For The Rest Of Us."

#1 lore raw
Quoted 9 lines · Adam J. Richter
Quoted 7 lines
Quoted 3 lines

With this change, I believe I can remove all of the
cli()...restore_flags() pairs from the channel->tuneproc functions of each IDE driver. I have also removed what appear to be some

Some tuning locks are needed because an interrupt during the magic tuning sequence will break stuff

Quoted 7 lines
	Let me make sure I understand your statement properly.

	Under my patch, ch->tuneproc is called with interrupts disabled and

ch->lock held, except when when channel_probe in drivers/ide/probe.c is initially trying to detect IDE hardware. The IO ports are already reserved at that time, so nothing else should poke at those registers, but interrupts are enabled.

Right.

Quoted 9 lines

That said, I think all the "lock group" logic in drivers/ide
may be useless, and it would be pretty straightforward to delete all that code, have ata_channel->lock be a lock rather than a pointer to one, and have it be initialized before that first call to ch->tuneproc, in which case we could just have interrupts off and ch->lock held in all cases when ch->tuneproc is called. I did not want to do this in my patch, because I wanted to keep my patch as small as possible, but perhaps it would be worth doing now just to simplify the rules for calling ch->tuneproc.

Not quite. It's not that easy becouse the same lock is used by the BIO layer to synchronize between for example master and slave devices.
There are other problems with this but right now you can hardly do something about it.

Quoted 10 lines
Quoted 3 lines

For the CMD640 please see the patch I posted. It has to use pci_lock and it needs other 2.4 fixes forward porting which I did

I had looked at it. It looked mostly indepenent of what I was
doing, I thought that perhaps Martin [M: do you prefer Marcin?] might have already integrated it and it would just cause confusion for me to merge the patch in, but I would be happy to include your cmd640 changes in my patch.

Yes - next round.

Quoted 5 lines

Now that you've made me learn what "memory write invalidate enable"
PCI transactions are, yes, please post or send me your diff. If you think I should try to integrate. Martin, if you have a strong preference on whether you want this stuff as a series of small diffs or if its OK to merge them into a one diff, please let me know.

Please just send me a single diff against 2.5.29 + 108 + 109 just posted. This would make me happy. Thanks.