linux/drivers/nvme/host
Uday Shankar ba0cc7a2e5 nvme: improve handling of long keep alives
[ Upstream commit c7275ce6a5 ]

Upon keep alive completion, nvme_keep_alive_work is scheduled with the
same delay every time. If keep alive commands are completing slowly,
this may cause a keep alive timeout. The following trace illustrates the
issue, taking KATO = 8 and TBKAS off for simplicity:

1. t = 0: run nvme_keep_alive_work, send keep alive
2. t = ε: keep alive reaches controller, controller restarts its keep
          alive timer
3. t = 4: host receives keep alive completion, schedules
          nvme_keep_alive_work with delay 4
4. t = 8: run nvme_keep_alive_work, send keep alive

Here, a keep alive having RTT of 4 causes a delay of at least 8 - ε
between the controller receiving successive keep alives. With ε small,
the controller is likely to detect a keep alive timeout.

Fix this by calculating the RTT of the keep alive command, and adjusting
the scheduling delay of the next keep alive work accordingly.

Reported-by: Costa Sapuntzakis <costa@purestorage.com>
Reported-by: Randy Jennings <randyj@purestorage.com>
Signed-off-by: Uday Shankar <ushankar@purestorage.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2023-06-28 11:12:36 +02:00
..
apple.c nvme-apple: only reset the controller when RTKit is running 2023-02-06 08:06:34 +01:00
auth.c nvme-auth: Diffie-Hellman key exchange support 2022-08-02 17:14:49 -06:00
constants.c nvme: fix the name of Zone Append for verbose logging 2023-06-09 10:34:04 +02:00
core.c nvme: improve handling of long keep alives 2023-06-28 11:12:36 +02:00
fabrics.c nvme: consider also host_iface when checking ip options 2022-09-19 17:55:24 +02:00
fabrics.h nvme-fabrics: show well known discovery name 2023-03-11 13:55:31 +01:00
fault_inject.c block: remove the ->rq_disk field in struct request 2021-11-29 06:41:29 -07:00
fc.c nvme-fc: fix initialization order 2023-02-01 08:34:43 +01:00
fc.h nvme-fc: Update header and host for common definitions for LS handling 2020-05-09 16:18:33 -06:00
hwmon.c nvme-pci: add quirk for missing secondary temperature thresholds 2023-06-09 10:34:09 +02:00
ioctl.c block/io_uring: pass in issue_flags for uring_cmd task_work handling 2023-04-06 12:10:51 +02:00
Kconfig nvme-auth: Diffie-Hellman key exchange support 2022-08-02 17:14:49 -06:00
Makefile nvme: don't always build constants.o 2022-08-02 17:22:48 -06:00
multipath.c nvme-multipath: don't call blk_mark_disk_dead in nvme_mpath_remove_disk 2023-06-09 10:34:15 +02:00
nvme.h nvme: check IO start time when deciding to defer KA 2023-06-28 11:12:36 +02:00
pci.c NVMe: Add MAXIO 1602 to bogus nid list. 2023-06-21 16:00:54 +02:00
rdma.c nvme-rdma: stop auth work after tearing down queues in error recovery 2023-02-22 12:59:55 +01:00
tcp.c nvme-tcp: fix a possible UAF when failing to allocate an io queue 2023-04-26 14:28:37 +02:00
trace.c nvme: implement In-Band authentication 2022-08-02 17:14:49 -06:00
trace.h nvme: fix async event trace event 2023-05-11 23:03:22 +09:00
zns.c block: pass a gendisk to blk_queue_max_open_zones and blk_queue_max_active_zones 2022-07-06 06:46:26 -06:00