Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'nvme-6.13-2024-12-05' of git://git.infradead.org/nvme into block-6.13

Pull NVMe fixess from Keith:

"nvme fixes for Linux 6.13

- Target fix using incorrect zero buffer (Nilay)
- Device specifc deallocate quirk fixes (Christoph, Keith)
- Fabrics fix for handling max command target bugs (Maurizio)
- Cocci fix usage for kzalloc (Yu-Chen)
- DMA size fix for host memory buffer feature (Christoph)
- Fabrics queue cleanup fixes (Chunguang)"

* tag 'nvme-6.13-2024-12-05' of git://git.infradead.org/nvme:
nvme-tcp: simplify nvme_tcp_teardown_io_queues()
nvme-tcp: no need to quiesce admin_q in nvme_tcp_teardown_io_queues()
nvme-rdma: unquiesce admin_q before destroy it
nvme-tcp: fix the memleak while create new ctrl failed
nvme-pci: don't use dma_alloc_noncontiguous with 0 merge boundary
nvmet: replace kmalloc + memset with kzalloc for data allocation
nvme-fabrics: handle zero MAXCMD without closing the connection
nvme-pci: remove two deallocate zeroes quirks
nvme: don't apply NVME_QUIRK_DEALLOCATE_ZEROES when DSM is not supported
nvmet: use kzalloc instead of ZERO_PAGE in nvme_execute_identify_ns_nvm()

