Skip to content

Commit e576b7b

Browse files
committed
Merge branch 'nvme-4.16-rc5' of git://git.infradead.org/nvme into for-linus
Pull NVMe fixes for this series from Keith: "A few late fixes for 4.16: * Reverting sysfs slave device links for native nvme multipathing. The hidden disk attributes broke common user tools. * A fix for a PPC pci error handling regression. * Update pci interrupt count to consider the actual IRQ spread, fixing potentially poor initial queue affinity. * Off-by-one errors in nvme-fc queue sizes * A fabrics discovery fix to be more tolerant with user tools." * 'nvme-4.16-rc5' of git://git.infradead.org/nvme: nvme_fc: rework sqsize handling nvme-fabrics: Ignore nr_io_queues option for discovery controllers Revert "nvme: create 'slaves' and 'holders' entries for hidden controllers" nvme: pci: pass max vectors as num_possible_cpus() to pci_alloc_irq_vectors nvme-pci: Fix EEH failure on ppc
2 parents 9296080 + d157e53 commit e576b7b

File tree

6 files changed

+30
-57
lines changed

6 files changed

+30
-57
lines changed

drivers/nvme/host/core.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,7 +3033,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
30333033
ns->disk->disk_name);
30343034

30353035
nvme_mpath_add_disk(ns->head);
3036-
nvme_mpath_add_disk_links(ns);
30373036
return;
30383037
out_unlink_ns:
30393038
mutex_lock(&ctrl->subsys->lock);
@@ -3053,7 +3052,6 @@ static void nvme_ns_remove(struct nvme_ns *ns)
30533052
return;
30543053

30553054
if (ns->disk && ns->disk->flags & GENHD_FL_UP) {
3056-
nvme_mpath_remove_disk_links(ns);
30573055
sysfs_remove_group(&disk_to_dev(ns->disk)->kobj,
30583056
&nvme_ns_id_attr_group);
30593057
if (ns->ndev)

drivers/nvme/host/fabrics.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,11 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
650650
ret = -EINVAL;
651651
goto out;
652652
}
653+
if (opts->discovery_nqn) {
654+
pr_debug("Ignoring nr_io_queues value for discovery controller\n");
655+
break;
656+
}
657+
653658
opts->nr_io_queues = min_t(unsigned int,
654659
num_online_cpus(), token);
655660
break;

drivers/nvme/host/fc.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ nvme_fc_connect_admin_queue(struct nvme_fc_ctrl *ctrl,
12061206
sizeof(struct fcnvme_lsdesc_cr_assoc_cmd));
12071207

12081208
assoc_rqst->assoc_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
1209-
assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize);
1209+
assoc_rqst->assoc_cmd.sqsize = cpu_to_be16(qsize - 1);
12101210
/* Linux supports only Dynamic controllers */
12111211
assoc_rqst->assoc_cmd.cntlid = cpu_to_be16(0xffff);
12121212
uuid_copy(&assoc_rqst->assoc_cmd.hostid, &ctrl->ctrl.opts->host->id);
@@ -1321,7 +1321,7 @@ nvme_fc_connect_queue(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue,
13211321
sizeof(struct fcnvme_lsdesc_cr_conn_cmd));
13221322
conn_rqst->connect_cmd.ersp_ratio = cpu_to_be16(ersp_ratio);
13231323
conn_rqst->connect_cmd.qid = cpu_to_be16(queue->qnum);
1324-
conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize);
1324+
conn_rqst->connect_cmd.sqsize = cpu_to_be16(qsize - 1);
13251325

13261326
lsop->queue = queue;
13271327
lsreq->rqstaddr = conn_rqst;
@@ -2481,11 +2481,11 @@ nvme_fc_create_io_queues(struct nvme_fc_ctrl *ctrl)
24812481
goto out_free_tag_set;
24822482
}
24832483

2484-
ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.opts->queue_size);
2484+
ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
24852485
if (ret)
24862486
goto out_cleanup_blk_queue;
24872487

2488-
ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.opts->queue_size);
2488+
ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
24892489
if (ret)
24902490
goto out_delete_hw_queues;
24912491

@@ -2532,11 +2532,11 @@ nvme_fc_reinit_io_queues(struct nvme_fc_ctrl *ctrl)
25322532
if (ret)
25332533
goto out_free_io_queues;
25342534

2535-
ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.opts->queue_size);
2535+
ret = nvme_fc_create_hw_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
25362536
if (ret)
25372537
goto out_free_io_queues;
25382538

2539-
ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.opts->queue_size);
2539+
ret = nvme_fc_connect_io_queues(ctrl, ctrl->ctrl.sqsize + 1);
25402540
if (ret)
25412541
goto out_delete_hw_queues;
25422542

@@ -2632,13 +2632,12 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
26322632
nvme_fc_init_queue(ctrl, 0);
26332633

26342634
ret = __nvme_fc_create_hw_queue(ctrl, &ctrl->queues[0], 0,
2635-
NVME_AQ_BLK_MQ_DEPTH);
2635+
NVME_AQ_DEPTH);
26362636
if (ret)
26372637
goto out_free_queue;
26382638

26392639
ret = nvme_fc_connect_admin_queue(ctrl, &ctrl->queues[0],
2640-
NVME_AQ_BLK_MQ_DEPTH,
2641-
(NVME_AQ_BLK_MQ_DEPTH / 4));
2640+
NVME_AQ_DEPTH, (NVME_AQ_DEPTH / 4));
26422641
if (ret)
26432642
goto out_delete_hw_queue;
26442643

