Skip to content

Commit d2a1d45

Browse files
committed
Merge tag 'nvme-6.4-2023-04-14' of git://git.infradead.org/nvme into for-6.4/block
Pull NVMe updates from Christoph: "nvme updates for Linux 6.4 - drop redundant pci_enable_pcie_error_reporting (Bjorn Helgaas) - validate nvmet module parameters (Chaitanya Kulkarni) - fence TCP socket on receive error (Chris Leech) - fix async event trace event (Keith Busch) - minor cleanups (Chaitanya Kulkarni, zhenwei pi) - fix and cleanup nvmet Identify handling (Damien Le Moal, Christoph Hellwig) - fix double blk_mq_complete_request race in the timeout handler (Lei Yin) - fix irq locking in nvme-fcloop (Ming Lei) - remove queue mapping helper for rdma devices (Sagi Grimberg)" * tag 'nvme-6.4-2023-04-14' of git://git.infradead.org/nvme: nvme-fcloop: fix "inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage" blk-mq-rdma: remove queue mapping helper for rdma devices nvme-rdma: minor cleanup in nvme_rdma_create_cq() nvme: fix double blk_mq_complete_request for timeout request with low probability nvme: fix async event trace event nvme-apple: return directly instead of else nvme-apple: return directly instead of else nvmet-tcp: validate idle poll modparam value nvmet-tcp: validate so_priority modparam value nvme-tcp: fence TCP socket on receive error nvmet: remove nvmet_req_cns_error_complete nvmet: rename nvmet_execute_identify_cns_cs_ns nvmet: fix Identify Identification Descriptor List handling nvmet: cleanup nvmet_execute_identify() nvmet: fix I/O Command Set specific Identify Controller nvmet: fix Identify Active Namespace ID list handling nvmet: fix Identify Controller handling nvmet: fix Identify Namespace handling nvmet: fix error handling in nvmet_execute_identify_cns_cs_ns() nvme-pci: drop redundant pci_enable_pcie_error_reporting()
2 parents bb4c19e + 4f86a6f commit d2a1d45

15 files changed

Lines changed: 126 additions & 190 deletions

File tree

block/Kconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,6 @@ config BLK_MQ_VIRTIO
215215
depends on VIRTIO
216216
default y
217217

218-
config BLK_MQ_RDMA
219-
bool
220-
depends on INFINIBAND
221-
default y
222-
223218
config BLK_PM
224219
def_bool PM
225220

block/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o blk-integrity.o
3030
obj-$(CONFIG_BLK_DEV_INTEGRITY_T10) += t10-pi.o
3131
obj-$(CONFIG_BLK_MQ_PCI) += blk-mq-pci.o
3232
obj-$(CONFIG_BLK_MQ_VIRTIO) += blk-mq-virtio.o
33-
obj-$(CONFIG_BLK_MQ_RDMA) += blk-mq-rdma.o
3433
obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned.o
3534
obj-$(CONFIG_BLK_WBT) += blk-wbt.o
3635
obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o

block/blk-mq-rdma.c

Lines changed: 0 additions & 44 deletions
This file was deleted.

drivers/nvme/host/apple.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,16 @@ static inline struct apple_nvme *queue_to_apple_nvme(struct apple_nvme_queue *q)
209209
{
210210
if (q->is_adminq)
211211
return container_of(q, struct apple_nvme, adminq);
212-
else
213-
return container_of(q, struct apple_nvme, ioq);
212+
213+
return container_of(q, struct apple_nvme, ioq);
214214
}
215215

216216
static unsigned int apple_nvme_queue_depth(struct apple_nvme_queue *q)
217217
{
218218
if (q->is_adminq)
219219
return APPLE_NVME_AQ_DEPTH;
220-
else
221-
return APPLE_ANS_MAX_QUEUE_DEPTH;
220+
221+
return APPLE_ANS_MAX_QUEUE_DEPTH;
222222
}
223223