+22 -30
+5 -3
drivers/nvme/host/core.c
··· 2071 2071 lim->physical_block_size = min(phys_bs, atomic_bs); 2072 2072 lim->io_min = phys_bs; 2073 2073 lim->io_opt = io_opt; 2074 - if (ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES) 2074 + if ((ns->ctrl->quirks & NVME_QUIRK_DEALLOCATE_ZEROES) && 2075 + (ns->ctrl->oncs & NVME_CTRL_ONCS_DSM)) 2075 2076 lim->max_write_zeroes_sectors = UINT_MAX; 2076 2077 else 2077 2078 lim->max_write_zeroes_sectors = ns->ctrl->max_zeroes_sectors; ··· 3261 3260 } 3262 3261 3263 3262 if (!ctrl->maxcmd) { 3264 - dev_err(ctrl->device, "Maximum outstanding commands is 0\n"); 3265 - return -EINVAL; 3263 + dev_warn(ctrl->device, 3264 + "Firmware bug: maximum outstanding commands is 0\n"); 3265 + ctrl->maxcmd = ctrl->sqsize + 1; 3266 3266 } 3267 3267 3268 3268 return 0;
+3 -4
drivers/nvme/host/pci.c
··· 2172 2172 2173 2173 static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred) 2174 2174 { 2175 + unsigned long dma_merge_boundary = dma_get_merge_boundary(dev->dev); 2175 2176 u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES); 2176 2177 u64 hmminds = max_t(u32, dev->ctrl.hmminds * 4096, PAGE_SIZE * 2); 2177 2178 u64 chunk_size; ··· 2181 2180 * If there is an IOMMU that can merge pages, try a virtually 2182 2181 * non-contiguous allocation for a single segment first. 2183 2182 */ 2184 - if (!(PAGE_SIZE & dma_get_merge_boundary(dev->dev))) { 2183 + if (dma_merge_boundary && (PAGE_SIZE & dma_merge_boundary) == 0) { 2185 2184 if (!nvme_alloc_host_mem_single(dev, preferred)) 2186 2185 return 0; 2187 2186 } ··· 3589 3588 NVME_QUIRK_DEALLOCATE_ZEROES, }, 3590 3589 { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ 3591 3590 .driver_data = NVME_QUIRK_STRIPE_SIZE | 3592 - NVME_QUIRK_DEALLOCATE_ZEROES | 3593 3591 NVME_QUIRK_IGNORE_DEV_SUBNQN | 3594 3592 NVME_QUIRK_BOGUS_NID, }, 3595 3593 { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ 3596 - .driver_data = NVME_QUIRK_STRIPE_SIZE | 3597 - NVME_QUIRK_DEALLOCATE_ZEROES, }, 3594 + .driver_data = NVME_QUIRK_STRIPE_SIZE, }, 3598 3595 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ 3599 3596 .driver_data = NVME_QUIRK_NO_DEEPEST_PS | 3600 3597 NVME_QUIRK_MEDIUM_PRIO_SQ |
+1 -7
drivers/nvme/host/rdma.c
··· 1091 1091 } 1092 1092 destroy_admin: 1093 1093 nvme_stop_keep_alive(&ctrl->ctrl); 1094 - nvme_quiesce_admin_queue(&ctrl->ctrl); 1095 - blk_sync_queue(ctrl->ctrl.admin_q); 1096 - nvme_rdma_stop_queue(&ctrl->queues[0]); 1097 - nvme_cancel_admin_tagset(&ctrl->ctrl); 1098 - if (new) 1099 - nvme_remove_admin_tag_set(&ctrl->ctrl); 1100 - nvme_rdma_destroy_admin_queue(ctrl); 1094 + nvme_rdma_teardown_admin_queue(ctrl, new); 1101 1095 return ret; 1102 1096 } 1103 1097
+5 -12
drivers/nvme/host/tcp.c
··· 2101 2101 return ret; 2102 2102 } 2103 2103 2104 - static void nvme_tcp_destroy_admin_queue(struct nvme_ctrl *ctrl, bool remove) 2105 - { 2106 - nvme_tcp_stop_queue(ctrl, 0); 2107 - if (remove) 2108 - nvme_remove_admin_tag_set(ctrl); 2109 - nvme_tcp_free_admin_queue(ctrl); 2110 - } 2111 - 2112 2104 static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new) 2113 2105 { 2114 2106 int error; ··· 2155 2163 blk_sync_queue(ctrl->admin_q); 2156 2164 nvme_tcp_stop_queue(ctrl, 0); 2157 2165 nvme_cancel_admin_tagset(ctrl); 2158 - if (remove) 2166 + if (remove) { 2159 2167 nvme_unquiesce_admin_queue(ctrl); 2160 - nvme_tcp_destroy_admin_queue(ctrl, remove); 2168 + nvme_remove_admin_tag_set(ctrl); 2169 + } 2170 + nvme_tcp_free_admin_queue(ctrl); 2161 2171 if (ctrl->tls_pskid) { 2162 2172 dev_dbg(ctrl->device, "Wipe negotiated TLS_PSK %08x\n", 2163 2173 ctrl->tls_pskid); ··· 2172 2178 { 2173 2179 if (ctrl->queue_count <= 1) 2174 2180 return; 2175 - nvme_quiesce_admin_queue(ctrl); 2176 2181 nvme_quiesce_io_queues(ctrl); 2177 2182 nvme_sync_io_queues(ctrl); 2178 2183 nvme_tcp_stop_io_queues(ctrl); ··· 2271 2278 } 2272 2279 destroy_admin: 2273 2280 nvme_stop_keep_alive(ctrl); 2274 - nvme_tcp_teardown_admin_queue(ctrl, false); 2281 + nvme_tcp_teardown_admin_queue(ctrl, new); 2275 2282 return ret; 2276 2283 } 2277 2284
+7 -2
drivers/nvme/target/admin-cmd.c
··· 902 902 static void nvme_execute_identify_ns_nvm(struct nvmet_req *req) 903 903 { 904 904 u16 status; 905 + struct nvme_id_ns_nvm *id; 905 906 906 907 status = nvmet_req_find_ns(req); 907 908 if (status) 908 909 goto out; 909 910 910 - status = nvmet_copy_to_sgl(req, 0, ZERO_PAGE(0), 911 - NVME_IDENTIFY_DATA_SIZE); 911 + id = kzalloc(sizeof(*id), GFP_KERNEL); 912 + if (!id) { 913 + status = NVME_SC_INTERNAL; 914 + goto out; 915 + } 916 + status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); 912 917 out: 913 918 nvmet_req_complete(req, status); 914 919 }
+1 -2
drivers/nvme/target/pr.c
··· 828 828 goto out; 829 829 } 830 830 831 - data = kmalloc(num_bytes, GFP_KERNEL); 831 + data = kzalloc(num_bytes, GFP_KERNEL); 832 832 if (!data) { 833 833 status = NVME_SC_INTERNAL; 834 834 goto out; 835 835 } 836 - memset(data, 0, num_bytes); 837 836 data->gen = cpu_to_le32(atomic_read(&pr->generation)); 838 837 data->ptpls = 0; 839 838 ctrl_eds = data->regctl_eds;