Skip to contentSkip to conversation

blk-mq: fix blk_mq_start_stopped_hw_queues from irq context

PATCH Applied Christoph Hellwig 2 participants 3 messages Oct 6, 2013 – Oct 7, 2013 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-mq: fix blk_mq_start_stopped_hw_queues from irq context

The only caller of blk_mq_start_stopped_hw_queues is in irq context, leading to lockdep splat when it actually gets called. Fix this by deferring the hw queue run to workqueue context.

block/blk-mq.c +2 -1
index 2b85029..923e9e1 100644
@@ -686,7 +686,8 @@ void blk_mq_start_stopped_hw_queues(struct request_queue *q)
 		if (!test_bit(BLK_MQ_S_STOPPED, &hctx->state))
 			continue;
 
-		blk_mq_start_hw_queue(hctx);
+		clear_bit(BLK_MQ_S_STOPPED, &hctx->state);
+		blk_mq_run_hw_queue(hctx, true);
 	}
 }
 EXPORT_SYMBOL(blk_mq_start_stopped_hw_queues);
maintainer Applied
#1 lore raw
Quoted 11 lines · Christoph Hellwig

The only caller of blk_mq_start_stopped_hw_queues is in irq context, leading to lockdep splat when it actually gets called. Fix this by deferring the hw queue run to workqueue context.

block/blk-mq.c +0 -0
index 2b85029..923e9e1 100644

block/blk-mq.c void blk_mq_start_stopped_hw_queues(struct request_queue *q) · line 693

Quoted 9 lines
block/blk-mq.c +2 -1
@@ -686,7 +686,8 @@ void blk_mq_start_stopped_hw_queues(struct request_queue *q)
 		if (!test_bit(BLK_MQ_S_STOPPED, &hctx->state))
 			continue;
 
-		blk_mq_start_hw_queue(hctx);
+		clear_bit(BLK_MQ_S_STOPPED, &hctx->state);
+		blk_mq_run_hw_queue(hctx, true);
 	}
 }
 EXPORT_SYMBOL(blk_mq_start_stopped_hw_queues);

Thanks, applied. Might not be a bad idea to just mimic the run queue API, and provide a blk_mq_start_hw_queue(hctx, is_async) instead.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 2 lines · Jens Axboe

Thanks, applied. Might not be a bad idea to just mimic the run queue API, and provide a blk_mq_start_hw_queue(hctx, is_async) instead.

I have to see I really don't like this is_async, I'd much preper to untangle those into separate versions further up the stack similar to how the old blk_run_queue variants work.

But that'll have to wait a bit anyway, at least until you made a decision on the plugging patch.