Skip to contentSkip to conversation

blk-mq: I/O and timer unplugs are inverted in blktrace

PATCH In review Ilya Dryomov 3 participants 3 messages Sep 26, 2018 – Sep 28, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blk-mq: I/O and timer unplugs are inverted in blktrace

trace_block_unplug() takes true for explicit unplugs and false for implicit unplugs. schedule() unplugs are implicit and should be reported as timer unplugs. While correct in the legacy code, this has been inverted in blk-mq since 4.11.

Fixes bd166ef183c2 ("blk-mq-sched: add framework for MQ capable IO schedulers")
---
 block/blk-mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-mq.c +2 -2
index 85a1c1a59c72..e3c39ea8e17b 100644
@@ -1628,7 +1628,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 		BUG_ON(!rq->q);
 		if (rq->mq_ctx != this_ctx) {
 			if (this_ctx) {
-				trace_block_unplug(this_q, depth, from_schedule);
+				trace_block_unplug(this_q, depth, !from_schedule);
 				blk_mq_sched_insert_requests(this_q, this_ctx,
 								&ctx_list,
 								from_schedule);
@@ -1648,7 +1648,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 	 * on 'ctx_list'. Do those.
 	 */
 	if (this_ctx) {
-		trace_block_unplug(this_q, depth, from_schedule);
+		trace_block_unplug(this_q, depth, !from_schedule);
 		blk_mq_sched_insert_requests(this_q, this_ctx, &ctx_list,
 						from_schedule);
 	}
Signature · 1 line
2.14.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ilya Dryomov

trace_block_unplug() takes true for explicit unplugs and false for implicit unplugs. schedule() unplugs are implicit and should be reported as timer unplugs. While correct in the legacy code, this has been inverted in blk-mq since 4.11.

Fixes bd166ef183c2 ("blk-mq-sched: add framework for MQ capable IO schedulers")
Quoted 30 lines
---
 block/blk-mq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-mq.c +2 -2
index 85a1c1a59c72..e3c39ea8e17b 100644
@@ -1628,7 +1628,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 		BUG_ON(!rq->q);
 		if (rq->mq_ctx != this_ctx) {
 			if (this_ctx) {
-				trace_block_unplug(this_q, depth, from_schedule);
+				trace_block_unplug(this_q, depth, !from_schedule);
 				blk_mq_sched_insert_requests(this_q, this_ctx,
 								&ctx_list,
 								from_schedule);
@@ -1648,7 +1648,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 	 * on 'ctx_list'. Do those.
 	 */
 	if (this_ctx) {
-		trace_block_unplug(this_q, depth, from_schedule);
+		trace_block_unplug(this_q, depth, !from_schedule);
 		blk_mq_sched_insert_requests(this_q, this_ctx, &ctx_list,
 						from_schedule);
 	}
Signature · 1 line
2.14.4
#2 lore raw
In reply to Ilya Dryomov

T24gOS8yNi8xOCA2OjM1IEFNLCBJbHlhIERyeW9tb3Ygd3JvdGU6DQo+IHRyYWNlX2Jsb2NrX3Vu cGx1ZygpIHRha2VzIHRydWUgZm9yIGV4cGxpY2l0IHVucGx1Z3MgYW5kIGZhbHNlIGZvcg0KPiBp bXBsaWNpdCB1bnBsdWdzLiAgc2NoZWR1bGUoKSB1bnBsdWdzIGFyZSBpbXBsaWNpdCBhbmQgc2hv dWxkIGJlDQo+IHJlcG9ydGVkIGFzIHRpbWVyIHVucGx1Z3MuICBXaGlsZSBjb3JyZWN0IGluIHRo ZSBsZWdhY3kgY29kZSwgdGhpcyBoYXMNCj4gYmVlbiBpbnZlcnRlZCBpbiBibGstbXEgc2luY2Ug NC4xMS4NCg0KVGhhdCdzIHByZXR0eSBzaWxseS4uLiBUaGFua3MsIHdpbGwgcXVldWUgdXAgZm9y IDQuMTkuDQoNCi0tIA0KSmVucyBBeGJvZQ0KDQo=