[PATCH 0/7] blktrace: few clenaup

STALE2091d

Revision v1 of 2 in this series.

Revisions (2)
  1. v1 current
  2. v1

37 messages, 4 authors, 2021-02-02 · open the first message on its own page

[PATCH 0/7] blktrace: few clenaup

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:26:56

Hi,

These are few cleanups for the block trace.

Below is the test log on latest linux-block/for-next.

Last two patches are needed to for testing.

-ck

Chaitanya Kulkarni (7):
  block: remove superfluous param in blk_fill_rwbs()
  blktrace: add blk_fill_rwbs documentation comment
  blktrace: fix blk_rq_issue documentation
  blktrace: fix blk_rq_merge documentation
  block: get rid of the trace rq insert wrapper
  null_blk: allow disacrd on non-membacked mode
  null_blk: add module param queue bounce limit

 block/bfq-iosched.c               |  4 +++-
 block/blk-mq-sched.c              |  6 ------
 block/blk-mq-sched.h              |  1 -
 block/kyber-iosched.c             |  4 +++-
 block/mq-deadline.c               |  4 +++-
 drivers/block/null_blk/main.c     | 31 +++++++++++++++++++++++++------
 drivers/block/null_blk/null_blk.h |  1 +
 include/linux/blktrace_api.h      |  2 +-
 include/trace/events/bcache.h     | 10 +++++-----
 include/trace/events/block.h      | 20 ++++++++++----------
 kernel/trace/blktrace.c           | 13 ++++++++++++-
 11 files changed, 63 insertions(+), 33 deletions(-)

Patch 1 Testing for uncommon tracepoints such as split, requeue :-

Merge Tracepoint :-

252,0    0        1     0.000000000  1096  Q  WS 0 + 8 [systemd-udevd]
252,0    0        2     0.000014217  1096  G  WS 0 + 8 [systemd-udevd]
252,0    0        3     0.000019467  1096  Q  WS 8 + 8 [systemd-udevd]
*252,0    0        4     0.000021200  1096  M  WS 8 + 8 [systemd-udevd]*

258 more lines

[PATCH 1/7] block: remove superfluous param in blk_fill_rwbs()

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:27:08

