Skip to contentSkip to conversation

nvme-fabrics: fix kato initialization

PATCH In review Martin George 3 participants 4 messages Feb 18, 2021 – Feb 20, 2021 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-fabrics: fix kato initialization

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)

---
 drivers/nvme/host/fabrics.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +4 -1
index 5dfd806fc2d2..604ab0e5a2ad 100644
@@ -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;
Signature · 7 lines
2.30.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#1 lore raw
Quoted 33 lines · 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)

---
  drivers/nvme/host/fabrics.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +1 -1
index 5dfd806fc2d2..604ab0e5a2ad 100644
@@ -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;

drivers/nvme/host/fabrics.c static int nvmf_parse_options(struct nvmf_ctrl_options *opts, · line 901

Quoted 9 lines
drivers/nvme/host/fabrics.c +3 -0
@@ -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

Signature · 9 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
#2 lore raw
Quoted 39 lines · Hannes Reinecke
Quoted 38 lines · 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)

---
  drivers/nvme/host/fabrics.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +1 -1
index 5dfd806fc2d2..604ab0e5a2ad 100644
@@ -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;
drivers/nvme/host/fabrics.c +0 -0
@@ -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;
Quoted 9 lines
Quoted 7 lines
drivers/nvme/host/fabrics.c +3 -0
+     } 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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme

#3 lore raw
Quoted 57 lines · Martin
Quoted 39 lines · Hannes Reinecke
Quoted 38 lines · 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)

---
   drivers/nvme/host/fabrics.c | 5 ++++-
   1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/fabrics.c +1 -1
index 5dfd806fc2d2..604ab0e5a2ad 100644
@@ -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;
drivers/nvme/host/fabrics.c +0 -0
@@ -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;
Quoted 9 lines
Quoted 7 lines
drivers/nvme/host/fabrics.c +3 -0
+     } 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.

Quoted 3 lines

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

Signature · 9 lines
Dr. Hannes Reinecke                Kernel Storage Architect
[email protected]                              +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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme