linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme-fabrics: fix kato initialization
@ 2021-02-18 10:04 Martin George
  2021-02-19 16:42 ` Hannes Reinecke
  0 siblings, 1 reply; 5+ messages in thread
From: Martin George @ 2021-02-18 10:04 UTC (permalink / raw)
  To: linux-nvme; +Cc: Martin George

Currently kato is initialized to NVME_DEFAULT_KATO for both
discovery & i/o controllers. This is a problem specifically
for non-persistent discovery controllers since it always ends
up with a non-zero kato value. Fix this by initializing kato
to zero instead, and ensuring various controllers are assigned
appropriate kato values as follows:

non-persistent controllers  - kato set to zero
persistent controllers      - kato set to NVMF_DEV_DISC_TMO
                              (or any positive int via nvme-cli)
i/o controllers             - kato set to NVME_DEFAULT_KATO
                              (or any positive int via nvme-cli)

Signed-off-by: Martin George <marting@netapp.com>
---
 drivers/nvme/host/fabrics.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 5dfd806fc2d2..604ab0e5a2ad 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -630,7 +630,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 	opts->queue_size = NVMF_DEF_QUEUE_SIZE;
 	opts->nr_io_queues = num_online_cpus();
 	opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
-	opts->kato = NVME_DEFAULT_KATO;
+	opts->kato = 0;
 	opts->duplicate_connect = false;
 	opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO;
 	opts->hdr_digest = false;
@@ -893,6 +893,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 		opts->nr_write_queues = 0;
 		opts->nr_poll_queues = 0;
 		opts->duplicate_connect = true;
+	} else {
+		if (!opts->kato)
+			opts->kato = NVME_DEFAULT_KATO;
 	}
 	if (ctrl_loss_tmo < 0) {
 		opts->max_reconnects = -1;
-- 
2.30.0


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-fabrics: fix kato initialization
  2021-02-18 10:04 [PATCH] nvme-fabrics: fix kato initialization Martin George
@ 2021-02-19 16:42 ` Hannes Reinecke
  2021-02-20  8:41   ` George, Martin
  0 siblings, 1 reply; 5+ messages in thread
From: Hannes Reinecke @ 2021-02-19 16:42 UTC (permalink / raw)
  To: linux-nvme

On 2/18/21 11:04 AM, Martin George wrote:
> Currently kato is initialized to NVME_DEFAULT_KATO for both
> discovery & i/o controllers. This is a problem specifically
> for non-persistent discovery controllers since it always ends
> up with a non-zero kato value. Fix this by initializing kato
> to zero instead, and ensuring various controllers are assigned
> appropriate kato values as follows:
> 
> non-persistent controllers  - kato set to zero
> persistent controllers      - kato set to NVMF_DEV_DISC_TMO
>                                (or any positive int via nvme-cli)
> i/o controllers             - kato set to NVME_DEFAULT_KATO
>                                (or any positive int via nvme-cli)
> 
> Signed-off-by: Martin George <marting@netapp.com>
> ---
>   drivers/nvme/host/fabrics.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index 5dfd806fc2d2..604ab0e5a2ad 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -630,7 +630,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
>   	opts->queue_size = NVMF_DEF_QUEUE_SIZE;
>   	opts->nr_io_queues = num_online_cpus();
>   	opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
> -	opts->kato = NVME_DEFAULT_KATO;
> +	opts->kato = 0;
>   	opts->duplicate_connect = false;
>   	opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO;
>   	opts->hdr_digest = false;
> @@ -893,6 +893,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
>   		opts->nr_write_queues = 0;
>   		opts->nr_poll_queues = 0;
>   		opts->duplicate_connect = true;
> +	} else {
> +		if (!opts->kato)
> +			opts->kato = NVME_DEFAULT_KATO;
>   	}
>   	if (ctrl_loss_tmo < 0) {
>   		opts->max_reconnects = -1;
> 
Can't you merge this with the previous patch 'ensure zero-kato ..'?

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-fabrics: fix kato initialization
  2021-02-19 16:42 ` Hannes Reinecke
@ 2021-02-20  8:41   ` George, Martin
  2021-02-20 14:59     ` Hannes Reinecke
  0 siblings, 1 reply; 5+ messages in thread
From: George, Martin @ 2021-02-20  8:41 UTC (permalink / raw)
  To: hch, kbusch, sagi, hare, linux-nvme

