Skip to contentSkip to conversation

ide: Remove in_interrupt()

PATCH Superseded Sebastian Andrzej Siewior 3 participants 6 messages Nov 13, 2020 – Nov 20, 2020 libata

v1 of 2 Superseded 1 of 2 applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ide: Remove in_interrupt()

In the discussion about preempt count consistency across kernel configurations:

https://lore.kernel.org/r/[email protected]/

it was concluded that the usage of in_interrupt() and related context checks should be removed from non-core code.

This ide subsystem has two in_interrupts() checks before mutex/wait-event invocations.

Sebastian

#1 lore raw

PATCH 1/2 ide/Falcon: Remove in_interrupt() usage.

falconide_get_lock() is called by ide_lock_host() and its caller (ide_issue_rq()) has already a might_sleep() check.

stdma_lock() has wait_event() which also has a might_sleep() check.

Remove the in_interrupt() check.

---
 drivers/ide/falconide.c | 2 --
 1 file changed, 2 deletions(-)
drivers/ide/falconide.c +0 -2
index dbeb2605e5f6e..77af4c1a3f38c 100644
@@ -51,8 +51,6 @@ static void falconide_release_lock(void)
 static void falconide_get_lock(irq_handler_t handler, void *data)
 {
 	if (falconide_intr_lock == 0) {
-		if (in_interrupt() > 0)
-			panic("Falcon IDE hasn't ST-DMA lock in interrupt");
 		stdma_lock(handler, data);
 		falconide_intr_lock = 1;
 	}
Signature · 1 line
2.29.2
#2 lore raw

PATCH 2/2 ide: Remove BUG_ON(in_interrupt() || irqs_disabled()) from ide_unregister()

In reply to Sebastian Andrzej Siewior

Both BUG_ON() were introduced in commit
4015c949fb465 ("[PATCH] update ide core")

when ide_unregister() was extended with semaphore based locking. Both checks won't complain about disabled preemption which is also wrong.

The might_sleep() in today's mutex_lock() will complain about the missuses.

Remove the BUG_ON() statements.

---
 drivers/ide/ide-probe.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/ide/ide-probe.c +0 -3
index 1c1567bb51942..aefd74c0d8628 100644
@@ -1539,9 +1539,6 @@ EXPORT_SYMBOL_GPL(ide_port_unregister_devices);
 
 static void ide_unregister(ide_hwif_t *hwif)
 {
-	BUG_ON(in_interrupt());
-	BUG_ON(irqs_disabled());
-
 	mutex_lock(&ide_cfg_mtx);
 
 	if (hwif->present) {
Signature · 1 line
2.29.2
Acked-by on the v1 series
#3 lore raw
In reply to Sebastian Andrzej Siewior
Quoted 10 lines · Sebastian Andrzej Siewior

In the discussion about preempt count consistency across kernel configurations:

https://lore.kernel.org/r/[email protected]/

it was concluded that the usage of in_interrupt() and related context checks should be removed from non-core code.

This ide subsystem has two in_interrupts() checks before mutex/wait-event invocations.

Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 6 lines · Jens Axboe
Quoted 5 lines · Sebastian Andrzej Siewior

In the discussion about preempt count consistency across kernel configurations:

https://lore.kernel.org/r/[email protected]/

Quoted 7 lines
Quoted 5 lines

it was concluded that the usage of in_interrupt() and related context checks should be removed from non-core code.

This ide subsystem has two in_interrupts() checks before mutex/wait-event invocations.

Andrew, are you okay with routing these two patches via your tree?

Sebastian

#5 lore raw
Quoted 10 lines · On Thu, 19 Nov 2020 17:51:33 +0100 Sebastian Andrzej Siewior…
Quoted 9 lines · Jens Axboe
Quoted 8 lines · Sebastian Andrzej Siewior

In the discussion about preempt count consistency across kernel configurations:

https://lore.kernel.org/r/[email protected]/

it was concluded that the usage of in_interrupt() and related context checks should be removed from non-core code.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This ide subsystem has two in_interrupts() checks before mutex/wait-event invocations.

Andrew, are you okay with routing these two patches via your tree?

Sure, but I'm not subscribed to linux-ide. Please resend, cc myself and linux-kernel?