All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: axboe@kernel.dk, viro@zeniv.linux.org.uk, rostedt@goodmis.org,
	mingo@redhat.com, chaitanya.kulkarni@wdc.com,
	johannes.thumshirn@wdc.com, damien.lemoal@wdc.com,
	bvanassche@acm.org, dongli.zhang@oracle.com,
	aravind.ramesh@wdc.com, joshi.k@samsung.com,
	niklas.cassel@wdc.com, hch@lst.de, osandov@fb.com,
	martin.petersen@oracle.com
Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [RFC PATCH 39/39] blktrace: debug patch for the demo
Date: Wed, 24 Feb 2021 23:02:31 -0800	[thread overview]
Message-ID: <20210225070231.21136-40-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20210225070231.21136-1-chaitanya.kulkarni@wdc.com>

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/blk-lib.c                   |  4 ++++
 block/blk-zoned.c                 |  1 +
 drivers/block/null_blk/main.c     | 32 ++++++++++++++++++++++++-------
 drivers/block/null_blk/null_blk.h |  1 +
 4 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/block/blk-lib.c b/block/blk-lib.c
index 752f9c722062..dd8854341bf6 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -98,6 +98,7 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
 		bio->bi_iter.bi_sector = sector;
 		bio_set_dev(bio, bdev);
 		bio_set_op_attrs(bio, op, 0);
+		bio_set_prio(bio, get_current_ioprio());
 
 		bio->bi_iter.bi_size = req_sects << 9;
 		sector += req_sects;
@@ -191,6 +192,7 @@ static int __blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
 		bio = blk_next_bio(bio, 1, gfp_mask);
 		bio->bi_iter.bi_sector = sector;
 		bio_set_dev(bio, bdev);
+		bio_set_prio(bio, get_current_ioprio());
 		bio->bi_vcnt = 1;
 		bio->bi_io_vec->bv_page = page;
 		bio->bi_io_vec->bv_offset = 0;
