* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
[not found] ` <bf3f47ba50f72d0b775ca4bd098f183056d964ba.1592916850.git.baolin.wang@linux.alibaba.com>
@ 2020-06-23 14:40 ` Keith Busch
2020-06-23 17:39 ` Sagi Grimberg
2020-06-24 2:57 ` Keith Busch
1 sibling, 1 reply; 13+ messages in thread
From: Keith Busch @ 2020-06-23 14:40 UTC (permalink / raw)
To: Baolin Wang; +Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, hch
On Tue, Jun 23, 2020 at 09:24:32PM +0800, Baolin Wang wrote:
> From the NVMe spec, "In order to make efficient use of the non-volatile
> memory, it is often advantageous to execute multiple commands from a
> Submission Queue in parallel. For Submission Queues that are using
> weighted round robin with urgent priority class or round robin
> arbitration, host software may configure an Arbitration Burst setting".
> Thus add Arbitration Burst setting support.
But if the user changed it to something else that better matches how
they want to use queues, the driver is just going to undo that setting
on the next reset.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro
[not found] ` <eab18c7696ea0e34a6ab0371d7d17ad45d1566ce.1592916850.git.baolin.wang@linux.alibaba.com>
@ 2020-06-23 16:27 ` Christoph Hellwig
2020-06-24 2:07 ` Baolin Wang
2020-06-24 2:58 ` Keith Busch
0 siblings, 2 replies; 13+ messages in thread
From: Christoph Hellwig @ 2020-06-23 16:27 UTC (permalink / raw)
To: Baolin Wang
Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, kbusch, hch
On Tue, Jun 23, 2020 at 09:24:33PM +0800, Baolin Wang wrote:
> Introduce a new capability macro to indicate if the controller
> supports the memory buffer or not, instead of reading the
> NVME_REG_CMBSZ register.
This is a complex issue. The CMBS bit was only added in NVMe 1.4 as
a backwards incompatible change, as the CMB addressing scheme can lead
to data corruption. The CMBS was added as part of the horribe hack
that also involves the CBA field, which we'll need to see before
using it to work around the addressing issue. At the same time we
should also continue supporting the legacy pre-1.4 CMB with a warning
(and may reject it if we know we run in a VM).
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
2020-06-23 14:40 ` [PATCH 1/3] nvme: Add Arbitration Burst support Keith Busch
@ 2020-06-23 17:39 ` Sagi Grimberg
2020-06-23 18:01 ` Keith Busch
0 siblings, 1 reply; 13+ messages in thread
From: Sagi Grimberg @ 2020-06-23 17:39 UTC (permalink / raw)
To: Keith Busch, Baolin Wang
Cc: axboe, baolin.wang7, hch, linux-nvme, linux-kernel
>> From the NVMe spec, "In order to make efficient use of the non-volatile
>> memory, it is often advantageous to execute multiple commands from a
>> Submission Queue in parallel. For Submission Queues that are using
>> weighted round robin with urgent priority class or round robin
>> arbitration, host software may configure an Arbitration Burst setting".
>> Thus add Arbitration Burst setting support.
>
> But if the user changed it to something else that better matches how
> they want to use queues, the driver is just going to undo that setting
> on the next reset.
Where do we do priority class arbitration? no one sets it
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/3] nvme: Use USEC_PER_SEC instead of magic numbers
[not found] ` <a64d35465b8d91ab11f37d814ac10003da7804b8.1592916850.git.baolin.wang@linux.alibaba.com>
@ 2020-06-23 17:39 ` Sagi Grimberg
0 siblings, 0 replies; 13+ messages in thread
From: Sagi Grimberg @ 2020-06-23 17:39 UTC (permalink / raw)
To: Baolin Wang, kbusch, axboe, hch; +Cc: baolin.wang7, linux-kernel, linux-nvme
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
2020-06-23 17:39 ` Sagi Grimberg
@ 2020-06-23 18:01 ` Keith Busch
2020-06-24 1:34 ` Baolin Wang
0 siblings, 1 reply; 13+ messages in thread
From: Keith Busch @ 2020-06-23 18:01 UTC (permalink / raw)
To: Sagi Grimberg
Cc: linux-kernel, linux-nvme, axboe, Baolin Wang, baolin.wang7, hch
On Tue, Jun 23, 2020 at 10:39:01AM -0700, Sagi Grimberg wrote:
>
> > > From the NVMe spec, "In order to make efficient use of the non-volatile
> > > memory, it is often advantageous to execute multiple commands from a
> > > Submission Queue in parallel. For Submission Queues that are using
> > > weighted round robin with urgent priority class or round robin
> > > arbitration, host software may configure an Arbitration Burst setting".
> > > Thus add Arbitration Burst setting support.
> >
> > But if the user changed it to something else that better matches how
> > they want to use queues, the driver is just going to undo that setting
> > on the next reset.
>
> Where do we do priority class arbitration? no one sets it
Not the priority class, we don't use WRR in this driver. The RR
arbitration can be set from user space and saved across controller
resets, like:
# nvme set-feature -f 1 -v 3 --save
This patch would undo the saved feature value.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
2020-06-23 18:01 ` Keith Busch
@ 2020-06-24 1:34 ` Baolin Wang
2020-06-24 2:51 ` Keith Busch
0 siblings, 1 reply; 13+ messages in thread
From: Baolin Wang @ 2020-06-24 1:34 UTC (permalink / raw)
To: Keith Busch
Cc: Sagi Grimberg, linux-kernel, linux-nvme, axboe, baolin.wang7, hch
On Tue, Jun 23, 2020 at 11:01:08AM -0700, Keith Busch wrote:
> On Tue, Jun 23, 2020 at 10:39:01AM -0700, Sagi Grimberg wrote:
> >
> > > > From the NVMe spec, "In order to make efficient use of the non-volatile
> > > > memory, it is often advantageous to execute multiple commands from a
> > > > Submission Queue in parallel. For Submission Queues that are using
> > > > weighted round robin with urgent priority class or round robin
> > > > arbitration, host software may configure an Arbitration Burst setting".
> > > > Thus add Arbitration Burst setting support.
> > >
> > > But if the user changed it to something else that better matches how
> > > they want to use queues, the driver is just going to undo that setting
> > > on the next reset.
> >
> > Where do we do priority class arbitration? no one sets it
>
> Not the priority class, we don't use WRR in this driver. The RR
> arbitration can be set from user space and saved across controller
> resets, like:
>
> # nvme set-feature -f 1 -v 3 --save
>
> This patch would undo the saved feature value.
OK, I understaood your concern. Now we will select the RR arbitration as default
in nvme_enable_ctrl(), but for some cases, we will not set the arbitration burst
values from userspace, and we still want to use the defaut arbitration burst that
recommended by the controller, taking into consideration any latency requirements.
So I'd like to add a parameter to decide if we can use the default arbitration
burst like below, how do yo think? Thanks.
static bool use_default_arb;
module_param(use_default_arb, bool, 0444);
MODULE_PARM_DESC(use_default_arb, "use default arbitration burst that
recommended by the controller");
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro
2020-06-23 16:27 ` [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro Christoph Hellwig
@ 2020-06-24 2:07 ` Baolin Wang
2020-06-24 2:58 ` Keith Busch
1 sibling, 0 replies; 13+ messages in thread
From: Baolin Wang @ 2020-06-24 2:07 UTC (permalink / raw)
To: Christoph Hellwig
Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, kbusch
On Tue, Jun 23, 2020 at 06:27:51PM +0200, Christoph Hellwig wrote:
> On Tue, Jun 23, 2020 at 09:24:33PM +0800, Baolin Wang wrote:
> > Introduce a new capability macro to indicate if the controller
> > supports the memory buffer or not, instead of reading the
> > NVME_REG_CMBSZ register.
>
> This is a complex issue. The CMBS bit was only added in NVMe 1.4 as
> a backwards incompatible change, as the CMB addressing scheme can lead
Ah, right, I think I should add another version condition:
if ((ctrl->vs >= NVME_VS(1, 4, 0) && !NVME_CAP_CMBS(dev->ctrl.cap)) ||
dev->cmb_size)
return;
> to data corruption. The CMBS was added as part of the horribe hack
> that also involves the CBA field, which we'll need to see before
> using it to work around the addressing issue. At the same time we
> should also continue supporting the legacy pre-1.4 CMB with a warning
> (and may reject it if we know we run in a VM).
Thanks for your explanation. I saw we've added an CMB sysfs attribute
to get the CMB location and size if we enabled CMB, so should we still
add some information in nvme_map_cmb() let user know explicitly?
dev_info(dev->ctrl.device, "Registered the CMB, bar=0x%x, size=%lld\n", bar,
size);
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
2020-06-24 1:34 ` Baolin Wang
@ 2020-06-24 2:51 ` Keith Busch
2020-06-24 2:54 ` Baolin Wang
0 siblings, 1 reply; 13+ messages in thread
From: Keith Busch @ 2020-06-24 2:51 UTC (permalink / raw)
To: Baolin Wang
Cc: Sagi Grimberg, linux-kernel, linux-nvme, axboe, baolin.wang7, hch
On Wed, Jun 24, 2020 at 09:34:08AM +0800, Baolin Wang wrote:
> OK, I understaood your concern. Now we will select the RR arbitration as default
> in nvme_enable_ctrl(), but for some cases, we will not set the arbitration burst
> values from userspace, and we still want to use the defaut arbitration burst that
> recommended by the controller, taking into consideration any latency requirements.
>
> So I'd like to add a parameter to decide if we can use the default arbitration
> burst like below, how do yo think? Thanks.
I wouldn't call this the 'default' arbitration since it usually is not
the default. This is the 'recommended' arbitration value.
> static bool use_default_arb;
> module_param(use_default_arb, bool, 0444);
> MODULE_PARM_DESC(use_default_arb, "use default arbitration burst that
> recommended by the controller");
"use controller's recommended arbitration burst"
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
2020-06-24 2:51 ` Keith Busch
@ 2020-06-24 2:54 ` Baolin Wang
0 siblings, 0 replies; 13+ messages in thread
From: Baolin Wang @ 2020-06-24 2:54 UTC (permalink / raw)
To: Keith Busch
Cc: Sagi Grimberg, linux-kernel, linux-nvme, axboe, baolin.wang7, hch
On Tue, Jun 23, 2020 at 07:51:35PM -0700, Keith Busch wrote:
> On Wed, Jun 24, 2020 at 09:34:08AM +0800, Baolin Wang wrote:
> > OK, I understaood your concern. Now we will select the RR arbitration as default
> > in nvme_enable_ctrl(), but for some cases, we will not set the arbitration burst
> > values from userspace, and we still want to use the defaut arbitration burst that
> > recommended by the controller, taking into consideration any latency requirements.
> >
> > So I'd like to add a parameter to decide if we can use the default arbitration
> > burst like below, how do yo think? Thanks.
>
> I wouldn't call this the 'default' arbitration since it usually is not
> the default. This is the 'recommended' arbitration value.
OK. Change to rename the variable as:
static bool use_recommended_arb;
>
> > static bool use_default_arb;
> > module_param(use_default_arb, bool, 0444);
> > MODULE_PARM_DESC(use_default_arb, "use default arbitration burst that
> > recommended by the controller");
>
> "use controller's recommended arbitration burst"
Sure. Thanks.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
[not found] ` <bf3f47ba50f72d0b775ca4bd098f183056d964ba.1592916850.git.baolin.wang@linux.alibaba.com>
2020-06-23 14:40 ` [PATCH 1/3] nvme: Add Arbitration Burst support Keith Busch
@ 2020-06-24 2:57 ` Keith Busch
2020-06-24 3:06 ` Baolin Wang
1 sibling, 1 reply; 13+ messages in thread
From: Keith Busch @ 2020-06-24 2:57 UTC (permalink / raw)
To: Baolin Wang; +Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, hch
On Tue, Jun 23, 2020 at 09:24:32PM +0800, Baolin Wang wrote:
> +void nvme_set_arbitration_burst(struct nvme_ctrl *ctrl)
> +{
> + u32 result;
> + int status;
> +
> + if (!ctrl->rab)
> + return;
> +
> + /*
> + * The Arbitration Burst setting indicates the maximum number of
> + * commands that the controller may launch at one time from a
> + * particular Submission Queue. It is recommended that host software
> + * configure the Arbitration Burst setting as close to the recommended
> + * value by the controller as possible.
> + */
> + status = nvme_set_features(ctrl, NVME_FEAT_ARBITRATION, ctrl->rab,
Since 'rab' is an 8-bit field, but the feature's AB value is only 3
bits, we should add a validity check.
> +}
> +EXPORT_SYMBOL_GPL(nvme_set_arbitration_burst);
I don't see any particular reason to export this function just for the
pci transport to use. Just make it a local static function an call it
from nvme_init_identify().
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro
2020-06-23 16:27 ` [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro Christoph Hellwig
2020-06-24 2:07 ` Baolin Wang
@ 2020-06-24 2:58 ` Keith Busch
2020-06-24 5:47 ` Christoph Hellwig
1 sibling, 1 reply; 13+ messages in thread
From: Keith Busch @ 2020-06-24 2:58 UTC (permalink / raw)
To: Christoph Hellwig
Cc: sagi, linux-kernel, linux-nvme, axboe, Baolin Wang, baolin.wang7
On Tue, Jun 23, 2020 at 06:27:51PM +0200, Christoph Hellwig wrote:
> On Tue, Jun 23, 2020 at 09:24:33PM +0800, Baolin Wang wrote:
> > Introduce a new capability macro to indicate if the controller
> > supports the memory buffer or not, instead of reading the
> > NVME_REG_CMBSZ register.
>
> This is a complex issue. The CMBS bit was only added in NVMe 1.4 as
> a backwards incompatible change, as the CMB addressing scheme can lead
> to data corruption. The CMBS was added as part of the horribe hack
> that also involves the CBA field, which we'll need to see before
> using it to work around the addressing issue. At the same time we
> should also continue supporting the legacy pre-1.4 CMB with a warning
> (and may reject it if we know we run in a VM).
Well, a CMB from an emulated controller (like qemu's) can be used within
a VM. It's only if you direct assign a PCI function that CMB usage
breaks.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] nvme: Add Arbitration Burst support
2020-06-24 2:57 ` Keith Busch
@ 2020-06-24 3:06 ` Baolin Wang
0 siblings, 0 replies; 13+ messages in thread
From: Baolin Wang @ 2020-06-24 3:06 UTC (permalink / raw)
To: Keith Busch; +Cc: sagi, linux-kernel, linux-nvme, axboe, baolin.wang7, hch
On Tue, Jun 23, 2020 at 07:57:15PM -0700, Keith Busch wrote:
> On Tue, Jun 23, 2020 at 09:24:32PM +0800, Baolin Wang wrote:
> > +void nvme_set_arbitration_burst(struct nvme_ctrl *ctrl)
> > +{
> > + u32 result;
> > + int status;
> > +
> > + if (!ctrl->rab)
> > + return;
> > +
> > + /*
> > + * The Arbitration Burst setting indicates the maximum number of
> > + * commands that the controller may launch at one time from a
> > + * particular Submission Queue. It is recommended that host software
> > + * configure the Arbitration Burst setting as close to the recommended
> > + * value by the controller as possible.
> > + */
> > + status = nvme_set_features(ctrl, NVME_FEAT_ARBITRATION, ctrl->rab,
>
> Since 'rab' is an 8-bit field, but the feature's AB value is only 3
> bits, we should add a validity check.
Sure.
>
> > +}
> > +EXPORT_SYMBOL_GPL(nvme_set_arbitration_burst);
>
> I don't see any particular reason to export this function just for the
> pci transport to use. Just make it a local static function an call it
> from nvme_init_identify().
OK. Thanks.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro
2020-06-24 2:58 ` Keith Busch
@ 2020-06-24 5:47 ` Christoph Hellwig
0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2020-06-24 5:47 UTC (permalink / raw)
To: Keith Busch
Cc: sagi, linux-kernel, linux-nvme, axboe, Baolin Wang, baolin.wang7,
Christoph Hellwig
On Tue, Jun 23, 2020 at 07:58:17PM -0700, Keith Busch wrote:
> On Tue, Jun 23, 2020 at 06:27:51PM +0200, Christoph Hellwig wrote:
> > On Tue, Jun 23, 2020 at 09:24:33PM +0800, Baolin Wang wrote:
> > > Introduce a new capability macro to indicate if the controller
> > > supports the memory buffer or not, instead of reading the
> > > NVME_REG_CMBSZ register.
> >
> > This is a complex issue. The CMBS bit was only added in NVMe 1.4 as
> > a backwards incompatible change, as the CMB addressing scheme can lead
> > to data corruption. The CMBS was added as part of the horribe hack
> > that also involves the CBA field, which we'll need to see before
> > using it to work around the addressing issue. At the same time we
> > should also continue supporting the legacy pre-1.4 CMB with a warning
> > (and may reject it if we know we run in a VM).
>
> Well, a CMB from an emulated controller (like qemu's) can be used within
> a VM. It's only if you direct assign a PCI function that CMB usage
> breaks.
But we have no idea if a controller is assigned or emulated.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-06-24 5:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1592916850.git.baolin.wang@linux.alibaba.com>
[not found] ` <eab18c7696ea0e34a6ab0371d7d17ad45d1566ce.1592916850.git.baolin.wang@linux.alibaba.com>
2020-06-23 16:27 ` [PATCH 2/3] nvme-pci: Add controller memory buffer supported macro Christoph Hellwig
2020-06-24 2:07 ` Baolin Wang
2020-06-24 2:58 ` Keith Busch
2020-06-24 5:47 ` Christoph Hellwig
[not found] ` <a64d35465b8d91ab11f37d814ac10003da7804b8.1592916850.git.baolin.wang@linux.alibaba.com>
2020-06-23 17:39 ` [PATCH 3/3] nvme: Use USEC_PER_SEC instead of magic numbers Sagi Grimberg
[not found] ` <bf3f47ba50f72d0b775ca4bd098f183056d964ba.1592916850.git.baolin.wang@linux.alibaba.com>
2020-06-23 14:40 ` [PATCH 1/3] nvme: Add Arbitration Burst support Keith Busch
2020-06-23 17:39 ` Sagi Grimberg
2020-06-23 18:01 ` Keith Busch
2020-06-24 1:34 ` Baolin Wang
2020-06-24 2:51 ` Keith Busch
2020-06-24 2:54 ` Baolin Wang
2020-06-24 2:57 ` Keith Busch
2020-06-24 3:06 ` Baolin Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox