* [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues
@ 2014-07-25 21:45 Sam Bradshaw
2014-07-25 23:41 ` Keith Busch
0 siblings, 1 reply; 3+ messages in thread
From: Sam Bradshaw @ 2014-07-25 21:45 UTC (permalink / 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,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues
2014-07-25 21:45 [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues Sam Bradshaw
@ 2014-07-25 23:41 ` Keith Busch
2014-07-25 23:49 ` Sam Bradshaw (sbradshaw)
0 siblings, 1 reply; 3+ messages in thread
From: Keith Busch @ 2014-07-25 23:41 UTC (permalink / raw)
On Fri, 25 Jul 2014, Sam Bradshaw wrote:
> 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.
Oh you're right, but I think the idea was to use the queue associated
with the cpu, though the code was clearly broken before.
- return nvme_submit_sync_cmd(dev, smp_processor_id() + 1, cmd, result,
+ return nvme_submit_sync_cmd(dev, this_cpu_read(*dev->io_queues), cmd, result,
NVME_IO_TIMEOUT);
> 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,
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues
2014-07-25 23:41 ` Keith Busch
@ 2014-07-25 23:49 ` Sam Bradshaw (sbradshaw)
0 siblings, 0 replies; 3+ messages in thread
From: Sam Bradshaw (sbradshaw) @ 2014-07-25 23:49 UTC (permalink / raw)
> -----Original Message-----
> From: Keith Busch [mailto:keith.busch at intel.com]
> Sent: Friday, July 25, 2014 4:41 PM
> To: Sam Bradshaw (sbradshaw)
> Cc: linux-nvme at lists.infradead.org
> Subject: Re: [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus >
> online queues
>
> On Fri, 25 Jul 2014, Sam Bradshaw wrote:
> > 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.
>
> Oh you're right, but I think the idea was to use the queue associated
> with the cpu, though the code was clearly broken before.
>
> - return nvme_submit_sync_cmd(dev, smp_processor_id() + 1, cmd,
> result,
> + return nvme_submit_sync_cmd(dev, this_cpu_read(*dev->io_queues),
> cmd, result,
> NVME_IO_TIMEOUT);
Agreed. The above is more consistent with other queue selection paths.
Do you want to send an updated patch or should I?
-Sam
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-25 23:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25 21:45 [PATCH] NVMe: Correctly handle IOCTL_SUBMIT_IO when cpus > online queues Sam Bradshaw
2014-07-25 23:41 ` Keith Busch
2014-07-25 23:49 ` Sam Bradshaw (sbradshaw)
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.