@@ -2666,7 +2665,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
26662665
}
26672666

26682667
ctrl->ctrl.sqsize =
2669-
min_t(int, NVME_CAP_MQES(ctrl->ctrl.cap) + 1, ctrl->ctrl.sqsize);
2668+
min_t(int, NVME_CAP_MQES(ctrl->ctrl.cap), ctrl->ctrl.sqsize);
26702669

26712670
ret = nvme_enable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap);
26722671
if (ret)
@@ -2699,6 +2698,14 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
26992698
opts->queue_size = ctrl->ctrl.maxcmd;
27002699
}
27012700

2701+
if (opts->queue_size > ctrl->ctrl.sqsize + 1) {
2702+
/* warn if sqsize is lower than queue_size */
2703+
dev_warn(ctrl->ctrl.device,
2704+
"queue_size %zu > ctrl sqsize %u, clamping down\n",
2705+
opts->queue_size, ctrl->ctrl.sqsize + 1);
2706+
opts->queue_size = ctrl->ctrl.sqsize + 1;
2707+
}
2708+
27022709
ret = nvme_fc_init_aen_ops(ctrl);
27032710
if (ret)
27042711
goto out_term_aen_ops;

drivers/nvme/host/multipath.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -210,25 +210,6 @@ void nvme_mpath_add_disk(struct nvme_ns_head *head)
210210
mutex_unlock(&head->subsys->lock);
211211
}
212212

213-
void nvme_mpath_add_disk_links(struct nvme_ns *ns)
214-
{
215-
struct kobject *slave_disk_kobj, *holder_disk_kobj;
216-
217-
if (!ns->head->disk)
218-
return;
219-
220-
slave_disk_kobj = &disk_to_dev(ns->disk)->kobj;
221-
if (sysfs_create_link(ns->head->disk->slave_dir, slave_disk_kobj,
222-
kobject_name(slave_disk_kobj)))
223-
return;
224-
225-
holder_disk_kobj = &disk_to_dev(ns->head->disk)->kobj;
226-
if (sysfs_create_link(ns->disk->part0.holder_dir, holder_disk_kobj,
227-
kobject_name(holder_disk_kobj)))
228-
sysfs_remove_link(ns->head->disk->slave_dir,
229-
kobject_name(slave_disk_kobj));
230-
}
231-
232213
void nvme_mpath_remove_disk(struct nvme_ns_head *head)
233214
{
234215
if (!head->disk)
@@ -243,14 +224,3 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
243224
blk_cleanup_queue(head->disk->queue);
244225
put_disk(head->disk);
245226
}
246-
247-
void nvme_mpath_remove_disk_links(struct nvme_ns *ns)
248-
{
249-
if (!ns->head->disk)
250-
return;
251-
252-
sysfs_remove_link(ns->disk->part0.holder_dir,
253-
kobject_name(&disk_to_dev(ns->head->disk)->kobj));
254-
sysfs_remove_link(ns->head->disk->slave_dir,
255-
kobject_name(&disk_to_dev(ns->disk)->kobj));
256-
}

drivers/nvme/host/nvme.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,7 @@ bool nvme_req_needs_failover(struct request *req, blk_status_t error);
410410
void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
411411
int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
412412
void nvme_mpath_add_disk(struct nvme_ns_head *head);
413-
void nvme_mpath_add_disk_links(struct nvme_ns *ns);
414413
void nvme_mpath_remove_disk(struct nvme_ns_head *head);
415-
void nvme_mpath_remove_disk_links(struct nvme_ns *ns);
416414

417415
static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
418416
{
@@ -454,12 +452,6 @@ static inline void nvme_mpath_add_disk(struct nvme_ns_head *head)
454452
static inline void nvme_mpath_remove_disk(struct nvme_ns_head *head)
455453
{
456454
}
457-
static inline void nvme_mpath_add_disk_links(struct nvme_ns *ns)
458-
{
459-
}
460-
static inline void nvme_mpath_remove_disk_links(struct nvme_ns *ns)
461-
{
462-
}
463455
static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
464456
{
465457
}

drivers/nvme/host/pci.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,12 +1153,6 @@ static bool nvme_should_reset(struct nvme_dev *dev, u32 csts)
11531153
if (!(csts & NVME_CSTS_CFS) && !nssro)
11541154
return false;
11551155

1156-
/* If PCI error recovery process is happening, we cannot reset or
1157-
* the recovery mechanism will surely fail.
1158-
*/
1159-
if (pci_channel_offline(to_pci_dev(dev->dev)))
1160-
return false;
1161-
11621156
return true;
11631157
}
11641158

@@ -1189,6 +1183,13 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
11891183
struct nvme_command cmd;
11901184
u32 csts = readl(dev->bar + NVME_REG_CSTS);
11911185

1186+
/* If PCI error recovery process is happening, we cannot reset or
1187+
* the recovery mechanism will surely fail.
1188+
*/
1189+
mb();
1190+
if (pci_channel_offline(to_pci_dev(dev->dev)))
1191+
return BLK_EH_RESET_TIMER;
1192+
11921193
/*
11931194
* Reset immediately if the controller is failed
11941195
*/
@@ -1913,7 +1914,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
19131914
int result, nr_io_queues;
19141915
unsigned long size;
19151916

1916-
nr_io_queues = num_present_cpus();
1917+
nr_io_queues = num_possible_cpus();
19171918
result = nvme_set_queue_count(&dev->ctrl, &nr_io_queues);
19181919
if (result < 0)
19191920
return result;

0 commit comments

Comments
 (0)