@@ -267,6 +269,7 @@ static int __blkdev_issue_write_zeroes(struct block_device *bdev,
 		bio = blk_next_bio(bio, 0, gfp_mask);
 		bio->bi_iter.bi_sector = sector;
 		bio_set_dev(bio, bdev);
+		bio_set_prio(bio, get_current_ioprio());
 		bio->bi_opf = REQ_OP_WRITE_ZEROES;
 		if (flags & BLKDEV_ZERO_NOUNMAP)
 			bio->bi_opf |= REQ_NOUNMAP;
@@ -319,6 +322,7 @@ static int __blkdev_issue_zero_pages(struct block_device *bdev,
 				   gfp_mask);
 		bio->bi_iter.bi_sector = sector;
 		bio_set_dev(bio, bdev);
+		bio_set_prio(bio, get_current_ioprio());
 		bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
 
 		while (nr_sects != 0) {
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 833978c02e60..3df0f22cbc54 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -233,6 +233,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,
 	while (sector < end_sector) {
 		bio = blk_next_bio(bio, 0, gfp_mask);
 		bio_set_dev(bio, bdev);
+		bio_set_prio(bio, get_current_ioprio());
 
 		/*
 		 * Special case for the zone reset operation that reset all
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index d6c821d48090..0c2bc7188d27 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -84,6 +84,10 @@ enum {
 	NULL_Q_MQ		= 2,
 };
 
+static bool g_discard;
+module_param_named(discard, g_discard, bool, 0444);
+MODULE_PARM_DESC(discard, "Enable queue discard (default: false)");
+
 static int g_no_sched;
 module_param_named(no_sched, g_no_sched, int, 0444);
 MODULE_PARM_DESC(no_sched, "No io scheduler");
@@ -156,6 +160,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");
@@ -350,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);
@@ -468,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,
@@ -539,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);
@@ -600,6 +610,7 @@ static struct nullb_device *null_alloc_dev(void)
 	dev->blocking = g_blocking;
 	dev->use_per_node_hctx = g_use_per_node_hctx;
 	dev->zoned = g_zoned;
+	dev->discard = g_discard;
 	dev->zone_size = g_zone_size;
 	dev->zone_capacity = g_zone_capacity;
 	dev->zone_nr_conv = g_zone_nr_conv;
@@ -1588,15 +1599,10 @@ static void null_del_dev(struct nullb *nullb)
 
 static void null_config_discard(struct nullb *nullb)
 {
+	blk_queue_max_write_zeroes_sectors(nullb->q, UINT_MAX >> 9);
 	if (nullb->dev->discard == false)
 		return;
 
-	if (!nullb->dev->memory_backed) {
-		nullb->dev->discard = false;
-		pr_info("discard option is ignored without memory backing\n");
-		return;
-	}
-
 	if (nullb->dev->zoned) {
 		nullb->dev->discard = false;
 		pr_info("discard option is ignored in zoned mode\n");
@@ -1609,6 +1615,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,
@@ -1881,6 +1898,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


  parent reply	other threads:[~2021-02-25  7:11 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25  7:01 [RFC PATCH 00/39] blktrace: add block trace extension support Chaitanya Kulkarni
2021-02-25  7:01 ` [RFC PATCH 01/39] blktrace_api: add new trace definitions Chaitanya Kulkarni
2021-02-26  4:31   ` Damien Le Moal
2021-02-25  7:01 ` [RFC PATCH 02/39] blktrace_api: add new trace definition Chaitanya Kulkarni
2021-02-26  4:33   ` Damien Le Moal
2021-02-25  7:01 ` [RFC PATCH 03/39] blkdev.h: add new trace ext as a queue member Chaitanya Kulkarni
2021-02-26  4:35   ` Damien Le Moal
2021-02-25  7:01 ` [RFC PATCH 04/39] blktrace: add a new global list Chaitanya Kulkarni
2021-02-26  4:36   ` Damien Le Moal
2021-02-25  7:01 ` [RFC PATCH 05/39] blktrace: add trace note APIs Chaitanya Kulkarni
2021-02-25  9:07   ` kernel test robot
2021-02-25 12:12   ` kernel test robot
2021-02-26  4:39   ` Damien Le Moal
2021-02-25  7:01 ` [RFC PATCH 06/39] blktrace: add act and prio check helpers Chaitanya Kulkarni
2021-02-26  4:41   ` Damien Le Moal
2021-02-25  7:01 ` [RFC PATCH 07/39] blktrace: add core trace API Chaitanya Kulkarni
2021-02-26  4:44   ` Damien Le Moal
2021-02-25  7:02 ` [RFC PATCH 08/39] blktrace: update blk_add_trace_rq() Chaitanya Kulkarni
2021-02-26  4:46   ` Damien Le Moal
2021-02-25  7:02 ` [RFC PATCH 09/39] blktrace: update blk_add_trace_rq_insert() Chaitanya Kulkarni
2021-02-26  4:48   ` Damien Le Moal
2021-02-25  7:02 ` [RFC PATCH 10/39] blktrace: update blk_add_trace_rq_issue() Chaitanya Kulkarni
2021-02-25 13:14   ` kernel test robot
2021-02-26  4:48   ` Damien Le Moal
2021-02-25  7:02 ` [RFC PATCH 11/39] blktrace: update blk_add_trace_rq_requeue() Chaitanya Kulkarni
2021-02-26  4:48   ` Damien Le Moal
2021-02-25  7:02 ` [RFC PATCH 12/39] blktrace: update blk_add_trace_rq_complete() Chaitanya Kulkarni
2021-02-26  4:48   ` Damien Le Moal
2021-02-25  7:02 ` [RFC PATCH 13/39] blktrace: update blk_add_trace_bio() Chaitanya Kulkarni
2021-02-26  4:49   ` Damien Le Moal
2021-02-25  7:02 ` [RFC PATCH 14/39] blktrace: update blk_add_trace_bio_bounce() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 15/39] blktrace: update blk_add_trace_bio_complete() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 16/39] blktrace: update blk_add_trace_bio_backmerge() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 17/39] blktrace: update blk_add_trace_bio_frontmerge() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 18/39] blktrace: update blk_add_trace_bio_queue() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 19/39] blktrace: update blk_add_trace_getrq() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 20/39] blktrace: update blk_add_trace_plug() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 21/39] blktrace: update blk_add_trace_unplug() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 22/39] blktrace: update blk_add_trace_split() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 23/39] blktrace: update blk_add_trace_bio_remap() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 24/39] blktrace: update blk_add_trace_rq_remap() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 25/39] blktrace: update blk_add_driver_data() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 26/39] blktrace: add trace entry & pdu helpers Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 27/39] blktrace: add a new formatting routine Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 28/39] blktrace: add blk_log_xxx helpers() Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 29/39] blktrace: link blk_log_xxx() to trace action Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 30/39] blktrace: add trace event print helper Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 31/39] blktrace: add trace_synthesize helper Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 32/39] blktrace: add trace print helpers Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 33/39] blktrace: add blkext tracer Chaitanya Kulkarni
2021-02-27 11:44   ` [blktrace] c055908abe: WARNING:at_kernel/trace/trace.c:#create_trace_option_files kernel test robot
2021-02-27 11:44     ` kernel test robot
2021-02-27 14:49     ` Steven Rostedt
2021-02-27 14:49       ` Steven Rostedt
2021-02-27 19:51       ` Chaitanya Kulkarni
2021-02-27 19:51       ` Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 34/39] blktrace: implement setup-start-stop ioclts Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 35/39] block: update blkdev_ioctl with new trace ioctls Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 36/39] blktrace: add integrity tracking support Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 37/39] blktrace: update blk_fill_rwbs() with new requests Chaitanya Kulkarni
2021-02-25  7:02 ` [RFC PATCH 38/39] blktrace: track zone appaend completion sector Chaitanya Kulkarni
2021-02-25  7:02 ` Chaitanya Kulkarni [this message]
2021-02-26  4:25 ` [RFC PATCH 00/39] blktrace: add block trace extension support Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210225070231.21136-40-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=aravind.ramesh@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@wdc.com \
    --cc=dongli.zhang@oracle.com \
    --cc=hch@lst.de \
    --cc=johannes.thumshirn@wdc.com \
    --cc=joshi.k@samsung.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mingo@redhat.com \
    --cc=niklas.cassel@wdc.com \
    --cc=osandov@fb.com \
    --cc=rostedt@goodmis.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.