224224
static void apple_nvme_rtkit_crashed(void *cookie)

drivers/nvme/host/core.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,8 @@ bool nvme_cancel_request(struct request *req, void *data)
450450
dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
451451
"Cancelling I/O %d", req->tag);
452452

453-
/* don't abort one completed request */
454-
if (blk_mq_request_completed(req))
453+
/* don't abort one completed or idle request */
454+
if (blk_mq_rq_state(req) != MQ_RQ_IN_FLIGHT)
455455
return true;
456456

457457
nvme_req(req)->status = NVME_SC_HOST_ABORTED_CMD;
@@ -4808,8 +4808,6 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
48084808
u32 aer_notice_type = nvme_aer_subtype(result);
48094809
bool requeue = true;
48104810

4811-
trace_nvme_async_event(ctrl, aer_notice_type);
4812-
48134811
switch (aer_notice_type) {
48144812
case NVME_AER_NOTICE_NS_CHANGED:
48154813
set_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events);
@@ -4845,7 +4843,6 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)
48454843

48464844
static void nvme_handle_aer_persistent_error(struct nvme_ctrl *ctrl)
48474845
{
4848-
trace_nvme_async_event(ctrl, NVME_AER_ERROR);
48494846
dev_warn(ctrl->device, "resetting controller due to AER\n");
48504847
nvme_reset_ctrl(ctrl);
48514848
}
@@ -4861,6 +4858,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
48614858
if (le16_to_cpu(status) >> 1 != NVME_SC_SUCCESS)
48624859
return;
48634860

4861+
trace_nvme_async_event(ctrl, result);
48644862
switch (aer_type) {
48654863
case NVME_AER_NOTICE:
48664864
requeue = nvme_handle_aen_notice(ctrl, result);
@@ -4878,7 +4876,6 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
48784876
case NVME_AER_SMART:
48794877
case NVME_AER_CSS:
48804878
case NVME_AER_VS:
4881-
trace_nvme_async_event(ctrl, aer_type);
48824879
ctrl->aen_result = result;
48834880
break;
48844881
default:

drivers/nvme/host/pci.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66

77
#include <linux/acpi.h>
8-
#include <linux/aer.h>
98
#include <linux/async.h>
109
#include <linux/blkdev.h>
1110
#include <linux/blk-mq.h>
@@ -2535,7 +2534,6 @@ static int nvme_pci_enable(struct nvme_dev *dev)
25352534

25362535
nvme_map_cmb(dev);
25372536

2538-
pci_enable_pcie_error_reporting(pdev);
25392537
pci_save_state(pdev);
25402538

25412539
result = nvme_pci_configure_admin_queue(dev);
@@ -2600,10 +2598,8 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
26002598
nvme_suspend_io_queues(dev);
26012599
nvme_suspend_queue(dev, 0);
26022600
pci_free_irq_vectors(pdev);
2603-
if (pci_is_enabled(pdev)) {
2604-
pci_disable_pcie_error_reporting(pdev);
2601+
if (pci_is_enabled(pdev))
26052602
pci_disable_device(pdev);
2606-
}
26072603
nvme_reap_pending_cqes(dev);
26082604

26092605
nvme_cancel_tagset(&dev->ctrl);

drivers/nvme/host/rdma.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <linux/string.h>
1313
#include <linux/atomic.h>
1414
#include <linux/blk-mq.h>
15-
#include <linux/blk-mq-rdma.h>
1615
#include <linux/blk-integrity.h>
1716
#include <linux/types.h>
1817
#include <linux/list.h>
@@ -464,7 +463,6 @@ static int nvme_rdma_create_cq(struct ib_device *ibdev,
464463
struct nvme_rdma_queue *queue)
465464
{
466465
int ret, comp_vector, idx = nvme_rdma_queue_idx(queue);
467-
enum ib_poll_context poll_ctx;
468466

469467
/*
470468
* Spread I/O queues completion vectors according their queue index.
@@ -473,15 +471,12 @@ static int nvme_rdma_create_cq(struct ib_device *ibdev,
473471
comp_vector = (idx == 0 ? idx : idx - 1) % ibdev->num_comp_vectors;
474472

475473
/* Polling queues need direct cq polling context */
476-
if (nvme_rdma_poll_queue(queue)) {
477-
poll_ctx = IB_POLL_DIRECT;
474+
if (nvme_rdma_poll_queue(queue))
478475
queue->ib_cq = ib_alloc_cq(ibdev, queue, queue->cq_size,
479-
comp_vector, poll_ctx);
480-
} else {
481-
poll_ctx = IB_POLL_SOFTIRQ;
476+
comp_vector, IB_POLL_DIRECT);
477+
else
482478
queue->ib_cq = ib_cq_pool_get(ibdev, queue->cq_size,
483-
comp_vector, poll_ctx);
484-
}
479+
comp_vector, IB_POLL_SOFTIRQ);
485480