On Fri, 2021-02-19 at 17:42 +0100, Hannes Reinecke wrote:
> On 2/18/21 11:04 AM, Martin George wrote:
> > Currently kato is initialized to NVME_DEFAULT_KATO for both
> > discovery & i/o controllers. This is a problem specifically
> > for non-persistent discovery controllers since it always ends
> > up with a non-zero kato value. Fix this by initializing kato
> > to zero instead, and ensuring various controllers are assigned
> > appropriate kato values as follows:
> > 
> > non-persistent controllers  - kato set to zero
> > persistent controllers      - kato set to NVMF_DEV_DISC_TMO
> >                                (or any positive int via nvme-cli)
> > i/o controllers             - kato set to NVME_DEFAULT_KATO
> >                                (or any positive int via nvme-cli)
> > 
> > Signed-off-by: Martin George <marting@netapp.com>
> > ---
> >   drivers/nvme/host/fabrics.c | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/nvme/host/fabrics.c
> > b/drivers/nvme/host/fabrics.c
> > index 5dfd806fc2d2..604ab0e5a2ad 100644
> > --- a/drivers/nvme/host/fabrics.c
> > +++ b/drivers/nvme/host/fabrics.c
> > @@ -630,7 +630,7 @@ static int nvmf_parse_options(struct
> > nvmf_ctrl_options *opts,
> >       opts->queue_size = NVMF_DEF_QUEUE_SIZE;
> >       opts->nr_io_queues = num_online_cpus();
> >       opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
> > -     opts->kato = NVME_DEFAULT_KATO;
> > +     opts->kato = 0;
> >       opts->duplicate_connect = false;
> >       opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO;
> >       opts->hdr_digest = false;
> > @@ -893,6 +893,9 @@ static int nvmf_parse_options(struct
> > nvmf_ctrl_options *opts,
> >               opts->nr_write_queues = 0;
> >               opts->nr_poll_queues = 0;
> >               opts->duplicate_connect = true;
> > +     } else {
> > +             if (!opts->kato)
> > +                     opts->kato = NVME_DEFAULT_KATO;
> >       }
> >       if (ctrl_loss_tmo < 0) {
> >               opts->max_reconnects = -1;
> > 
> Can't you merge this with the previous patch 'ensure zero-kato ..'?
> 

Well, you are right that both the previous patch (i.e. 'ensure zero
kato for non-persistent controllers') & this current patch are jointly
required for assigning proper kato values to the various controllers,
so it would have made sense to merge the two. But the previous one is a
nvme-cli patch, whereas this current one is a kernel patch. That's why
I chose to create separate individual patches itself here.

So I hope this is good enough. If not, please let me know what's the
right way to proceed here.

-Martin
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-fabrics: fix kato initialization
  2021-02-20  8:41   ` George, Martin
@ 2021-02-20 14:59     ` Hannes Reinecke
  0 siblings, 0 replies; 5+ messages in thread
From: Hannes Reinecke @ 2021-02-20 14:59 UTC (permalink / raw)
  To: George, Martin, hch, kbusch, sagi, linux-nvme

On 2/20/21 9:41 AM, George, Martin wrote:
> On Fri, 2021-02-19 at 17:42 +0100, Hannes Reinecke wrote:
>> On 2/18/21 11:04 AM, Martin George wrote:
>>> Currently kato is initialized to NVME_DEFAULT_KATO for both
>>> discovery & i/o controllers. This is a problem specifically
>>> for non-persistent discovery controllers since it always ends
>>> up with a non-zero kato value. Fix this by initializing kato
>>> to zero instead, and ensuring various controllers are assigned
>>> appropriate kato values as follows:
>>>
>>> non-persistent controllers  - kato set to zero
>>> persistent controllers      - kato set to NVMF_DEV_DISC_TMO
>>>                                 (or any positive int via nvme-cli)
>>> i/o controllers             - kato set to NVME_DEFAULT_KATO
>>>                                 (or any positive int via nvme-cli)
>>>
>>> Signed-off-by: Martin George <marting@netapp.com>
>>> ---
>>>    drivers/nvme/host/fabrics.c | 5 ++++-
>>>    1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/nvme/host/fabrics.c
>>> b/drivers/nvme/host/fabrics.c
>>> index 5dfd806fc2d2..604ab0e5a2ad 100644
>>> --- a/drivers/nvme/host/fabrics.c
>>> +++ b/drivers/nvme/host/fabrics.c
>>> @@ -630,7 +630,7 @@ static int nvmf_parse_options(struct
>>> nvmf_ctrl_options *opts,
>>>        opts->queue_size = NVMF_DEF_QUEUE_SIZE;
>>>        opts->nr_io_queues = num_online_cpus();
>>>        opts->reconnect_delay = NVMF_DEF_RECONNECT_DELAY;
>>> -     opts->kato = NVME_DEFAULT_KATO;
>>> +     opts->kato = 0;
>>>        opts->duplicate_connect = false;
>>>        opts->fast_io_fail_tmo = NVMF_DEF_FAIL_FAST_TMO;
>>>        opts->hdr_digest = false;
>>> @@ -893,6 +893,9 @@ static int nvmf_parse_options(struct
>>> nvmf_ctrl_options *opts,
>>>                opts->nr_write_queues = 0;
>>>                opts->nr_poll_queues = 0;
>>>                opts->duplicate_connect = true;
>>> +     } else {
>>> +             if (!opts->kato)
>>> +                     opts->kato = NVME_DEFAULT_KATO;
>>>        }
>>>        if (ctrl_loss_tmo < 0) {
>>>                opts->max_reconnects = -1;
>>>
>> Can't you merge this with the previous patch 'ensure zero-kato ..'?
>>
> 
> Well, you are right that both the previous patch (i.e. 'ensure zero
> kato for non-persistent controllers') & this current patch are jointly
> required for assigning proper kato values to the various controllers,
> so it would have made sense to merge the two. But the previous one is a
> nvme-cli patch, whereas this current one is a kernel patch. That's why
> I chose to create separate individual patches itself here.
> 
> So I hope this is good enough. If not, please let me know what's the
> right way to proceed here.
> 
Argl. Of course you are correct.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-fabrics: fix kato initialization
       [not found] <20210211175826.4821-1-marting@netapp.com>
@ 2021-02-24  9:14 ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-02-24  9:14 UTC (permalink / raw)
  To: Martin George; +Cc: kbusch, Martin George, hch, linux-nvme, sagi

Thanks,

applied to nvme-5.12.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-24  9:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 10:04 [PATCH] nvme-fabrics: fix kato initialization Martin George
2021-02-19 16:42 ` Hannes Reinecke
2021-02-20  8:41   ` George, Martin
2021-02-20 14:59     ` Hannes Reinecke
     [not found] <20210211175826.4821-1-marting@netapp.com>
2021-02-24  9:14 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).