blk-mq: fix blk_mq_tagset_busy_iter
Subsystems (2)
PATCH 1/1 blk-mq: fix blk_mq_tagset_busy_iter
Commit d250bf4e776ff09d5("blk-mq: only iterate over inflight requests in blk_mq_tagset_busy_iter") uses 'blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT' to replace 'blk_mq_request_started(req)', this way is wrong, and causes lots of test system hang during booting.
Fix the issue by using blk_mq_request_started(req) inside bt_tags_iter().
--- block/blk-mq-tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq-tag.c +1 -1
@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)* test and set the bit before assining ->rqs[]. */ rq = tags->rqs[bitnr]; -if (rq &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if (rq &&blk_mq_request_started (rq)) iter_data->fn (rq, iter_data->data, reserved);return true;
Signature · 1 line
2.9.5
James Bottomley
maintainerQuoted 34 lines · Ming Lei
Commit
d250bf4e776ff09d5("blk-mq: only iterate over inflight requests in blk_mq_tagset_busy_iter")uses 'blk_mq_rq_state(rq)==MQ_RQ_IN_FLIGHT'
to replace 'blk_mq_request_started(req)', this way is wrong, and causes
lots of test system hang during booting.Fix the issue by using
blk_mq_request_started(req)insidebt_tags_iter().Fixes d250bf4e776ff09d5 ("blk-mq: only iterate over inflightrequests in
blk_mq_tagset_busy_iter")Cc Josef Bacik <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Guenter Roeck <[email protected]>Cc Mark Brown <[email protected]>Cc Matt Hart <[email protected]>Cc Johannes Thumshirn <[email protected]>Cc John Garry <[email protected]>Cc Hannes Reinecke <[email protected]>,Cc "Martin K. Petersen" <[email protected]>,Cc James Bottomley <[email protected]>Signed-off-by Ming Lei <[email protected]>---
block/blk-mq-tag.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)block/blk-mq-tag.c +0
-0
block/blk-mq-tag.c static bool bt_tags_iter(struct sbitmap *bitmap, · line 275
Quoted 6 lines
block/blk-mq-tag.c +1
-1@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap,unsigned int bitnr, void *data) * test and set the bit before assining ->rqs[]. */ rq = tags->rqs[bitnr]; -if (rq &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if (rq &&blk_mq_request_started (rq))
So now we have dueling versions of this patch:
https://marc.info/?l=linux-scsi&m=153322802207688
Can we at least make sure we've root caused the problem and confirmed we've got it fixed before we start the formal patch process? When we do start the formal patch process, please give appropriate credit to the reporter(s) since this has been a royal pain for them to help us track down.
James
Quoted 44 lines · James Bottomley
Quoted 38 lines · Ming Lei
Commit
d250bf4e776ff09d5("blk-mq: only iterate over inflight requests in blk_mq_tagset_busy_iter")uses 'blk_mq_rq_state(rq)==MQ_RQ_IN_FLIGHT'
to replace 'blk_mq_request_started(req)', this way is wrong, and causes
lots of test system hang during booting.Fix the issue by using
blk_mq_request_started(req)insidebt_tags_iter().Fixes d250bf4e776ff09d5 ("blk-mq: only iterate over inflightrequests in
blk_mq_tagset_busy_iter")Cc Josef Bacik <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Guenter Roeck <[email protected]>Cc Mark Brown <[email protected]>Cc Matt Hart <[email protected]>Cc Johannes Thumshirn <[email protected]>Cc John Garry <[email protected]>Cc Hannes Reinecke <[email protected]>,Cc "Martin K. Petersen" <[email protected]>,Cc James Bottomley <[email protected]>Signed-off-by Ming Lei <[email protected]>---
�block/blk-mq-tag.c | 2 +-
�1 file changed, 1 insertion(+), 1 deletion(-)block/blk-mq-tag.c +0
-0@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)� �* test and set the bit before assining ->rqs[].
� �*/
� rq = tags->rqs[bitnr];block/blk-mq-tag.c static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data) · line 274
Quoted 2 lines
block/blk-mq-tag.c +1
-1-if (rq &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if (rq &&blk_mq_request_started (rq))So now we have dueling versions of this patch:
Quoted 4 lines
https://marc.info/?l=linux-scsi&m=153322802207688
Can we at least make sure we've root caused the problem and confirmed we've got it fixed before we start the formal patch process? When we
EH uses scsi_host_busy to check if the error handler needs to be waken up. And blk_mq_tagset_busy_iter() is used for implementing scsi_host_busy(), so causes EH not waken up, then this timed-out request can't be handled.
Quoted 3 lines
do start the formal patch process, please give appropriate credit to the reporter(s) since this has been a royal pain for them to help us track down.
Sure.
Jens, could you add reported-by if you are fine with this version? Or please just let me know if new version is needed, then I can add it.
Thanks,
Ming
Jens Axboe
maintainerQuoted 54 lines · Ming Lei
Quoted 44 lines · James Bottomley
Quoted 34 lines · Ming Lei
Commit
d250bf4e776ff09d5("blk-mq: only iterate over inflight requests in blk_mq_tagset_busy_iter")uses 'blk_mq_rq_state(rq)==MQ_RQ_IN_FLIGHT'
to replace 'blk_mq_request_started(req)', this way is wrong, and causes
lots of test system hang during booting.Fix the issue by using
blk_mq_request_started(req)insidebt_tags_iter().Fixes d250bf4e776ff09d5 ("blk-mq: only iterate over inflightrequests in
blk_mq_tagset_busy_iter")Cc Josef Bacik <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Guenter Roeck <[email protected]>Cc Mark Brown <[email protected]>Cc Matt Hart <[email protected]>Cc Johannes Thumshirn <[email protected]>Cc John Garry <[email protected]>Cc Hannes Reinecke <[email protected]>,Cc "Martin K. Petersen" <[email protected]>,Cc James Bottomley <[email protected]>Signed-off-by Ming Lei <[email protected]>---
block/blk-mq-tag.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)block/blk-mq-tag.c +0
-0block/blk-mq-tag.c static bool bt_tags_iter(struct sbitmap *bitmap, · line 275
Quoted 6 lines
block/blk-mq-tag.c +1
-1@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap,unsigned int bitnr, void *data) * test and set the bit before assining ->rqs[]. */ rq = tags->rqs[bitnr]; -if (rq &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if (rq &&blk_mq_request_started (rq))So now we have dueling versions of this patch:
Quoted 4 lines
https://marc.info/?l=linux-scsi&m=153322802207688
Can we at least make sure we've root caused the problem and confirmed we've got it fixed before we start the formal patch process? When we
EH uses
scsi_host_busyto check if the error handler needs to be waken up. Andblk_mq_tagset_busy_iter()is used for implementingscsi_host_busy(), so causes EH not waken up, then this timed-out request can't be handled.
Quoted 8 lines
Quoted 3 lines
do start the formal patch process, please give appropriate credit to the reporter(s) since this has been a royal pain for them to help us track down.
Sure.
Jens, could you add reported-by if you are fine with this version? Or please just let me know if new version is needed, then I can add it.
I'll add that, would also love a tested-by from the reporter. The patch looks good to me, however.
Signature · 1 line
Jens Axboe
James Bottomley
maintainerQuoted 49 lines · Jens Axboe
Quoted 48 lines · Ming Lei
Quoted 47 lines · James Bottomley
Quoted 34 lines · Ming Lei
Commit d250bf4e776ff09d5("blk-mq: only iterate over inflight requests
inblk_mq_tagset_busy_iter") uses 'blk_mq_rq_state(rq)==MQ_RQ_IN_FLIGHT' to replace 'blk_mq_request_started(req)', this way is wrong, and causes lots of test system hang during booting.Fix the issue by using
blk_mq_request_started(req)insidebt_tags_iter().Fixes d250bf4e776ff09d5 ("blk-mq: only iterate over inflightrequests in
blk_mq_tagset_busy_iter")Cc Josef Bacik <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Guenter Roeck <[email protected]>Cc Mark Brown <[email protected]>Cc Matt Hart <[email protected]>Cc Johannes Thumshirn <[email protected]>Cc John Garry <[email protected]>Cc Hannes Reinecke <[email protected]>,Cc "Martin K. Petersen" <[email protected]>,Cc James Bottomley <[email protected]>Signed-off-by Ming Lei <[email protected]>---
block/blk-mq-tag.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)block/blk-mq-tag.c +0
-0block/blk-mq-tag.c static bool bt_tags_iter(struct sbitmap · line 276
Quoted 7 lines
block/blk-mq-tag.c +1
-1@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap*bitmap, unsigned int bitnr, void *data) * test and set the bit before assining ->rqs[]. */ rq = tags->rqs[bitnr]; -if (rq &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if (rq &&blk_mq_request_started (rq))So now we have dueling versions of this patch:
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Can we at least make sure we've root caused the problem and confirmed we've got it fixed before we start the formal patch process? When we
EH uses
scsi_host_busyto check if the error handler needs to be waken up. Andblk_mq_tagset_busy_iter()is used for implementingscsi_host_busy(), so causes EH not waken up, then this timed-out request can't be handled.
Yes, I know what the problem is and why this patch is necessary and that it is very likely the root cause. However, can we confirm that it fixes the boot hang completely before we declare victory?
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
do start the formal patch process, please give appropriate credit to the reporter(s) since this has been a royal pain for them to help us track down.
Quoted 8 lines
Quoted 5 lines
Sure.
Jens, could you add reported-by if you are fine with this version? Or please just let me know if new version is needed, then I can add it.
I'll add that, would also love a tested-by from the reporter. The patch looks good to me, however.
Is there a reason why blk_mq_request_started() isn't a static inline? It looks to be somewhat in the hot path.
James
Quoted 54 lines · James Bottomley
Quoted 53 lines · Jens Axboe
Quoted 52 lines · Ming Lei
Quoted 50 lines · James Bottomley
Quoted 39 lines · Ming Lei
Commit d250bf4e776ff09d5("blk-mq: only iterate over inflight requests
inblk_mq_tagset_busy_iter") uses 'blk_mq_rq_state(rq)==MQ_RQ_IN_FLIGHT' to replace 'blk_mq_request_started(req)', this way is wrong, and causes lots of test system hang during booting.Fix the issue by using
blk_mq_request_started(req)insidebt_tags_iter().Fixes d250bf4e776ff09d5 ("blk-mq: only iterate over inflightrequests in
blk_mq_tagset_busy_iter")Cc Josef Bacik <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Guenter Roeck <[email protected]>Cc Mark Brown <[email protected]>Cc Matt Hart <[email protected]>Cc Johannes Thumshirn <[email protected]>Cc John Garry <[email protected]>Cc Hannes Reinecke <[email protected]>,Cc "Martin K. Petersen" <[email protected]>,Cc James Bottomley <[email protected]>Signed-off-by Ming Lei <[email protected]>---
�block/blk-mq-tag.c | 2 +-
�1 file changed, 1 insertion(+), 1 deletion(-)block/blk-mq-tag.c +0
-0@@ -271,7 +271,7 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)� �* test and set the bit before assining ->rqs[].
� �*/
� rq = tags->rqs[bitnr];block/blk-mq-tag.c static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data) · line 274
Quoted 2 lines
block/blk-mq-tag.c +1
-1-if (rq &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if (rq &&blk_mq_request_started (rq))So now we have dueling versions of this patch:
https://marc.info/?l=linux-scsi&m=153322802207688
Can we at least make sure we've root caused the problem and confirmed we've got it fixed before we start the formal patch process?��When we
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
EH uses
scsi_host_busyto check if the error handler needs to be waken up. Andblk_mq_tagset_busy_iter()is used for implementingscsi_host_busy(), so causes EH not waken up, then this timed-out request can't be handled.Yes, I know what the problem is and why this patch is necessary and that it is very likely the root cause. However, can we confirm that it fixes the boot hang completely before we declare victory?
Frankly speaking, I can reproduce & verify it, but still suggest to wait for ack from our report guys.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines
do start the formal patch process, please give appropriate credit to the reporter(s) since this has been a royal pain for them to help us track down.
Sure.
Jens, could you add reported-by if you are fine with this version? Or please just let me know if new version is needed, then I can add it.
Quoted 5 lines
Quoted 2 lines
I'll add that, would also love a tested-by from the reporter. The patch looks good to me, however.
Is there a reason�why
blk_mq_request_started()isn't a static inline? It looks to be somewhat in the hot path.
Looks good idea, which should have been in header file, will do it in V2.
Thanks,
Ming