linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ide: Remove in_interrupt()
@ 2020-11-13 16:10 Sebastian Andrzej Siewior
  2020-11-13 16:10 ` [PATCH 1/2] ide/Falcon: Remove in_interrupt() usage Sebastian Andrzej Siewior
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-11-13 16:10 UTC (permalink / raw)
  To: linux-ide; +Cc: Andrew Morton, Thomas Gleixner

In the discussion about preempt count consistency across kernel
configurations:

 https://lore.kernel.org/r/20200914204209.256266093@linutronix.de/

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



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

* [PATCH 1/2] ide/Falcon: Remove in_interrupt() usage.
  2020-11-13 16:10 [PATCH 0/2] ide: Remove in_interrupt() Sebastian Andrzej Siewior
@ 2020-11-13 16:10 ` Sebastian Andrzej Siewior
  2020-11-13 16:10 ` [PATCH 2/2] ide: Remove BUG_ON(in_interrupt() || irqs_disabled()) from ide_unregister() Sebastian Andrzej Siewior
  2020-11-13 16:25 ` [PATCH 0/2] ide: Remove in_interrupt() Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-11-13 16:10 UTC (permalink / raw)
  To: linux-ide
  Cc: Andrew Morton, Thomas Gleixner, Sebastian Andrzej Siewior,
	David S. Miller

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.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/ide/falconide.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c
index dbeb2605e5f6e..77af4c1a3f38c 100644
--- a/drivers/ide/falconide.c
+++ b/drivers/ide/falconide.c
@@ -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;
 	}
-- 
2.29.2


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

* [PATCH 2/2] ide: Remove BUG_ON(in_interrupt() || irqs_disabled()) from ide_unregister()
  2020-11-13 16:10 [PATCH 0/2] ide: Remove in_interrupt() Sebastian Andrzej Siewior
  2020-11-13 16:10 ` [PATCH 1/2] ide/Falcon: Remove in_interrupt() usage Sebastian Andrzej Siewior
@ 2020-11-13 16:10 ` Sebastian Andrzej Siewior
  2020-11-13 16:25 ` [PATCH 0/2] ide: Remove in_interrupt() Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-11-13 16:10 UTC (permalink / raw)
  To: linux-ide
  Cc: Andrew Morton, Thomas Gleixner, Sebastian Andrzej Siewior,
	David S. Miller

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.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/ide/ide-probe.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 1c1567bb51942..aefd74c0d8628 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -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) {
-- 
2.29.2


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

* Re: [PATCH 0/2] ide: Remove in_interrupt()
  2020-11-13 16:10 [PATCH 0/2] ide: Remove in_interrupt() Sebastian Andrzej Siewior
  2020-11-13 16:10 ` [PATCH 1/2] ide/Falcon: Remove in_interrupt() usage Sebastian Andrzej Siewior
  2020-11-13 16:10 ` [PATCH 2/2] ide: Remove BUG_ON(in_interrupt() || irqs_disabled()) from ide_unregister() Sebastian Andrzej Siewior
@ 2020-11-13 16:25 ` Jens Axboe
  2020-11-19 16:51   ` Sebastian Andrzej Siewior
  2 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-11-13 16:25 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior, linux-ide; +Cc: Andrew Morton, Thomas Gleixner

On 11/13/20 9:10 AM, Sebastian Andrzej Siewior wrote:
> In the discussion about preempt count consistency across kernel
> configurations:
> 
>  https://lore.kernel.org/r/20200914204209.256266093@linutronix.de/
> 
> 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.

Acked-by: Jens Axboe <axboe@kernel.dk>

-- 
Jens Axboe


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

* Re: [PATCH 0/2] ide: Remove in_interrupt()
  2020-11-13 16:25 ` [PATCH 0/2] ide: Remove in_interrupt() Jens Axboe
@ 2020-11-19 16:51   ` Sebastian Andrzej Siewior
  2020-11-20  1:26     ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-11-19 16:51 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-ide, Andrew Morton, Thomas Gleixner

On 2020-11-13 09:25:08 [-0700], Jens Axboe wrote:
> On 11/13/20 9:10 AM, Sebastian Andrzej Siewior wrote:
> > In the discussion about preempt count consistency across kernel
> > configurations:
> > 
> >  https://lore.kernel.org/r/20200914204209.256266093@linutronix.de/
> > 
> > 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.
> 
> Acked-by: Jens Axboe <axboe@kernel.dk>

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

Sebastian

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

* Re: [PATCH 0/2] ide: Remove in_interrupt()
  2020-11-19 16:51   ` Sebastian Andrzej Siewior
@ 2020-11-20  1:26     ` Andrew Morton
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2020-11-20  1:26 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Jens Axboe, linux-ide, Thomas Gleixner

On Thu, 19 Nov 2020 17:51:33 +0100 Sebastian Andrzej Siewior <bigeasy@linutronix.de> wrote:

> On 2020-11-13 09:25:08 [-0700], Jens Axboe wrote:
> > On 11/13/20 9:10 AM, Sebastian Andrzej Siewior wrote:
> > > In the discussion about preempt count consistency across kernel
> > > configurations:
> > > 
> > >  https://lore.kernel.org/r/20200914204209.256266093@linutronix.de/
> > > 
> > > 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.
> > 
> > Acked-by: Jens Axboe <axboe@kernel.dk>
> 
> 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?

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

end of thread, other threads:[~2020-11-20  1:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 16:10 [PATCH 0/2] ide: Remove in_interrupt() Sebastian Andrzej Siewior
2020-11-13 16:10 ` [PATCH 1/2] ide/Falcon: Remove in_interrupt() usage Sebastian Andrzej Siewior
2020-11-13 16:10 ` [PATCH 2/2] ide: Remove BUG_ON(in_interrupt() || irqs_disabled()) from ide_unregister() Sebastian Andrzej Siewior
2020-11-13 16:25 ` [PATCH 0/2] ide: Remove in_interrupt() Jens Axboe
2020-11-19 16:51   ` Sebastian Andrzej Siewior
2020-11-20  1:26     ` Andrew Morton

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).