All of lore.kernel.org
 help / color / mirror / Atom feed
From: sbradshaw@micron.com (Sam Bradshaw)
Subject: [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues
Date: Fri, 25 Jul 2014 14:45:31 -0700	[thread overview]
Message-ID: <53D2CFFB.8010908@micron.com> (raw)

nvme_submit_io_cmd() use smp_processor_id() to pick an IO queue index.  This patch
fixes the case where there are more cpus from which the ioctl call can originate 
than online queues, which can happen when a device supports or was allocated fewer 
interrupt vectors than exist cpu cores.

Signed-off-by: Sam Bradshaw <sbradshaw at micron.com>
---

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 28aec2d..5171753 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -979,8 +979,9 @@ int nvme_submit_admin_cmd(struct nvme_dev *dev, struct nvme_command *cmd,
 int nvme_submit_io_cmd(struct nvme_dev *dev, struct nvme_command *cmd,
 								u32 *result)
 {
-	return nvme_submit_sync_cmd(dev, smp_processor_id() + 1, cmd, result,
-							NVME_IO_TIMEOUT);
+	return nvme_submit_sync_cmd(dev, (smp_processor_id() %
+						(dev->online_queues - 1)) + 1,
+						 cmd, result, NVME_IO_TIMEOUT);
 }
 
 static int nvme_submit_admin_cmd_async(struct nvme_dev *dev,

             reply	other threads:[~2014-07-25 21:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 21:45 Sam Bradshaw [this message]
2014-07-25 23:41 ` [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues Keith Busch
2014-07-25 23:49   ` Sam Bradshaw (sbradshaw)

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=53D2CFFB.8010908@micron.com \
    --to=sbradshaw@micron.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 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.