xen/blkfront: restart request queue when there is enough persistent_gnts_c
Subsystems (3)
PATCH 1/1 xen/blkfront: restart request queue when there is enough persistent_gnts_c
When there is no enough free grants, gnttab_alloc_grant_references() will fail and block request queue will stop.
If the system is always lack of grants, blkif_restart_queue_callback() can't be scheduled and block request queue can't be restart(block I/O hang).
But when there are former requests complete, some grants may free to persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.
--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/block/xen-blkfront.c +11 -0
@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for +* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work); }static irqreturn_t blkif_interrupt (int irq,void *dev_id)
Signature · 1 line
1.7.10.4
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 24 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +1
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } +
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 10 lines
drivers/block/xen-blkfront.c +10
-0+/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for +* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);
I guess I'm missing something here, but blkif_completion is called by blkif_interrupt, which in turn calls kick_pending_request_queues when finished, which IMHO should be enough to restart the processing of requests.
Roger.
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 24 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +1
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } +
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 10 lines
drivers/block/xen-blkfront.c +10
-0+/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for +* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);
I guess I'm missing something here, but blkif_completion is called by blkif_interrupt, which in turn calls kick_pending_request_queues when finished, which IMHO should be enough to restart the processing of requests.
Roger.
Quoted 31 lines · Roger Pau Monné
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for
Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.
You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that time info->persistent_gnt_c = 8, max_gref = 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.
I think there might be a race condition:
request A request B:
info->persistent_gnts_c < max_grefs and fail to alloc enough grants
^^^^
interrupt happen, blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
stop block request queue added to callback()
If the system don't have enough grants(but have enough persistent_gnts), request queue would still hang.
Signature · 2 lines
Regards, -Bob
Quoted 31 lines · Roger Pau Monné
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for
Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.
You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that time info->persistent_gnt_c = 8, max_gref = 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.
I think there might be a race condition:
request A request B:
info->persistent_gnts_c < max_grefs and fail to alloc enough grants
^^^^
interrupt happen, blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
stop block request queue added to callback list
If the system don't have enough grants(but have enough persistent_gnts), request queue would still hang.
Signature · 2 lines
Regards, -Bob
Quoted 31 lines · Roger Pau Monné
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for
Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.
You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that time info->persistent_gnt_c = 8, max_gref = 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.
I think there might be a race condition:
request A request B:
info->persistent_gnts_c < max_grefs and fail to alloc enough grants
^^^^
interrupt happen, blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
stop block request queue added to callback()
If the system don't have enough grants(but have enough persistent_gnts), request queue would still hang.
Signature · 2 lines
Regards, -Bob
Quoted 31 lines · Roger Pau Monné
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for
Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.
You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that time info->persistent_gnt_c = 8, max_gref = 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.
I think there might be a race condition:
request A request B:
info->persistent_gnts_c < max_grefs and fail to alloc enough grants
^^^^
interrupt happen, blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
stop block request queue added to callback list
If the system don't have enough grants(but have enough persistent_gnts), request queue would still hang.
Signature · 2 lines
Regards, -Bob
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 63 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
Quoted 5 lines
stop block request queue added to callback list
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.
Not sure how can this happen, blkif_queue_request explicitly checks that persistent_gnts_c < max_grefs before adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state of info->connected?
Roger.
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 63 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
Quoted 5 lines
stop block request queue added to callback list
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.
Not sure how can this happen, blkif_queue_request explicitly checks that persistent_gnts_c < max_grefs before adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state of info->connected?
Roger.
Quoted 67 lines · Roger Pau Monné
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 66 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()stop block request queue added to callback list
Quoted 7 lines
Quoted 2 lines
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?
I think Bob has correctly identified a race.
After calling blk_stop_queue(), check info->persistent_gnts again and restart the queue if there free grefs.
David
Quoted 67 lines · Roger Pau Monné
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 66 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()stop block request queue added to callback list
Quoted 7 lines
Quoted 2 lines
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?
I think Bob has correctly identified a race.
After calling blk_stop_queue(), check info->persistent_gnts again and restart the queue if there free grefs.
David
El 12/01/15 a les 14.04, David Vrabel ha escrit:
Quoted 56 lines · Roger Pau Monné
Quoted 55 lines
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 54 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
blkif_interrupt can never interrupt blkif_queue_request, because it's holding a spinlock (info->io_lock). If you have seen this trace in the wild it means something is really wrong and we are calling blkif_queue_request without acquiring the spinlock and thus without disabling interrupts.
Quoted 20 lines
Quoted 11 lines
Quoted 6 lines
stop block request queue added to callback list
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?I think Bob has correctly identified a race.
After calling
blk_stop_queue(), checkinfo->persistent_gntsagain and restart the queue if there free grefs.David
El 12/01/15 a les 14.04, David Vrabel ha escrit:
Quoted 56 lines · Roger Pau Monné
Quoted 55 lines
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 54 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()
blkif_interrupt can never interrupt blkif_queue_request, because it's holding a spinlock (info->io_lock). If you have seen this trace in the wild it means something is really wrong and we are calling blkif_queue_request without acquiring the spinlock and thus without disabling interrupts.
Quoted 20 lines
Quoted 11 lines
Quoted 6 lines
stop block request queue added to callback list
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?I think Bob has correctly identified a race.
After calling
blk_stop_queue(), checkinfo->persistent_gntsagain and restart the queue if there free grefs.David
Quoted 67 lines · Roger Pau Monné
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 66 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()stop block request queue added to callback list
Quoted 8 lines
Quoted 2 lines
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?
All virtual disks are in "connected" status. And you are right this race condition won't happen. I'll dump more data if see this issue again.
Thanks,
-Bob
Quoted 67 lines · Roger Pau Monné
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 66 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()stop block request queue added to callback list
Quoted 8 lines
Quoted 2 lines
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?
All virtual disks are in "connected" status. And you are right this race condition won't happen. I'll dump more data if see this issue again.
Thanks,
-Bob
Quoted 67 lines · Roger Pau Monné
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 66 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()stop block request queue added to callback list
Quoted 8 lines
Quoted 2 lines
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?
All virtual disks are in "connected" status. And you are right this race condition won't happen. I'll dump more data if see this issue again.
Thanks,
-Bob
Quoted 67 lines · Roger Pau Monné
El 12/01/15 a les 8.09, Bob Liu ha escrit:
Quoted 66 lines · Roger Pau Monné
Quoted 31 lines
El 06/01/15 a les 14.19, Bob Liu ha escrit:
Quoted 30 lines
When there is no enough free grants,
gnttab_alloc_grant_references()will fail and block request queue will stop.
If the system is always lack of grants,blkif_restart_queue_callback()can't be scheduled and block request queue can't be restart(block I/O hang).But when there are former requests complete, some grants may free to
persistent_gnts_c, we can give the request queue another chance to restart and avoid block hang.Reported-by Junxiao Bi <[email protected]>Signed-off-by Bob Liu <[email protected]>--- drivers/block/xen-blkfront.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/block/xen-blkfront.c +7
-0@@ -1125,6 +1125,17 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, } } } + +/* +* Request queue would be stopped if failed to alloc enough grants and +* won't be restarted until gnttab_free_count >= info->callback->count. +* +* But there is another case, once we have enough persistent grants we +* can try to restart the request queue instead of continue to wait for Quoted 9 lines
drivers/block/xen-blkfront.c static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info, · line 1138
Quoted 4 lines
drivers/block/xen-blkfront.c +4
-0+* 'gnttab_free_count'. +*/ +if (info->persistent_gnts_c >= info->callback.count) +schedule_work (&info->work);I guess I'm missing something here, but
blkif_completionis called byblkif_interrupt, which in turn callskick_pending_request_queueswhen finished, which IMHO should be enough to restart the processing of requests.You are right, sorry for the mistake.
The problem we met was a xenblock I/O hang.
Dumped data showed at that timeinfo->persistent_gnt_c= 8,max_gref= 8 but block request queue was still stopped.
It's very hard to reproduce this issue, we only see it once.I think there might be a race condition:
request A request B:
info->persistent_gnts_c<max_grefsand fail to alloc enough grants^^^^
interrupt happen,blkif_complte():
info->persistent_gnts_c++kick_pending_request_queues()stop block request queue added to callback list
Quoted 8 lines
Quoted 2 lines
If the system don't have enough
grants(but have enough persistent_gnts), request queue would still hang.Not sure how can this happen,
blkif_queue_requestexplicitly checks thatpersistent_gnts_c<max_grefsbefore adding the callback and stopping the request queue, so in your case the queue should not be blocked. Can you dump the state ofinfo->connected?
All virtual disks are in "connected" status. And you are right this race condition won't happen. I'll dump more data if see this issue again.
Thanks,
-Bob