Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@linux.intel.com (Keith Busch)
Subject: Read request exceeding max_hw_sectors_kb
Date: Thu, 14 Jun 2018 08:54:48 -0600	[thread overview]
Message-ID: <20180614145447.GB8129@localhost.localdomain> (raw)
In-Reply-To: <0ba3cccb9d2ee7cba50a91bfc92b373a@mail.gmail.com>

On Wed, Jun 13, 2018@04:11:56PM +0530, Jitendra Bhivare wrote:
> So something like resolves the issue:
> static void nvme_set_chunk_size(struct nvme_ns *ns)
> {
> 	u32 chunk_size = (((u32)ns->noiob) << (ns->lba_shift - 9));
> 
> 	chunk_size = rounddown_pow_of_two(chunk_size);
> 	chunk_size = min(ns->ctrl->max_hw_sectors, chunk_size);
> 	blk_queue_chunk_sectors(ns->queue,
> rounddown_pow_of_two(chunk_size));
> }

That doesn't look right. The io boundary may have nothing to do with max
transfer size, so throttling the chunk size may cause lots of
unnecessary splits.

Isn't the reason it's failing is the block layer allowed a command to
form to the chunk size boundary instead of capping it to the max transfer
limit? How about this patch instead?

---
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bca3a92eb55f..9c57b49a4132 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1118,8 +1118,8 @@ static inline unsigned int blk_max_size_offset(struct request_queue *q,
 	if (!q->limits.chunk_sectors)
 		return q->limits.max_sectors;
 
-	return q->limits.chunk_sectors -
-			(offset & (q->limits.chunk_sectors - 1));
+	return min(q->limits.max_sectors, (unsigned int)(q->limits.chunk_sectors -
+			(offset & (q->limits.chunk_sectors - 1))));
 }
 
 static inline unsigned int blk_rq_get_max_sectors(struct request *rq,
--

  parent reply	other threads:[~2018-06-14 14:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-13 10:41 Read request exceeding max_hw_sectors_kb Jitendra Bhivare
2018-06-13 11:47 ` Christoph Hellwig
2018-06-13 17:00   ` Daniel Verkamp
2018-06-14 10:16     ` Jitendra Bhivare
2018-06-14 14:54 ` Keith Busch [this message]
2018-06-15 13:58   ` Jitendra Bhivare
2018-06-26 10:47   ` Jitendra Bhivare
2018-06-26 15:07     ` Keith Busch
2018-06-27 10:28       ` Jitendra Bhivare

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=20180614145447.GB8129@localhost.localdomain \
    --to=keith.busch@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox