Skip to contentSkip to conversation

ide_release_lock: bug

DISCUSSION Geert Uytterhoeven 2 participants 2 messages Jun 29, 2008 – Jun 30, 2008 3 messages not in the archive libata

lore
Share & tools
lore
#3 lore raw
In reply to a message not in the archive

[ Background for linux-ide: ide_release_lock() spits out lots of

ide_release_lock: bug

warnings on Atari Falcon ]

Quoted 23 lines · Michael Schmitz

The following patch does, indeed, fix the ide_release_lock imbalance. No more warnings.

ide/ide-io.c renamed from ide/ide-io.c.orig +2 -3
@@ -1075,14 +1075,13 @@
 	ide_startstop_t	startstop;
 	int             loops = 0;
 
-	/* for atari only: POSSIBLY BROKEN HERE(?) */
-	ide_get_lock(ide_intr, hwgroup);
-
 	/* caller must own ide_lock */
 	BUG_ON(!irqs_disabled());
 
 	while (!hwgroup->busy) {
 		hwgroup->busy = 1;
+		/* for atari only */
+		ide_get_lock(ide_intr, hwgroup);
 		drive = choose_drive(hwgroup);
 		if (drive == NULL) {
 			int sleeping = 0;
Quoted 4 lines
Signed-off-by <[email protected]>
Quoted 2 lines

We release the lock just before hwgroup->busy is cleared, so it should be logical to get hold of the lock just after hwgroup->busy was set, no?

If hwgroup->busy serves a similar purpose to falconide_intr_lock, what about moving the setting/clearing of hwgroup->busy into ide_{get,release}_lock() (and possibly renaming ide_{get,release}_lock() to e.g. ide_hwgroup_{set,clear}_busy())?

What about the other places where hwgroup->busy is set/cleared?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw

Hi,

Quoted 9 lines

[ Background for linux-ide: ide_release_lock() spits out lots of

ide_release_lock: bug

warnings on Atari Falcon ]

Quoted 2 lines · Michael Schmitz

The following patch does, indeed, fix the ide_release_lock imbalance. No more warnings.

[ ... ]

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines

We release the lock just before hwgroup->busy is cleared, so it should be logical to get hold of the lock just after hwgroup->busy was set, no?

If hwgroup->busy serves a similar purpose to falconide_intr_lock, what about moving the setting/clearing of hwgroup->busy into ide_{get,release}_lock() (and possibly renaming ide_{get,release}_lock() to e.g. ide_hwgroup_{set,clear}_busy())?

What about the other places where hwgroup->busy is set/cleared?

Uh - that's where it gets a bit sticky again. hwgroup->busy is set and cleared quite a lot 'preemptively' all over ide-io.c, f.e. in timeout handling. I'm not sure whether this would just reintroduce the bug message.

The lock must be held as long as there are any interrupts to be expected from IDE. If the hwgroup->busy semantics reflects just that, it's worth a try.

Michael