The last parameter for the function blk_fill_rwbs() was added in
5782138e47 ("tracing/events: convert block trace points to
TRACE_EVENT()") in order to signal read request and use of that parameter
was replaced with using switch case REQ_OP_READ with
1b9a9ab78b0 ("blktrace: use op accessors"), but the parameter was never
removed.

Remove the unused parameter and adjust the respective call sites.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 include/linux/blktrace_api.h  |  2 +-
 include/trace/events/bcache.h | 10 +++++-----
 include/trace/events/block.h  | 16 ++++++++--------
 kernel/trace/blktrace.c       |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 05556573b896..11484f1d19a1 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -119,7 +119,7 @@ struct compat_blk_user_trace_setup {
 
 #endif
 
-extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes);
+extern void blk_fill_rwbs(char *rwbs, unsigned int op);
 
 static inline sector_t blk_rq_trace_sector(struct request *rq)
 {
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index e41c611d6d3b..899fdacf57b9 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(bcache_request,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->orig_sector	= bio->bi_iter.bi_sector - 16;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)",
@@ -102,7 +102,7 @@ DECLARE_EVENT_CLASS(bcache_bio,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d  %s %llu + %u",
@@ -137,7 +137,7 @@ TRACE_EVENT(bcache_read,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		__entry->cache_hit = hit;
 		__entry->bypass = bypass;
 	),
@@ -168,7 +168,7 @@ TRACE_EVENT(bcache_write,
 		__entry->inode		= inode;
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		__entry->writeback = writeback;
 		__entry->bypass = bypass;
 	),
@@ -238,7 +238,7 @@ TRACE_EVENT(bcache_journal_write,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
 		__entry->nr_keys	= keys;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d  %s %llu + %u keys %u",
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 0d782663a005..879cba8bdfca 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -89,7 +89,7 @@ TRACE_EVENT(block_rq_requeue,
 		__entry->sector    = blk_rq_trace_sector(rq);
 		__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
 
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 	),
 
@@ -133,7 +133,7 @@ TRACE_EVENT(block_rq_complete,
 		__entry->nr_sector = nr_bytes >> 9;
 		__entry->error     = error;
 
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes);
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 	),
 
@@ -166,7 +166,7 @@ DECLARE_EVENT_CLASS(block_rq,
 		__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
 		__entry->bytes     = blk_rq_bytes(rq);
 
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
 	),
@@ -249,7 +249,7 @@ TRACE_EVENT(block_bio_complete,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio_sectors(bio);
 		__entry->error		= blk_status_to_errno(bio->bi_status);
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d %s %llu + %u [%d]",
@@ -276,7 +276,7 @@ DECLARE_EVENT_CLASS(block_bio,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio_sectors(bio);
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
 	),
 
@@ -433,7 +433,7 @@ TRACE_EVENT(block_split,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->new_sector	= new_sector;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
 	),
 
@@ -474,7 +474,7 @@ TRACE_EVENT(block_bio_remap,
 		__entry->nr_sector	= bio_sectors(bio);
 		__entry->old_dev	= dev;
 		__entry->old_sector	= from;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
@@ -518,7 +518,7 @@ TRACE_EVENT(block_rq_remap,
 		__entry->old_dev	= dev;
 		__entry->old_sector	= from;
 		__entry->nr_bios	= blk_rq_count_bios(rq);
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 	),
 
 	TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 9e9ee4945043..8a2591c7aa41 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1867,7 +1867,7 @@ void blk_trace_remove_sysfs(struct device *dev)
 
 #ifdef CONFIG_EVENT_TRACING
 
-void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes)
+void blk_fill_rwbs(char *rwbs, unsigned int op)
 {
 	int i = 0;
 
-- 
2.22.1

[PATCH 3/7] blktrace: fix blk_rq_issue documentation

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:27:32

The commit 881245dcff29 ("Add DocBook documentation for the block tracepoints.")
added the comment for blk_rq_issue() tracepoint. Remove the duplicate
word from the tracepoint documentation.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 include/trace/events/block.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 879cba8bdfca..004cfe34ef37 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -196,7 +196,7 @@ DEFINE_EVENT(block_rq, block_rq_insert,
 
 /**
  * block_rq_issue - issue pending block IO request operation to device driver
- * @rq: block IO operation operation request
+ * @rq: block IO operation request
  *
  * Called when block operation request @rq from queue @q is sent to a
  * device driver for processing.
-- 
2.22.1

[PATCH 4/7] blktrace: fix blk_rq_merge documentation

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:32:30

The commit f3bdc62fd82e ("blktrace: Provide event for request merging")
added the comment for blk_rq_merge() tracepoint. Remove the duplicate
word from the tracepoint documentation.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 include/trace/events/block.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 004cfe34ef37..cc5ab96a7471 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -210,7 +210,7 @@ DEFINE_EVENT(block_rq, block_rq_issue,
 
 /**
  * block_rq_merge - merge request with another one in the elevator
- * @rq: block IO operation operation request
+ * @rq: block IO operation request
  *
  * Called when block operation request @rq from queue @q is merged to another
  * request queued in the elevator.
-- 
2.22.1

[PATCH 6/7] null_blk: allow disacrd on non-membacked mode

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:32:42

null blk driver supports REQ_OP_DISACRD in membacked mode. When testing
special requests having REQ_OP_DISCARD support is helpful to validate
the special request path when mixed with read-write.

Consider module parameter when setting the queue discard flag when
device is not memory backed.

This is needed to test the tracepoint related to REQ_OP_DISCARD.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
# modprobe  -r null_blk
# gitlog -7 
4ac4d49e1028 (HEAD -> for-next) null_blk: add module param queue bounce limit
468e3617dae8 null_blk: allow disacrd on non-membacked mode
bdc96efe9681 block: get rid of the trace rq insert wrapper
73bf523a7ce4 blktrace: fix blk_rq_merge documentation
6016632555da blktrace: fix blk_rq_issue documentation
58b5d7103a94 blktrace: add blk_fill_rwbs documentation comment
534f321f57dd block: remove superfluous param in blk_fill_rwbs()

Test to exercise module parameter vs configfs discard param, set up
nullb0 such a way that it errors out in both cases for module param
discard :-

for discard in 0 1
do 
	modprobe -r null_blk
	i=0
	echo "Module param discard ${discard}"
	modprobe null_blk nr_devices=0 discard=${discard}
	# Create dev 0 no discard 
	NULLB_DIR=config/nullb/nullb${i}
	mkdir config/nullb/nullb${i}
	echo 1 > config/nullb/nullb${i}/memory_backed
	echo 512 > config/nullb/nullb${i}/blocksize 
	echo 2048 > config/nullb/nullb${i}/size 
	echo 1 > config/nullb/nullb${i}/power
	echo -n "$nullb${i} membacked : ";
	cat /sys/kernel/config/nullb/nullb${i}/memory_backed 

67 more lines

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index d6c821d48090..6e6cbb953a12 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -172,6 +172,10 @@ static bool g_shared_tag_bitmap;
 module_param_named(shared_tag_bitmap, g_shared_tag_bitmap, bool, 0444);
 MODULE_PARM_DESC(shared_tag_bitmap, "Use shared tag bitmap for all submission queues for blk-mq");
 
+static bool g_discard;
+module_param_named(discard, g_discard, bool, 0444);
+MODULE_PARM_DESC(discard, "Enable queue discard (default: false)");
+
 static int g_irqmode = NULL_IRQ_SOFTIRQ;
 
 static int null_set_irqmode(const char *str, const struct kernel_param *kp)
@@ -1588,14 +1592,11 @@ static void null_del_dev(struct nullb *nullb)
 
 static void null_config_discard(struct nullb *nullb)
 {
-	if (nullb->dev->discard == false)
+	if (nullb->dev->memory_backed && nullb->dev->discard == false)
 		return;
 
-	if (!nullb->dev->memory_backed) {
-		nullb->dev->discard = false;
-		pr_info("discard option is ignored without memory backing\n");
+	if (!nullb->dev->memory_backed && !g_discard)
 		return;
-	}
 
 	if (nullb->dev->zoned) {
 		nullb->dev->discard = false;
-- 
2.22.1

[PATCH 3/7] blktrace: fix blk_rq_issue documentation

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:32:44

The commit 881245dcff29 ("Add DocBook documentation for the block tracepoints.")
added the comment for blk_rq_issue() tracepoint. Remove the duplicate
word from the tracepoint documentation.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 include/trace/events/block.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 879cba8bdfca..004cfe34ef37 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -196,7 +196,7 @@ DEFINE_EVENT(block_rq, block_rq_insert,
 
 /**
  * block_rq_issue - issue pending block IO request operation to device driver
- * @rq: block IO operation operation request
+ * @rq: block IO operation request
  *
  * Called when block operation request @rq from queue @q is sent to a
  * device driver for processing.
-- 
2.22.1

[PATCH 2/7] blktrace: add blk_fill_rwbs documentation comment

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:44

blk_fill_rwbs() is an expoted function, add kernel style documentation
comment.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 kernel/trace/blktrace.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 8a2591c7aa41..1a931afcf5c4 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1867,6 +1867,16 @@ void blk_trace_remove_sysfs(struct device *dev)
 
 #ifdef CONFIG_EVENT_TRACING
 
+/**
+ * blk_fill_rwbs - Fill the buffer rwbs by mapping op to character string.
+ * @rwbs	buffer to be filled
+ * @op:		REQ_OP_XXX for the tracepoint
+ *
+ * Description:
+ *     Maps the REQ_OP_XXX to character and fills the buffer provided by the
+ *     caller with resulting string.
+ *
+ **/
 void blk_fill_rwbs(char *rwbs, unsigned int op)
 {
 	int i = 0;
-- 
2.22.1

[PATCH 6/7] null_blk: allow disacrd on non-membacked mode

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:44

null blk driver supports REQ_OP_DISACRD in membacked mode. When testing
special requests having REQ_OP_DISCARD support is helpful to validate
the special request path when mixed with read-write.

Consider module parameter when setting the queue discard flag when
device is not memory backed.

This is needed to test the tracepoint related to REQ_OP_DISCARD.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
# modprobe  -r null_blk
# gitlog -7 
4ac4d49e1028 (HEAD -> for-next) null_blk: add module param queue bounce limit
468e3617dae8 null_blk: allow disacrd on non-membacked mode
bdc96efe9681 block: get rid of the trace rq insert wrapper
73bf523a7ce4 blktrace: fix blk_rq_merge documentation
6016632555da blktrace: fix blk_rq_issue documentation
58b5d7103a94 blktrace: add blk_fill_rwbs documentation comment
534f321f57dd block: remove superfluous param in blk_fill_rwbs()

Test to exercise module parameter vs configfs discard param, set up
nullb0 such a way that it errors out in both cases for module param
discard :-

for discard in 0 1
do 
	modprobe -r null_blk
	i=0
	echo "Module param discard ${discard}"
	modprobe null_blk nr_devices=0 discard=${discard}
	# Create dev 0 no discard 
	NULLB_DIR=config/nullb/nullb${i}
	mkdir config/nullb/nullb${i}
	echo 1 > config/nullb/nullb${i}/memory_backed
	echo 512 > config/nullb/nullb${i}/blocksize 
	echo 2048 > config/nullb/nullb${i}/size 
	echo 1 > config/nullb/nullb${i}/power
	echo -n "$nullb${i} membacked : ";
	cat /sys/kernel/config/nullb/nullb${i}/memory_backed 

67 more lines

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index d6c821d48090..6e6cbb953a12 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -172,6 +172,10 @@ static bool g_shared_tag_bitmap;
 module_param_named(shared_tag_bitmap, g_shared_tag_bitmap, bool, 0444);
 MODULE_PARM_DESC(shared_tag_bitmap, "Use shared tag bitmap for all submission queues for blk-mq");
 
+static bool g_discard;
+module_param_named(discard, g_discard, bool, 0444);
+MODULE_PARM_DESC(discard, "Enable queue discard (default: false)");
+
 static int g_irqmode = NULL_IRQ_SOFTIRQ;
 
 static int null_set_irqmode(const char *str, const struct kernel_param *kp)
@@ -1588,14 +1592,11 @@ static void null_del_dev(struct nullb *nullb)
 
 static void null_config_discard(struct nullb *nullb)
 {
-	if (nullb->dev->discard == false)
+	if (nullb->dev->memory_backed && nullb->dev->discard == false)
 		return;
 
-	if (!nullb->dev->memory_backed) {
-		nullb->dev->discard = false;
-		pr_info("discard option is ignored without memory backing\n");
+	if (!nullb->dev->memory_backed && !g_discard)
 		return;
-	}
 
 	if (nullb->dev->zoned) {
 		nullb->dev->discard = false;
-- 
2.22.1

[PATCH 5/7] block: get rid of the trace rq insert wrapper

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:45

Get rid of the wrapper for trace_block_rq_insert() and call the function
directly.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 block/bfq-iosched.c     | 4 +++-
 block/blk-mq-sched.c    | 6 ------
 block/blk-mq-sched.h    | 1 -
 block/kyber-iosched.c   | 4 +++-
 block/mq-deadline.c     | 4 +++-
 kernel/trace/blktrace.c | 1 +
 6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index dfa87e360d71..da5e1f620625 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -125,6 +125,8 @@
 #include <linux/delay.h>
 #include <linux/backing-dev.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq.h"
 #include "blk-mq-tag.h"
@@ -5621,7 +5623,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 
 	spin_unlock_irq(&bfqd->lock);
 
-	blk_mq_sched_request_inserted(rq);
+	trace_block_rq_insert(rq);
 
 	spin_lock_irq(&bfqd->lock);
 	bfqq = bfq_init_rq(rq);
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index deff4e826e23..ddb65e9e6fd9 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -384,12 +384,6 @@ bool blk_mq_sched_try_insert_merge(struct request_queue *q, struct request *rq)
 }
 EXPORT_SYMBOL_GPL(blk_mq_sched_try_insert_merge);
 
-void blk_mq_sched_request_inserted(struct request *rq)
-{
-	trace_block_rq_insert(rq);
-}
-EXPORT_SYMBOL_GPL(blk_mq_sched_request_inserted);
-
 static bool blk_mq_sched_bypass_insert(struct blk_mq_hw_ctx *hctx,
 				       bool has_sched,
 				       struct request *rq)
diff --git a/block/blk-mq-sched.h b/block/blk-mq-sched.h
index 0476360f05f1..5b18ab915c65 100644
--- a/block/blk-mq-sched.h
+++ b/block/blk-mq-sched.h
@@ -7,7 +7,6 @@
 
 void blk_mq_sched_assign_ioc(struct request *rq);
 
-void blk_mq_sched_request_inserted(struct request *rq);
 bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
 		unsigned int nr_segs, struct request **merged_request);
 bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio,
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c
index c25c41d0d061..f13da10953bf 100644
--- a/block/kyber-iosched.c
+++ b/block/kyber-iosched.c
@@ -13,6 +13,8 @@
 #include <linux/module.h>
 #include <linux/sbitmap.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq.h"
 #include "blk-mq-debugfs.h"
@@ -602,7 +604,7 @@ static void kyber_insert_requests(struct blk_mq_hw_ctx *hctx,
 			list_move_tail(&rq->queuelist, head);
 		sbitmap_set_bit(&khd->kcq_map[sched_domain],
 				rq->mq_ctx->index_hw[hctx->type]);
-		blk_mq_sched_request_inserted(rq);
+		trace_block_rq_insert(rq);
 		spin_unlock(&kcq->lock);
 	}
 }
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index b57470e154c8..f3631a287466 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -18,6 +18,8 @@
 #include <linux/rbtree.h>
 #include <linux/sbitmap.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq.h"
 #include "blk-mq-debugfs.h"
@@ -496,7 +498,7 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 	if (blk_mq_sched_try_insert_merge(q, rq))
 		return;
 
-	blk_mq_sched_request_inserted(rq);
+	trace_block_rq_insert(rq);
 
 	if (at_head || blk_rq_is_passthrough(rq)) {
 		if (at_head)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 1a931afcf5c4..259635217a53 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -852,6 +852,7 @@ static void blk_add_trace_rq_issue(void *ignore, struct request *rq)
 	blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_ISSUE,
 			 blk_trace_request_get_cgid(rq));
 }
+EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_insert);
 
 static void blk_add_trace_rq_merge(void *ignore, struct request *rq)
 {
-- 
2.22.1

[PATCH 2/7] blktrace: add blk_fill_rwbs documentation comment

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:45

blk_fill_rwbs() is an expoted function, add kernel style documentation
comment.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 kernel/trace/blktrace.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 8a2591c7aa41..1a931afcf5c4 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1867,6 +1867,16 @@ void blk_trace_remove_sysfs(struct device *dev)
 
 #ifdef CONFIG_EVENT_TRACING
 
+/**
+ * blk_fill_rwbs - Fill the buffer rwbs by mapping op to character string.
+ * @rwbs	buffer to be filled
+ * @op:		REQ_OP_XXX for the tracepoint
+ *
+ * Description:
+ *     Maps the REQ_OP_XXX to character and fills the buffer provided by the
+ *     caller with resulting string.
+ *
+ **/
 void blk_fill_rwbs(char *rwbs, unsigned int op)
 {
 	int i = 0;
-- 
2.22.1

[PATCH 0/7] blktrace: few clenaup

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:45

Hi,

These are few cleanups for the block trace.

Below is the test log on latest linux-block/for-next.

Last two patches are needed to for testing.

-ck

Chaitanya Kulkarni (7):
  block: remove superfluous param in blk_fill_rwbs()
  blktrace: add blk_fill_rwbs documentation comment
  blktrace: fix blk_rq_issue documentation
  blktrace: fix blk_rq_merge documentation
  block: get rid of the trace rq insert wrapper
  null_blk: allow disacrd on non-membacked mode
  null_blk: add module param queue bounce limit

 block/bfq-iosched.c               |  4 +++-
 block/blk-mq-sched.c              |  6 ------
 block/blk-mq-sched.h              |  1 -
 block/kyber-iosched.c             |  4 +++-
 block/mq-deadline.c               |  4 +++-
 drivers/block/null_blk/main.c     | 31 +++++++++++++++++++++++++------
 drivers/block/null_blk/null_blk.h |  1 +
 include/linux/blktrace_api.h      |  2 +-
 include/trace/events/bcache.h     | 10 +++++-----
 include/trace/events/block.h      | 20 ++++++++++----------
 kernel/trace/blktrace.c           | 13 ++++++++++++-
 11 files changed, 63 insertions(+), 33 deletions(-)

Patch 1 Testing for uncommon tracepoints such as split, requeue :-

Merge Tracepoint :-

252,0    0        1     0.000000000  1096  Q  WS 0 + 8 [systemd-udevd]
252,0    0        2     0.000014217  1096  G  WS 0 + 8 [systemd-udevd]
252,0    0        3     0.000019467  1096  Q  WS 8 + 8 [systemd-udevd]
*252,0    0        4     0.000021200  1096  M  WS 8 + 8 [systemd-udevd]*

258 more lines

[PATCH 1/7] block: remove superfluous param in blk_fill_rwbs()

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:45

The last parameter for the function blk_fill_rwbs() was added in
5782138e47 ("tracing/events: convert block trace points to
TRACE_EVENT()") in order to signal read request and use of that parameter
was replaced with using switch case REQ_OP_READ with
1b9a9ab78b0 ("blktrace: use op accessors"), but the parameter was never
removed.

Remove the unused parameter and adjust the respective call sites.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 include/linux/blktrace_api.h  |  2 +-
 include/trace/events/bcache.h | 10 +++++-----
 include/trace/events/block.h  | 16 ++++++++--------
 kernel/trace/blktrace.c       |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 05556573b896..11484f1d19a1 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -119,7 +119,7 @@ struct compat_blk_user_trace_setup {
 
 #endif
 
-extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes);
+extern void blk_fill_rwbs(char *rwbs, unsigned int op);
 
 static inline sector_t blk_rq_trace_sector(struct request *rq)
 {
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index e41c611d6d3b..899fdacf57b9 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(bcache_request,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->orig_sector	= bio->bi_iter.bi_sector - 16;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)",
@@ -102,7 +102,7 @@ DECLARE_EVENT_CLASS(bcache_bio,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d  %s %llu + %u",
@@ -137,7 +137,7 @@ TRACE_EVENT(bcache_read,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		__entry->cache_hit = hit;
 		__entry->bypass = bypass;
 	),
@@ -168,7 +168,7 @@ TRACE_EVENT(bcache_write,
 		__entry->inode		= inode;
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		__entry->writeback = writeback;
 		__entry->bypass = bypass;
 	),
@@ -238,7 +238,7 @@ TRACE_EVENT(bcache_journal_write,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
 		__entry->nr_keys	= keys;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d  %s %llu + %u keys %u",
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 0d782663a005..879cba8bdfca 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -89,7 +89,7 @@ TRACE_EVENT(block_rq_requeue,
 		__entry->sector    = blk_rq_trace_sector(rq);
 		__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
 
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 	),
 
@@ -133,7 +133,7 @@ TRACE_EVENT(block_rq_complete,
 		__entry->nr_sector = nr_bytes >> 9;
 		__entry->error     = error;
 
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes);
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 	),
 
@@ -166,7 +166,7 @@ DECLARE_EVENT_CLASS(block_rq,
 		__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
 		__entry->bytes     = blk_rq_bytes(rq);
 
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 		__get_str(cmd)[0] = '\0';
 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
 	),
@@ -249,7 +249,7 @@ TRACE_EVENT(block_bio_complete,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio_sectors(bio);
 		__entry->error		= blk_status_to_errno(bio->bi_status);
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d %s %llu + %u [%d]",
@@ -276,7 +276,7 @@ DECLARE_EVENT_CLASS(block_bio,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio_sectors(bio);
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
 	),
 
@@ -433,7 +433,7 @@ TRACE_EVENT(block_split,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->new_sector	= new_sector;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 		memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
 	),
 
@@ -474,7 +474,7 @@ TRACE_EVENT(block_bio_remap,
 		__entry->nr_sector	= bio_sectors(bio);
 		__entry->old_dev	= dev;
 		__entry->old_sector	= from;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
@@ -518,7 +518,7 @@ TRACE_EVENT(block_rq_remap,
 		__entry->old_dev	= dev;
 		__entry->old_sector	= from;
 		__entry->nr_bios	= blk_rq_count_bios(rq);
-		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq));
+		blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
 	),
 
 	TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu %u",
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 9e9ee4945043..8a2591c7aa41 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1867,7 +1867,7 @@ void blk_trace_remove_sysfs(struct device *dev)
 
 #ifdef CONFIG_EVENT_TRACING
 
-void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes)
+void blk_fill_rwbs(char *rwbs, unsigned int op)
 {
 	int i = 0;
 
-- 
2.22.1

[PATCH 7/7] null_blk: add module param queue bounce limit

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:45

This patch adds a new module parameter to set the queue bounce limit.
Various queue limits parameters are usually present in the sysfs.
This is needed for testing purpose only so instead of poluting the
sysfs space just update the null_blk drivers.

This is needed especially for blktrace bounce related tracepoint
testing.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
# modprobe null_blk bounce_pfn=0x1000
# for bs in 512 1024 2048 4096 8192
do
	dd if=/dev/zero of=/dev/nullb0 bs=${bs} count=1 oflag=direct
done
# ~/blktrace/blktrace -a write -d /dev/nullb0 -o -| ~/blktrace/blkparse -i -
#
# # With null_blk bounce 
# modprobe null_blk bounce_pfn=0x1000
#
252,0   34        1     0.000000000  4390  Q  WS 0 + 1 [dd]
252,0   34        2     0.000010139  4390  B  WS 0 + 1 [dd]
252,0   34        3     0.000018996  4390  G  WS 0 + 1 [dd]
252,0   34        4     0.000024576  4390  I  WS 0 + 1 [dd]
252,0   34        5     0.000065152   829  D  WS 0 + 1 [kworker/34:1H]
252,0   34        6     0.000092303   182  C  WS 0 + 1 [0]
252,0   34        7     0.000098164   182  C  WS 0 + 1 [0]
252,0   27        1     0.004573597  4391  Q  WS 0 + 2 [dd]
252,0   27        2     0.004580891  4391  B  WS 0 + 2 [dd]
252,0   27        3     0.004589687  4391  G  WS 0 + 2 [dd]
252,0   27        4     0.004594356  4391  I  WS 0 + 2 [dd]
252,0   27        5     0.004619473  1049  D  WS 0 + 2 [kworker/27:1H]
252,0   27        6     0.004634411   147  C  WS 0 + 2 [0]
252,0   27        7     0.004638609   147  C  WS 0 + 2 [0]
252,0   29        1     0.014589610  4394  Q  WS 0 + 8 [dd]
252,0   29        2     0.014595792  4394  B  WS 0 + 8 [dd]
252,0   29        3     0.014599028  4394  G  WS 0 + 8 [dd]
252,0   29        4     0.014601713  4394  I  WS 0 + 8 [dd]
252,0   29        5     0.014621330   807  D  WS 0 + 8 [kworker/29:1H]
252,0   29        6     0.014633813   157  C  WS 0 + 8 [0]
252,0   29        7     0.014637660   157  C  WS 0 + 8 [0]
252,0   30        1     0.009147174  4392  Q  WS 0 + 4 [dd]
252,0   30        2     0.009154377  4392  B  WS 0 + 4 [dd]
252,0   30        3     0.009163064  4392  G  WS 0 + 4 [dd]
252,0   30        4     0.009167161  4392  I  WS 0 + 4 [dd]
252,0   30        5     0.009191437  1084  D  WS 0 + 4 [kworker/30:1H]
252,0   30        6     0.009206084   162  C  WS 0 + 4 [0]
252,0   30        7     0.009210863   162  C  WS 0 + 4 [0]
252,0   30        8     0.018510473  4395  Q  WS 0 + 16 [dd]
252,0   30        9     0.018517767  4395  B  WS 0 + 16 [dd]
252,0   30       10     0.018521213  4395  G  WS 0 + 16 [dd]
252,0   30       11     0.018524229  4395  I  WS 0 + 16 [dd]
252,0   30       12     0.018544026  1084  D  WS 0 + 16 [kworker/30:1H]
252,0   30       13     0.018555127   162  C  WS 0 + 16 [0]
252,0   30       14     0.018558333   162  C  WS 0 + 16 [0]

33 more lines

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 6e6cbb953a12..8ddf2ba961f7 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -156,6 +156,10 @@ static int g_max_sectors;
 module_param_named(max_sectors, g_max_sectors, int, 0444);
 MODULE_PARM_DESC(max_sectors, "Maximum size of a command (in 512B sectors)");
 
+static unsigned int g_bounce_pfn;
+module_param_named(bounce_pfn, g_bounce_pfn, int, 0444);
+MODULE_PARM_DESC(bounce_pfn, "Queue Bounce limit (default: 0)");
+
 static unsigned int nr_devices = 1;
 module_param(nr_devices, uint, 0444);
 MODULE_PARM_DESC(nr_devices, "Number of devices to register");
@@ -354,6 +358,7 @@ NULLB_DEVICE_ATTR(submit_queues, uint, nullb_apply_submit_queues);
 NULLB_DEVICE_ATTR(home_node, uint, NULL);
 NULLB_DEVICE_ATTR(queue_mode, uint, NULL);
 NULLB_DEVICE_ATTR(blocksize, uint, NULL);
+NULLB_DEVICE_ATTR(bounce_pfn, uint, NULL);
 NULLB_DEVICE_ATTR(max_sectors, uint, NULL);
 NULLB_DEVICE_ATTR(irqmode, uint, NULL);
 NULLB_DEVICE_ATTR(hw_queue_depth, uint, NULL);
@@ -472,6 +477,7 @@ static struct configfs_attribute *nullb_device_attrs[] = {
 	&nullb_device_attr_home_node,
 	&nullb_device_attr_queue_mode,
 	&nullb_device_attr_blocksize,
+	&nullb_device_attr_bounce_pfn,
 	&nullb_device_attr_max_sectors,
 	&nullb_device_attr_irqmode,
 	&nullb_device_attr_hw_queue_depth,
@@ -543,7 +549,7 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item)
 static ssize_t memb_group_features_show(struct config_item *item, char *page)
 {
 	return snprintf(page, PAGE_SIZE,
-			"memory_backed,discard,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv,zone_max_open,zone_max_active,blocksize,max_sectors\n");
+			"memory_backed,discard,bounce_pfn,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv\n");
 }
 
 CONFIGFS_ATTR_RO(memb_group_, features);
@@ -1610,6 +1616,17 @@ static void null_config_discard(struct nullb *nullb)
 	blk_queue_flag_set(QUEUE_FLAG_DISCARD, nullb->q);
 }
 
+static void null_config_bounce_pfn(struct nullb *nullb)
+{
+	if (nullb->dev->memory_backed && nullb->dev->bounce_pfn == false)
+		return;
+
+	if (!nullb->dev->memory_backed && !g_bounce_pfn)
+		return;
+
+	blk_queue_bounce_limit(nullb->q, nullb->dev->bounce_pfn);
+}
+
 static const struct block_device_operations null_bio_ops = {
 	.owner		= THIS_MODULE,
 	.submit_bio	= null_submit_bio,
@@ -1882,6 +1899,7 @@ static int null_add_dev(struct nullb_device *dev)
 	blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
 
 	null_config_discard(nullb);
+	null_config_bounce_pfn(nullb);
 
 	sprintf(nullb->disk_name, "nullb%d", nullb->index);
 
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index 83504f3cc9d6..cd55f99118bf 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -86,6 +86,7 @@ struct nullb_device {
 	unsigned int queue_mode; /* block interface */
 	unsigned int blocksize; /* block size */
 	unsigned int max_sectors; /* Max sectors per command */
+	unsigned int bounce_pfn; /* bounce page frame number */
 	unsigned int irqmode; /* IRQ completion handler */
 	unsigned int hw_queue_depth; /* queue depth */
 	unsigned int index; /* index of the disk, only valid with a disk */
-- 
2.22.1

Re: [PATCH 0/7] blktrace: few clenaup

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:33:45

On 2/1/21 21:25, Chaitanya Kulkarni wrote:
Hi,

These are few cleanups for the block trace.

Below is the test log on latest linux-block/for-next.

Last two patches are needed to for testing.

-ck
Looks like this series got sent out twice, please ignore the first one.

[PATCH 5/7] block: get rid of the trace rq insert wrapper

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:34:02

Get rid of the wrapper for trace_block_rq_insert() and call the function
directly.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 block/bfq-iosched.c     | 4 +++-
 block/blk-mq-sched.c    | 6 ------
 block/blk-mq-sched.h    | 1 -
 block/kyber-iosched.c   | 4 +++-
 block/mq-deadline.c     | 4 +++-
 kernel/trace/blktrace.c | 1 +
 6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index dfa87e360d71..da5e1f620625 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -125,6 +125,8 @@
 #include <linux/delay.h>
 #include <linux/backing-dev.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq.h"
 #include "blk-mq-tag.h"
@@ -5621,7 +5623,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 
 	spin_unlock_irq(&bfqd->lock);
 
-	blk_mq_sched_request_inserted(rq);
+	trace_block_rq_insert(rq);
 
 	spin_lock_irq(&bfqd->lock);
 	bfqq = bfq_init_rq(rq);
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index deff4e826e23..ddb65e9e6fd9 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -384,12 +384,6 @@ bool blk_mq_sched_try_insert_merge(struct request_queue *q, struct request *rq)
 }
 EXPORT_SYMBOL_GPL(blk_mq_sched_try_insert_merge);
 
-void blk_mq_sched_request_inserted(struct request *rq)
-{
-	trace_block_rq_insert(rq);
-}
-EXPORT_SYMBOL_GPL(blk_mq_sched_request_inserted);
-
 static bool blk_mq_sched_bypass_insert(struct blk_mq_hw_ctx *hctx,
 				       bool has_sched,
 				       struct request *rq)
diff --git a/block/blk-mq-sched.h b/block/blk-mq-sched.h
index 0476360f05f1..5b18ab915c65 100644
--- a/block/blk-mq-sched.h
+++ b/block/blk-mq-sched.h
@@ -7,7 +7,6 @@
 
 void blk_mq_sched_assign_ioc(struct request *rq);
 
-void blk_mq_sched_request_inserted(struct request *rq);
 bool blk_mq_sched_try_merge(struct request_queue *q, struct bio *bio,
 		unsigned int nr_segs, struct request **merged_request);
 bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio,
diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c
index c25c41d0d061..f13da10953bf 100644
--- a/block/kyber-iosched.c
+++ b/block/kyber-iosched.c
@@ -13,6 +13,8 @@
 #include <linux/module.h>
 #include <linux/sbitmap.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq.h"
 #include "blk-mq-debugfs.h"
@@ -602,7 +604,7 @@ static void kyber_insert_requests(struct blk_mq_hw_ctx *hctx,
 			list_move_tail(&rq->queuelist, head);
 		sbitmap_set_bit(&khd->kcq_map[sched_domain],
 				rq->mq_ctx->index_hw[hctx->type]);
-		blk_mq_sched_request_inserted(rq);
+		trace_block_rq_insert(rq);
 		spin_unlock(&kcq->lock);
 	}
 }
diff --git a/block/mq-deadline.c b/block/mq-deadline.c
index b57470e154c8..f3631a287466 100644
--- a/block/mq-deadline.c
+++ b/block/mq-deadline.c
@@ -18,6 +18,8 @@
 #include <linux/rbtree.h>
 #include <linux/sbitmap.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq.h"
 #include "blk-mq-debugfs.h"
@@ -496,7 +498,7 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 	if (blk_mq_sched_try_insert_merge(q, rq))
 		return;
 
-	blk_mq_sched_request_inserted(rq);
+	trace_block_rq_insert(rq);
 
 	if (at_head || blk_rq_is_passthrough(rq)) {
 		if (at_head)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 1a931afcf5c4..259635217a53 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -852,6 +852,7 @@ static void blk_add_trace_rq_issue(void *ignore, struct request *rq)
 	blk_add_trace_rq(rq, 0, blk_rq_bytes(rq), BLK_TA_ISSUE,
 			 blk_trace_request_get_cgid(rq));
 }
+EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_insert);
 
 static void blk_add_trace_rq_merge(void *ignore, struct request *rq)
 {
-- 
2.22.1

[PATCH 7/7] null_blk: add module param queue bounce limit

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:34:02

This patch adds a new module parameter to set the queue bounce limit.
Various queue limits parameters are usually present in the sysfs.
This is needed for testing purpose only so instead of poluting the
sysfs space just update the null_blk drivers.

This is needed especially for blktrace bounce related tracepoint
testing.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
# modprobe null_blk bounce_pfn=0x1000
# for bs in 512 1024 2048 4096 8192
do
	dd if=/dev/zero of=/dev/nullb0 bs=${bs} count=1 oflag=direct
done
# ~/blktrace/blktrace -a write -d /dev/nullb0 -o -| ~/blktrace/blkparse -i -
#
# # With null_blk bounce 
# modprobe null_blk bounce_pfn=0x1000
#
252,0   34        1     0.000000000  4390  Q  WS 0 + 1 [dd]
252,0   34        2     0.000010139  4390  B  WS 0 + 1 [dd]
252,0   34        3     0.000018996  4390  G  WS 0 + 1 [dd]
252,0   34        4     0.000024576  4390  I  WS 0 + 1 [dd]
252,0   34        5     0.000065152   829  D  WS 0 + 1 [kworker/34:1H]
252,0   34        6     0.000092303   182  C  WS 0 + 1 [0]
252,0   34        7     0.000098164   182  C  WS 0 + 1 [0]
252,0   27        1     0.004573597  4391  Q  WS 0 + 2 [dd]
252,0   27        2     0.004580891  4391  B  WS 0 + 2 [dd]
252,0   27        3     0.004589687  4391  G  WS 0 + 2 [dd]
252,0   27        4     0.004594356  4391  I  WS 0 + 2 [dd]
252,0   27        5     0.004619473  1049  D  WS 0 + 2 [kworker/27:1H]
252,0   27        6     0.004634411   147  C  WS 0 + 2 [0]
252,0   27        7     0.004638609   147  C  WS 0 + 2 [0]
252,0   29        1     0.014589610  4394  Q  WS 0 + 8 [dd]
252,0   29        2     0.014595792  4394  B  WS 0 + 8 [dd]
252,0   29        3     0.014599028  4394  G  WS 0 + 8 [dd]
252,0   29        4     0.014601713  4394  I  WS 0 + 8 [dd]
252,0   29        5     0.014621330   807  D  WS 0 + 8 [kworker/29:1H]
252,0   29        6     0.014633813   157  C  WS 0 + 8 [0]
252,0   29        7     0.014637660   157  C  WS 0 + 8 [0]
252,0   30        1     0.009147174  4392  Q  WS 0 + 4 [dd]
252,0   30        2     0.009154377  4392  B  WS 0 + 4 [dd]
252,0   30        3     0.009163064  4392  G  WS 0 + 4 [dd]
252,0   30        4     0.009167161  4392  I  WS 0 + 4 [dd]
252,0   30        5     0.009191437  1084  D  WS 0 + 4 [kworker/30:1H]
252,0   30        6     0.009206084   162  C  WS 0 + 4 [0]
252,0   30        7     0.009210863   162  C  WS 0 + 4 [0]
252,0   30        8     0.018510473  4395  Q  WS 0 + 16 [dd]
252,0   30        9     0.018517767  4395  B  WS 0 + 16 [dd]
252,0   30       10     0.018521213  4395  G  WS 0 + 16 [dd]
252,0   30       11     0.018524229  4395  I  WS 0 + 16 [dd]
252,0   30       12     0.018544026  1084  D  WS 0 + 16 [kworker/30:1H]
252,0   30       13     0.018555127   162  C  WS 0 + 16 [0]
252,0   30       14     0.018558333   162  C  WS 0 + 16 [0]

33 more lines

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 6e6cbb953a12..8ddf2ba961f7 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -156,6 +156,10 @@ static int g_max_sectors;
 module_param_named(max_sectors, g_max_sectors, int, 0444);
 MODULE_PARM_DESC(max_sectors, "Maximum size of a command (in 512B sectors)");
 
+static unsigned int g_bounce_pfn;
+module_param_named(bounce_pfn, g_bounce_pfn, int, 0444);
+MODULE_PARM_DESC(bounce_pfn, "Queue Bounce limit (default: 0)");
+
 static unsigned int nr_devices = 1;
 module_param(nr_devices, uint, 0444);
 MODULE_PARM_DESC(nr_devices, "Number of devices to register");
@@ -354,6 +358,7 @@ NULLB_DEVICE_ATTR(submit_queues, uint, nullb_apply_submit_queues);
 NULLB_DEVICE_ATTR(home_node, uint, NULL);
 NULLB_DEVICE_ATTR(queue_mode, uint, NULL);
 NULLB_DEVICE_ATTR(blocksize, uint, NULL);
+NULLB_DEVICE_ATTR(bounce_pfn, uint, NULL);
 NULLB_DEVICE_ATTR(max_sectors, uint, NULL);
 NULLB_DEVICE_ATTR(irqmode, uint, NULL);
 NULLB_DEVICE_ATTR(hw_queue_depth, uint, NULL);
@@ -472,6 +477,7 @@ static struct configfs_attribute *nullb_device_attrs[] = {
 	&nullb_device_attr_home_node,
 	&nullb_device_attr_queue_mode,
 	&nullb_device_attr_blocksize,
+	&nullb_device_attr_bounce_pfn,
 	&nullb_device_attr_max_sectors,
 	&nullb_device_attr_irqmode,
 	&nullb_device_attr_hw_queue_depth,
@@ -543,7 +549,7 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item)
 static ssize_t memb_group_features_show(struct config_item *item, char *page)
 {
 	return snprintf(page, PAGE_SIZE,
-			"memory_backed,discard,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv,zone_max_open,zone_max_active,blocksize,max_sectors\n");
+			"memory_backed,discard,bounce_pfn,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv\n");
 }
 
 CONFIGFS_ATTR_RO(memb_group_, features);
@@ -1610,6 +1616,17 @@ static void null_config_discard(struct nullb *nullb)
 	blk_queue_flag_set(QUEUE_FLAG_DISCARD, nullb->q);
 }
 
+static void null_config_bounce_pfn(struct nullb *nullb)
+{
+	if (nullb->dev->memory_backed && nullb->dev->bounce_pfn == false)
+		return;
+
+	if (!nullb->dev->memory_backed && !g_bounce_pfn)
+		return;
+
+	blk_queue_bounce_limit(nullb->q, nullb->dev->bounce_pfn);
+}
+
 static const struct block_device_operations null_bio_ops = {
 	.owner		= THIS_MODULE,
 	.submit_bio	= null_submit_bio,
@@ -1882,6 +1899,7 @@ static int null_add_dev(struct nullb_device *dev)
 	blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
 
 	null_config_discard(nullb);
+	null_config_bounce_pfn(nullb);
 
 	sprintf(nullb->disk_name, "nullb%d", nullb->index);
 
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index 83504f3cc9d6..cd55f99118bf 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -86,6 +86,7 @@ struct nullb_device {
 	unsigned int queue_mode; /* block interface */
 	unsigned int blocksize; /* block size */
 	unsigned int max_sectors; /* Max sectors per command */
+	unsigned int bounce_pfn; /* bounce page frame number */
 	unsigned int irqmode; /* IRQ completion handler */
 	unsigned int hw_queue_depth; /* queue depth */
 	unsigned int index; /* index of the disk, only valid with a disk */
-- 
2.22.1

[PATCH 4/7] blktrace: fix blk_rq_merge documentation

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 05:34:34

The commit f3bdc62fd82e ("blktrace: Provide event for request merging")
added the comment for blk_rq_merge() tracepoint. Remove the duplicate
word from the tracepoint documentation.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 include/trace/events/block.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 004cfe34ef37..cc5ab96a7471 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -210,7 +210,7 @@ DEFINE_EVENT(block_rq, block_rq_issue,
 
 /**
  * block_rq_merge - merge request with another one in the elevator
- * @rq: block IO operation operation request
+ * @rq: block IO operation request
  *
  * Called when block operation request @rq from queue @q is merged to another
  * request queued in the elevator.
-- 
2.22.1

Re: [PATCH 1/7] block: remove superfluous param in blk_fill_rwbs()

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:04:26

On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
quoted hunk
The last parameter for the function blk_fill_rwbs() was added in
5782138e47 ("tracing/events: convert block trace points to
TRACE_EVENT()") in order to signal read request and use of that parameter
was replaced with using switch case REQ_OP_READ with
1b9a9ab78b0 ("blktrace: use op accessors"), but the parameter was never
removed.

Remove the unused parameter and adjust the respective call sites.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 include/linux/blktrace_api.h  |  2 +-
 include/trace/events/bcache.h | 10 +++++-----
 include/trace/events/block.h  | 16 ++++++++--------
 kernel/trace/blktrace.c       |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 05556573b896..11484f1d19a1 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -119,7 +119,7 @@ struct compat_blk_user_trace_setup {
 
 #endif
 
-extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes);
+extern void blk_fill_rwbs(char *rwbs, unsigned int op);
 
 static inline sector_t blk_rq_trace_sector(struct request *rq)
 {
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index e41c611d6d3b..899fdacf57b9 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(bcache_request,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->orig_sector	= bio->bi_iter.bi_sector - 16;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);

129 more quoted lines

Looks good.

Reviewed-by: Damien Le Moal <redacted>

-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 2/7] blktrace: add blk_fill_rwbs documentation comment

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:07:25

On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
quoted hunk
blk_fill_rwbs() is an expoted function, add kernel style documentation
comment.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 kernel/trace/blktrace.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 8a2591c7aa41..1a931afcf5c4 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1867,6 +1867,16 @@ void blk_trace_remove_sysfs(struct device *dev)
 
 #ifdef CONFIG_EVENT_TRACING
 
+/**
+ * blk_fill_rwbs - Fill the buffer rwbs by mapping op to character string.
+ * @rwbs	buffer to be filled
+ * @op:		REQ_OP_XXX for the tracepoint
+ *
+ * Description:
+ *     Maps the REQ_OP_XXX to character and fills the buffer provided by the
+ *     caller with resulting string.
+ *
+ **/
 void blk_fill_rwbs(char *rwbs, unsigned int op)
 {
 	int i = 0;
The description is a little redundant: the short description is enough I think.
But OK.

Reviewed-by: Damien Le Moal <redacted>


-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 3/7] blktrace: fix blk_rq_issue documentation

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:10:55

On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
The commit 881245dcff29 ("Add DocBook documentation for the block tracepoints.")
added the comment for blk_rq_issue() tracepoint. Remove the duplicate
word from the tracepoint documentation.

Signed-off-by: Chaitanya Kulkarni <redacted>
Fixes tag ?
quoted hunk
---
 include/trace/events/block.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 879cba8bdfca..004cfe34ef37 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -196,7 +196,7 @@ DEFINE_EVENT(block_rq, block_rq_insert,
 
 /**
  * block_rq_issue - issue pending block IO request operation to device driver
- * @rq: block IO operation operation request
+ * @rq: block IO operation request
  *
  * Called when block operation request @rq from queue @q is sent to a
  * device driver for processing.
Looks good.

Reviewed-by: Damien Le Moal <redacted>

-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 1/7] block: remove superfluous param in blk_fill_rwbs()

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:10:55

On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
The last parameter for the function blk_fill_rwbs() was added in
5782138e47 ("tracing/events: convert block trace points to
TRACE_EVENT()") in order to signal read request and use of that parameter
was replaced with using switch case REQ_OP_READ with
1b9a9ab78b0 ("blktrace: use op accessors"), but the parameter was never
removed.

Remove the unused parameter and adjust the respective call sites.

Signed-off-by: Chaitanya Kulkarni <redacted>
Fixes tag ?
quoted hunk
---
 include/linux/blktrace_api.h  |  2 +-
 include/trace/events/bcache.h | 10 +++++-----
 include/trace/events/block.h  | 16 ++++++++--------
 kernel/trace/blktrace.c       |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 05556573b896..11484f1d19a1 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -119,7 +119,7 @@ struct compat_blk_user_trace_setup {
 
 #endif
 
-extern void blk_fill_rwbs(char *rwbs, unsigned int op, int bytes);
+extern void blk_fill_rwbs(char *rwbs, unsigned int op);
 
 static inline sector_t blk_rq_trace_sector(struct request *rq)
 {
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index e41c611d6d3b..899fdacf57b9 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(bcache_request,
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->orig_sector	= bio->bi_iter.bi_sector - 16;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),
 
 	TP_printk("%d,%d %s %llu + %u (from %d,%d @ %llu)",
@@ -102,7 +102,7 @@ DECLARE_EVENT_CLASS(bcache_bio,
 		__entry->dev		= bio_dev(bio);
 		__entry->sector		= bio->bi_iter.bi_sector;
 		__entry->nr_sector	= bio->bi_iter.bi_size >> 9;
-		blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
+		blk_fill_rwbs(__entry->rwbs, bio->bi_opf);
 	),

119 more quoted lines


-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 5/7] block: get rid of the trace rq insert wrapper

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:10:55

On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
quoted hunk
Get rid of the wrapper for trace_block_rq_insert() and call the function
directly.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 block/bfq-iosched.c     | 4 +++-
 block/blk-mq-sched.c    | 6 ------
 block/blk-mq-sched.h    | 1 -
 block/kyber-iosched.c   | 4 +++-
 block/mq-deadline.c     | 4 +++-
 kernel/trace/blktrace.c | 1 +
 6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index dfa87e360d71..da5e1f620625 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -125,6 +125,8 @@
 #include <linux/delay.h>
 #include <linux/backing-dev.h>
 
+#include <trace/events/block.h>
+
 #include "blk.h"
 #include "blk-mq.h"
 #include "blk-mq-tag.h"
@@ -5621,7 +5623,7 @@ static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq,
 
 	spin_unlock_irq(&bfqd->lock);
 
-	blk_mq_sched_request_inserted(rq);
+	trace_block_rq_insert(rq);
 
 	spin_lock_irq(&bfqd->lock);
 	bfqq = bfq_init_rq(rq);
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index deff4e826e23..ddb65e9e6fd9 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -384,12 +384,6 @@ bool blk_mq_sched_try_insert_merge(struct request_queue *q, struct request *rq)

81 more quoted lines

Looks good.

Reviewed-by: Damien Le Moal <redacted>

-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 4/7] blktrace: fix blk_rq_merge documentation

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:10:56

On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
The commit f3bdc62fd82e ("blktrace: Provide event for request merging")
added the comment for blk_rq_merge() tracepoint. Remove the duplicate
word from the tracepoint documentation.

Signed-off-by: Chaitanya Kulkarni <redacted>
Fixes tag ?
quoted hunk
---
 include/trace/events/block.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index 004cfe34ef37..cc5ab96a7471 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -210,7 +210,7 @@ DEFINE_EVENT(block_rq, block_rq_issue,
 
 /**
  * block_rq_merge - merge request with another one in the elevator
- * @rq: block IO operation operation request
+ * @rq: block IO operation request
  *
  * Called when block operation request @rq from queue @q is merged to another
  * request queued in the elevator.
Otherwise looks good.

Reviewed-by: Damien Le Moal <redacted>

-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 6/7] null_blk: allow disacrd on non-membacked mode

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:14:32

Typo in the patch title.


On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
null blk driver supports REQ_OP_DISACRD in membacked mode. When testing
special requests having REQ_OP_DISCARD support is helpful to validate
the special request path when mixed with read-write.

Consider module parameter when setting the queue discard flag when
device is not memory backed.

This is needed to test the tracepoint related to REQ_OP_DISCARD.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
# modprobe  -r null_blk
# gitlog -7 
4ac4d49e1028 (HEAD -> for-next) null_blk: add module param queue bounce limit
468e3617dae8 null_blk: allow disacrd on non-membacked mode
bdc96efe9681 block: get rid of the trace rq insert wrapper
73bf523a7ce4 blktrace: fix blk_rq_merge documentation
6016632555da blktrace: fix blk_rq_issue documentation
58b5d7103a94 blktrace: add blk_fill_rwbs documentation comment
534f321f57dd block: remove superfluous param in blk_fill_rwbs()

Test to exercise module parameter vs configfs discard param, set up
nullb0 such a way that it errors out in both cases for module param
discard :-

for discard in 0 1
do 
	modprobe -r null_blk
	i=0
	echo "Module param discard ${discard}"
	modprobe null_blk nr_devices=0 discard=${discard}
	# Create dev 0 no discard 
	NULLB_DIR=config/nullb/nullb${i}
	mkdir config/nullb/nullb${i}
	echo 1 > config/nullb/nullb${i}/memory_backed
	echo 512 > config/nullb/nullb${i}/blocksize 
	echo 2048 > config/nullb/nullb${i}/size 
	echo 1 > config/nullb/nullb${i}/power
	echo -n "$nullb${i} membacked : ";
	cat /sys/kernel/config/nullb/nullb${i}/memory_backed 

88 more quoted lines

What is the point of adding nullb->dev->memory_backed  to the test ? If
nullb->dev->memory_backed is true, nullb->dev->discard should be forced to true
also to retain the behavior we had until now.
quoted hunk
 		return;
 
-	if (!nullb->dev->memory_backed) {
-		nullb->dev->discard = false;
-		pr_info("discard option is ignored without memory backing\n");
+	if (!nullb->dev->memory_backed && !g_discard)
I do not understand this one either. Why look at g_discard ?
quoted hunk
 		return;
-	}
 
 	if (nullb->dev->zoned) {
 		nullb->dev->discard = false;

-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 7/7] null_blk: add module param queue bounce limit

From: Damien Le Moal <hidden>
Date: 2021-02-02 09:20:34

On 2021/02/02 14:26, Chaitanya Kulkarni wrote:
This patch adds a new module parameter to set the queue bounce limit.
Various queue limits parameters are usually present in the sysfs.
This is needed for testing purpose only so instead of poluting the
sysfs space just update the null_blk drivers.

This is needed especially for blktrace bounce related tracepoint
testing.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
# modprobe null_blk bounce_pfn=0x1000
# for bs in 512 1024 2048 4096 8192
quoted
do
	dd if=/dev/zero of=/dev/nullb0 bs=${bs} count=1 oflag=direct
done
# ~/blktrace/blktrace -a write -d /dev/nullb0 -o -| ~/blktrace/blkparse -i -
#
# # With null_blk bounce 
# modprobe null_blk bounce_pfn=0x1000
#
252,0   34        1     0.000000000  4390  Q  WS 0 + 1 [dd]
252,0   34        2     0.000010139  4390  B  WS 0 + 1 [dd]
252,0   34        3     0.000018996  4390  G  WS 0 + 1 [dd]
252,0   34        4     0.000024576  4390  I  WS 0 + 1 [dd]
252,0   34        5     0.000065152   829  D  WS 0 + 1 [kworker/34:1H]
252,0   34        6     0.000092303   182  C  WS 0 + 1 [0]
252,0   34        7     0.000098164   182  C  WS 0 + 1 [0]
252,0   27        1     0.004573597  4391  Q  WS 0 + 2 [dd]
252,0   27        2     0.004580891  4391  B  WS 0 + 2 [dd]
252,0   27        3     0.004589687  4391  G  WS 0 + 2 [dd]
252,0   27        4     0.004594356  4391  I  WS 0 + 2 [dd]
252,0   27        5     0.004619473  1049  D  WS 0 + 2 [kworker/27:1H]
252,0   27        6     0.004634411   147  C  WS 0 + 2 [0]
252,0   27        7     0.004638609   147  C  WS 0 + 2 [0]
252,0   29        1     0.014589610  4394  Q  WS 0 + 8 [dd]
252,0   29        2     0.014595792  4394  B  WS 0 + 8 [dd]
252,0   29        3     0.014599028  4394  G  WS 0 + 8 [dd]
252,0   29        4     0.014601713  4394  I  WS 0 + 8 [dd]
252,0   29        5     0.014621330   807  D  WS 0 + 8 [kworker/29:1H]
252,0   29        6     0.014633813   157  C  WS 0 + 8 [0]

95 more quoted lines

nullb->dev->bounce_pfn is not a bool... So maybe !nullb->dev->bounce_pfn ?
quoted hunk
+		return;
+
+	if (!nullb->dev->memory_backed && !g_bounce_pfn)
Why ?
quoted hunk
+		return;
+
+	blk_queue_bounce_limit(nullb->q, nullb->dev->bounce_pfn);
Shouldn't this function simply be:

static void null_config_bounce_pfn(struct nullb *nullb)
{
	if (nullb->dev->memory_backed && nullb->dev->bounce_pfn)
		blk_queue_bounce_limit(nullb->q, nullb->dev->bounce_pfn);
}

?
quoted hunk
+}
+
 static const struct block_device_operations null_bio_ops = {
 	.owner		= THIS_MODULE,
 	.submit_bio	= null_submit_bio,
@@ -1882,6 +1899,7 @@ static int null_add_dev(struct nullb_device *dev)
 	blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
 
 	null_config_discard(nullb);
+	null_config_bounce_pfn(nullb);
Where do you assign bounce_pfn to nullb->dev->bounce_pfn ? Something is missing
here...
quoted hunk
 
 	sprintf(nullb->disk_name, "nullb%d", nullb->index);
 
diff --git a/drivers/block/null_blk/null_blk.h b/drivers/block/null_blk/null_blk.h
index 83504f3cc9d6..cd55f99118bf 100644
--- a/drivers/block/null_blk/null_blk.h
+++ b/drivers/block/null_blk/null_blk.h
@@ -86,6 +86,7 @@ struct nullb_device {
 	unsigned int queue_mode; /* block interface */
 	unsigned int blocksize; /* block size */
 	unsigned int max_sectors; /* Max sectors per command */
+	unsigned int bounce_pfn; /* bounce page frame number */
 	unsigned int irqmode; /* IRQ completion handler */
 	unsigned int hw_queue_depth; /* queue depth */
 	unsigned int index; /* index of the disk, only valid with a disk */

-- 
Damien Le Moal
Western Digital Research

Re: [PATCH 1/7] block: remove superfluous param in blk_fill_rwbs()

From: Christoph Hellwig <hch@lst.de>
Date: 2021-02-02 09:35:40

Please also drop the extern while you're at it.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH 2/7] blktrace: add blk_fill_rwbs documentation comment

From: Christoph Hellwig <hch@lst.de>
Date: 2021-02-02 09:36:09

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH 3/7] blktrace: fix blk_rq_issue documentation

From: Christoph Hellwig <hch@lst.de>
Date: 2021-02-02 09:36:59

On Mon, Feb 01, 2021 at 09:25:40PM -0800, Chaitanya Kulkarni wrote:
The commit 881245dcff29 ("Add DocBook documentation for the block tracepoints.")
added the comment for blk_rq_issue() tracepoint. Remove the duplicate
word from the tracepoint documentation.

Signed-off-by: Chaitanya Kulkarni <redacted>
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH 4/7] blktrace: fix blk_rq_merge documentation

From: Christoph Hellwig <hch@lst.de>
Date: 2021-02-02 09:37:46

On Mon, Feb 01, 2021 at 09:25:41PM -0800, Chaitanya Kulkarni wrote:
The commit f3bdc62fd82e ("blktrace: Provide event for request merging")
added the comment for blk_rq_merge() tracepoint. Remove the duplicate
word from the tracepoint documentation.
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH 5/7] block: get rid of the trace rq insert wrapper

From: Christoph Hellwig <hch@lst.de>
Date: 2021-02-02 09:39:25

On Mon, Feb 01, 2021 at 09:25:42PM -0800, Chaitanya Kulkarni wrote:
Get rid of the wrapper for trace_block_rq_insert() and call the function
directly.
The placement of the EXPORT_TRACEPOINT_SYMBOL_GPL looks very strange,
I'd keep it with the other EXPORT_TRACEPOINT_SYMBOL_GPL instances in
blk-core.c.

Otherwise this looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Re: [PATCH 6/7] null_blk: allow disacrd on non-membacked mode

From: Christoph Hellwig <hch@lst.de>
Date: 2021-02-02 09:39:25

What does this have to do with blktrace?

Also discard is misspelled in the subject.

Re: [PATCH 2/7] blktrace: add blk_fill_rwbs documentation comment

From: Johannes Thumshirn <hidden>
Date: 2021-02-02 09:56:47

On 02/02/2021 06:26, Chaitanya Kulkarni wrote:
blk_fill_rwbs() is an expoted function, add kernel style documentation               exported ~^
Otherwise,
Reviewed-by: Johannes Thumshirn <redacted>

Re: [PATCH 1/7] block: remove superfluous param in blk_fill_rwbs()

From: Johannes Thumshirn <hidden>
Date: 2021-02-02 09:57:34

Looks good,
Reviewed-by: Johannes Thumshirn <redacted>

Re: [PATCH 3/7] blktrace: fix blk_rq_issue documentation

From: Johannes Thumshirn <hidden>
Date: 2021-02-02 09:57:48

Looks good,
Reviewed-by: Johannes Thumshirn <<redacted>

Re: [PATCH 4/7] blktrace: fix blk_rq_merge documentation

From: Johannes Thumshirn <hidden>
Date: 2021-02-02 09:59:01

Looks good,
Reviewed-by: Johannes Thumshirn <redacted>

Re: [PATCH 5/7] block: get rid of the trace rq insert wrapper

From: Johannes Thumshirn <hidden>
Date: 2021-02-02 10:00:15

Looks good,
Reviewed-by: Johannes Thumshirn <redacted>

Re: [PATCH 6/7] null_blk: allow disacrd on non-membacked mode

From: Chaitanya Kulkarni <hidden>
Date: 2021-02-02 20:18:24

On 2/2/21 01:36, Christoph Hellwig wrote:
What does this have to do with blktrace?

Also discard is misspelled in the subject.
I used these two patches for testing as discard is non conventional
request which I think needs testing to make sure all types of requests
are passing these changes.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help