486481
if (IS_ERR(queue->ib_cq)) {
487482
ret = PTR_ERR(queue->ib_cq);
@@ -2163,10 +2158,8 @@ static void nvme_rdma_map_queues(struct blk_mq_tag_set *set)
21632158
ctrl->io_queues[HCTX_TYPE_DEFAULT];
21642159
set->map[HCTX_TYPE_READ].queue_offset = 0;
21652160
}
2166-
blk_mq_rdma_map_queues(&set->map[HCTX_TYPE_DEFAULT],
2167-
ctrl->device->dev, 0);
2168-
blk_mq_rdma_map_queues(&set->map[HCTX_TYPE_READ],
2169-
ctrl->device->dev, 0);
2161+
blk_mq_map_queues(&set->map[HCTX_TYPE_DEFAULT]);
2162+
blk_mq_map_queues(&set->map[HCTX_TYPE_READ]);
21702163

21712164
if (opts->nr_poll_queues && ctrl->io_queues[HCTX_TYPE_POLL]) {
21722165
/* map dedicated poll queues only if we have queues left */

drivers/nvme/host/tcp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,9 @@ static int nvme_tcp_recv_skb(read_descriptor_t *desc, struct sk_buff *skb,
876876
size_t consumed = len;
877877
int result;
878878

879+
if (unlikely(!queue->rd_enabled))
880+
return -EFAULT;
881+
879882
while (len) {
880883
switch (nvme_tcp_recv_state(queue)) {
881884
case NVME_TCP_RECV_PDU:

drivers/nvme/host/trace.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,12 @@ TRACE_EVENT(nvme_async_event,
127127
),
128128
TP_printk("nvme%d: NVME_AEN=%#08x [%s]",
129129
__entry->ctrl_id, __entry->result,
130-
__print_symbolic(__entry->result,
131-
aer_name(NVME_AER_NOTICE_NS_CHANGED),
132-
aer_name(NVME_AER_NOTICE_ANA),
133-
aer_name(NVME_AER_NOTICE_FW_ACT_STARTING),
134-
aer_name(NVME_AER_NOTICE_DISC_CHANGED),
135-
aer_name(NVME_AER_ERROR),
136-
aer_name(NVME_AER_SMART),
137-
aer_name(NVME_AER_CSS),
138-
aer_name(NVME_AER_VS))
130+
__print_symbolic(__entry->result & 0x7,
131+
aer_name(NVME_AER_ERROR),
132+
aer_name(NVME_AER_SMART),
133+
aer_name(NVME_AER_NOTICE),
134+
aer_name(NVME_AER_CSS),
135+
aer_name(NVME_AER_VS))
139136
)
140137
);
141138

drivers/nvme/target/admin-cmd.c

Lines changed: 33 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -668,21 +668,11 @@ static void nvmet_execute_identify_desclist(struct nvmet_req *req)
668668
nvmet_req_complete(req, status);
669669
}
670670

671-
static bool nvmet_handle_identify_desclist(struct nvmet_req *req)
671+
static void nvmet_execute_identify_ctrl_nvm(struct nvmet_req *req)
672672
{
673-
switch (req->cmd->identify.csi) {
674-
case NVME_CSI_NVM:
675-
nvmet_execute_identify_desclist(req);
676-
return true;
677-
case NVME_CSI_ZNS:
678-
if (IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
679-
nvmet_execute_identify_desclist(req);
680-
return true;
681-
}
682-
return false;
683-
default:
684-
return false;
685-
}
673+
/* Not supported: return zeroes */
674+
nvmet_req_complete(req,
675+
nvmet_zero_sgl(req, 0, sizeof(struct nvme_id_ctrl_nvm)));
686676
}
687677

688678
static void nvmet_execute_identify(struct nvmet_req *req)
@@ -692,54 +682,49 @@ static void nvmet_execute_identify(struct nvmet_req *req)
692682

693683
switch (req->cmd->identify.cns) {
694684
case NVME_ID_CNS_NS:
685+
nvmet_execute_identify_ns(req);
686+
return;
687+
case NVME_ID_CNS_CTRL:
688+
nvmet_execute_identify_ctrl(req);
689+
return;
690+
case NVME_ID_CNS_NS_ACTIVE_LIST:
691+
nvmet_execute_identify_nslist(req);
692+
return;
693+
case NVME_ID_CNS_NS_DESC_LIST:
694+
nvmet_execute_identify_desclist(req);
695+
return;
696+
case NVME_ID_CNS_CS_NS:
695697
switch (req->cmd->identify.csi) {
696698
case NVME_CSI_NVM:
697-
return nvmet_execute_identify_ns(req);
698-
default:
699+
/* Not supported */
699700
break;
700-
}
701-
break;
702-
case NVME_ID_CNS_CS_NS:
703-
if (IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
704-
switch (req->cmd->identify.csi) {
705-
case NVME_CSI_ZNS:
706-
return nvmet_execute_identify_cns_cs_ns(req);
707-
default:
708-
break;
701+
case NVME_CSI_ZNS:
702+
if (IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
703+
nvmet_execute_identify_ns_zns(req);
704+
return;
709705
}
710-
}
711-
break;
712-
case NVME_ID_CNS_CTRL:
713-
switch (req->cmd->identify.csi) {
714-
case NVME_CSI_NVM:
715-
return nvmet_execute_identify_ctrl(req);
706+
break;
716707
}
717708
break;
718709
case NVME_ID_CNS_CS_CTRL:
719-
if (IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
720-
switch (req->cmd->identify.csi) {
721-
case NVME_CSI_ZNS:
722-
return nvmet_execute_identify_cns_cs_ctrl(req);
723-
default:
724-
break;
725-
}
726-
}
727-
break;
728-
case NVME_ID_CNS_NS_ACTIVE_LIST:
729710
switch (req->cmd->identify.csi) {
730711
case NVME_CSI_NVM:
731-
return nvmet_execute_identify_nslist(req);
732-
default:
712+
nvmet_execute_identify_ctrl_nvm(req);
713+
return;
714+
case NVME_CSI_ZNS:
715+
if (IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
716+
nvmet_execute_identify_ctrl_zns(req);
717+
return;
718+
}
733719
break;
734720
}
735721
break;
736-
case NVME_ID_CNS_NS_DESC_LIST:
737-
if (nvmet_handle_identify_desclist(req) == true)
738-
return;
739-
break;
740722
}
741723

742-
nvmet_req_cns_error_complete(req);
724+
pr_debug("unhandled identify cns %d on qid %d\n",
725+
req->cmd->identify.cns, req->sq->qid);
726+
req->error_loc = offsetof(struct nvme_identify, cns);
727+
nvmet_req_complete(req, NVME_SC_INVALID_FIELD | NVME_SC_DNR);
743728
}
744729

745730
/*

0 commit comments

Comments
 (0)